Changeset 5875

Show
Ignore:
Timestamp:
29/04/09 18:44:10 (3 years ago)
Author:
westram
Message:
  • tweaked errors/warnings printed by AISC code generator
  • AISC expression 'IF $(KEY)'. When variable KEY is empty or undefined, AISC regards the expression always as TRUE.
    • On OSX this resulted in a bus error, cause the test for operator '!' accessed the byte b4 the empty expression. Fixed.
  • made many functions static / commented out unused code
  • deleted unused files
  • added dependencies (AISC/*pa) to com makefiles -> recompile if any .pa changes
Location:
trunk
Files:
2 removed
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/AISC/aisc.c

    r5844 r5875  
    77 
    88const int linebufsize = 200000; 
    9 char      error_buf[256]; 
     9char      string_buf[256];  
    1010 
    1111struct global_struct *gl; 
     
    4646 
    4747 
    48 void 
    49 aisc_init() 
     48static void aisc_init() 
    5049{ 
    5150    int             i; 
     
    129128} 
    130129 
    131 void p_err(const char *error) { 
     130static void p_err(const char *error) { 
    132131    fprintf(stderr, "%s:%i: Error: %s\n", gl->line_path, gl->line_cnt, error); 
    133132    gl->error_flag = 1; 
    134133} 
    135134 
    136 void p_err_eof         (void){ p_err("Unexpected end of file seen"); } 
    137 void p_error_brih      (void){ p_err("You tried to insert a bracket in a named field"); } 
    138 void p_error_nobr      (void){ p_err("{} found, missing contents"); } 
    139 void p_error_nocbr     (void){ p_err("missing '}'"); } 
    140 void p_error_emwbr     (void){ p_err("string expected, ',' found"); } 
    141 void p_error_hewnoid   (void){ p_err("string expected, ';' found"); } 
    142 void p_error_mixhnh    (void){ p_err("you cannot use the symbol '@' in this line (or it must be the third symbol in the line)"); } 
    143 void p_error_misscom   (void){ p_err("missing ';'"); } 
    144 void p_error_missco    (void){ p_err("missing ',' or ';' or 'newline'"); } 
    145 void p_error_exp_string(void){ p_err("string expected"); } 
    146  
    147 char *read_aisc_string(char ** in, int *is_m) { 
     135static void p_err_eof         (void){ p_err("Unexpected end of file seen"); } 
     136/* static void p_error_brih      (void){ p_err("You tried to insert a bracket in a named field"); } */ 
     137static void p_error_nobr      (void){ p_err("{} found, missing contents"); } 
     138static void p_error_nocbr     (void){ p_err("missing '}'"); } 
     139static void p_error_emwbr     (void){ p_err("string expected, ',' found"); } 
     140static void p_error_hewnoid   (void){ p_err("string expected, ';' found"); } 
     141static void p_error_mixhnh    (void){ p_err("you cannot use the symbol '@' in this line (or it must be the third symbol in the line)"); } 
     142static void p_error_misscom   (void){ p_err("missing ';'"); } 
     143static void p_error_missco    (void){ p_err("missing ',' or ';' or 'newline'"); } 
     144static void p_error_exp_string(void){ p_err("string expected"); } 
     145 
     146static char *read_aisc_string(char ** in, int *is_m) { 
    148147    char           *cp; 
    149148    char            buf[1024]; 
     
    277276    return (char *) strdup(buf); 
    278277} 
    279 AD *make_AD(void) 
    280 { 
    281     return (AD *) calloc(sizeof(AD), 1); 
    282 } 
    283 HS *make_HS(void) 
    284 { 
    285     return (HS *) calloc(sizeof(HS), 1); 
    286 } 
    287 CL *make_CL(void) 
    288 { 
    289     return (CL *) calloc(sizeof(CL), 1); 
    290 } 
     278 
     279static AD *make_AD(void) { return (AD *) calloc(sizeof(AD), 1); } 
     280static HS *make_HS(void) { return (HS *) calloc(sizeof(HS), 1); } 
     281CL *make_CL(void) { return (CL *) calloc(sizeof(CL), 1); } 
    291282 
    292283#define ITEM_MAKE       hitem = make_AD();if (item) {   \ 
     
    296287    }; item  = hitem; item->first_item = first_item; 
    297288 
    298 AD *read_aisc_line(char ** in, HS ** hs) 
     289static AD *read_aisc_line(char ** in, HS ** hs) 
    299290{                               /* lese bis zum ;/} */ 
    300291    static int      is_m; 
     
    463454} 
    464455 
    465 CL *read_prog(char ** in,char *file) 
     456static CL *read_prog(char ** in,char *file) 
    466457{ 
    467458    char *p; 
  • trunk/AISC/aisc.h

    r2991 r5875  
    112112 
    113113extern struct global_struct *gl; 
    114 extern char error_buf[256]; 
     114extern char string_buf[256]; 
    115115#define READ_SPACES(var)        while(gl->s3_tab[(unsigned)(*var)]) var++; 
    116116#define READ_RSPACES(var)       while(gl->s3_tab[(unsigned)(*(--var))]); 
     
    122122#define END_STR2 ')' 
    123123 
     124#include "aisc_proto.h" 
    124125 
     126#define aisc_assert(cond) do { if (!(cond)) { *(char*)NULL = 0; } } while(0) /* core dump */ 
    125127 
     128// #define SHOW_CALLER // show where error was raised 
     129 
     130#ifdef SHOW_CALLER 
     131#define print_error(err)                print_error_internal(err, __FILE__, __LINE__) 
     132#define print_warning(err)              print_warning_internal(err, __FILE__, __LINE__) 
     133#define printf_error(format, arg)       print_error_internal(formatted(format, arg), __FILE__, __LINE__) 
     134#else 
     135#define print_error(err)                print_error_internal(err, NULL, 0) 
     136#define print_warning(err)              print_warning_internal(err, NULL, 0) 
     137#define printf_error(format, arg)       print_error_internal(formatted(format, arg), NULL, 0) 
     138#endif 
  • trunk/AISC/aisc_commands.c

    r5844 r5875  
    1010#include "aisc_proto.h" 
    1111 
    12 int      contains_tabs = 0; 
    13  
    14 int print_error(const char *err) { 
    15     /* fprintf(stderr, "ERROR: %s: line %i in file %s\n", err, gl->pc->linenr, gl->pc->path); */ 
    16     fprintf(stderr, "%s:%i: Error: %s\n", gl->pc->path, gl->pc->linenr, err); 
    17     return 1; 
     12int contains_tabs = 0; 
     13static int error_count = 0; 
     14 
     15void print_error_internal(const char *err, const char *launcher_file, int launcher_line) { 
     16    fprintf(stderr, "./%s:%i: Error: %s\n", gl->pc->path, gl->pc->linenr, err); 
     17    if (launcher_file) fprintf(stderr, "../AISC/%s:%i: error was launched from here\n", launcher_file, launcher_line); 
     18    error_count++; 
     19} 
     20 
     21void print_warning_internal(const char *err, const char *launcher_file, int launcher_line) { 
     22    fprintf(stderr, "./%s:%i: Warning: %s\n", gl->pc->path, gl->pc->linenr, err); 
     23    if (launcher_file) fprintf(stderr, "../AISC/%s:%i: error was launched from here\n", launcher_file, launcher_line); 
    1824} 
    1925 
    2026#define ERRBUFSIZE 200 
    21  
    22 int printf_error(const char *format, ...) { 
     27const char *formatted(const char *format, ...) { 
    2328    /* goes to header:  __ATTR__FORMAT(1) */ 
     29 
    2430    static char *errbuf = 0; 
    2531    if (!errbuf) { errbuf = (char*)malloc(ERRBUFSIZE+1); } 
     
    2935    int     chars = vsprintf(errbuf, format, argPtr); 
    3036    if (chars>ERRBUFSIZE) { 
    31         fprintf(stderr, "%s:%i: Error buffer overflow!\n", __FILE__, __LINE__); 
     37        fprintf(stderr, "%s:%i: Error: Buffer overflow!\n", __FILE__, __LINE__); 
    3238        vfprintf(stderr, format, argPtr); 
    3339        fputc('\n', stderr); 
     
    3844    va_end(argPtr); 
    3945 
    40     return print_error(errbuf); 
    41 } 
    42  
     46    return errbuf; 
     47} 
    4348#undef ERRBUFSIZE 
    4449 
    45 void memcopy(char *dest, const char *source, int len) 
     50static void memcopy(char *dest, const char *source, int len) 
    4651{ 
    4752    int         i; 
     
    6570} 
    6671 
    67 char *find_string(const char *str,const char *key) 
     72static char *find_string(const char *str,const char *key) 
    6873{ 
    6974    const char *p1,*p2; 
     
    8489} 
    8590 
    86 char *calc_rest_line(/*const*/ char *str, int size, int presize) 
    87 {                               /* wertet einen Puffer str aus , str[-1] muss exestieren !!! */ 
     91static char *calc_rest_line(/*const*/ char *str, int size, int presize) 
     92{ 
     93    /* wertet einen Puffer str aus , str[-1] muss exestieren !!! */ 
    8894    char *ld; 
    8995    char *p; 
     
    131137        fi = strpbrk(path, "+,"); 
    132138        if (!fi) { 
    133             print_error("NO '+,;' found in ADD FUNKTION"); 
     139            print_error("NO '+,;' found in ADD FUNCTION"); 
    134140            return 0; 
    135141        } 
    136142        *(fi++) = 0; 
    137143        READ_SPACES(fi); 
    138         sprintf(error_buf, "%li", atol(path) + atol(fi)); 
    139         fi = strdup(error_buf); 
     144        sprintf(string_buf, "%li", atol(path) + atol(fi)); 
     145        fi = strdup(string_buf); 
    140146    }else if (*p == '*') { 
    141147        path = p + 1; 
     
    143149        fi = strpbrk(path, "*,"); 
    144150        if (!fi) { 
    145             print_error("NO '*,;' found in ADD FUNKTION"); 
     151            print_error("NO '*,;' found in ADD FUNCTION"); 
    146152            return 0; 
    147153        } 
    148154        *(fi++) = 0; 
    149155        READ_SPACES(fi); 
    150         sprintf(error_buf, "%li", atol(path) * atol(fi)); 
    151         fi = strdup(error_buf); 
     156        sprintf(string_buf, "%li", atol(path) * atol(fi)); 
     157        fi = strdup(string_buf); 
    152158    } else if (*p == '#') { 
    153159        if (!strncmp(p, "#FILE", 5)) { 
     
    206212 
    207213 
    208 int 
    209 calc_line(char *str, char *buf) 
     214static int calc_line(char *str, char *buf) 
    210215{ 
    211216    char           *ld; 
     
    225230} 
    226231 
    227 int 
    228 calc_line2(char *str, char *buf) 
     232static int calc_line2(char *str, char *buf) 
    229233{                               /* erstes $( nicht auswerten ) !!! */ 
    230234    char           *ld; 
     
    251255} 
    252256 
    253 void 
    254 write_aisc(AD * ad, FILE * out, int deep) 
     257static void write_aisc(AD * ad, FILE * out, int deep) 
    255258{ 
    256259    AD             *item, *line; 
     
    279282} 
    280283 
    281 void 
    282 write_prg(CL * cl, FILE * out, int deep) 
     284/* 
     285static void write_prg(CL * cl, FILE * out, int deep) 
    283286{ 
    284287    CL             *line; 
     
    290293    } 
    291294} 
    292  
    293  
    294 int 
    295 do_com_dbg(char *str) 
     295*/ 
     296 
     297static int do_com_dbg(char *str) 
    296298{ 
    297299    write_aisc(gl->root, stdout, 0); 
     
    299301    return 0; 
    300302} 
    301 int 
    302 do_com_data(char *str) 
     303static int do_com_data(char *str) 
    303304{ 
    304305    char           *in; 
     
    319320} 
    320321 
    321 int 
    322 do_com_write(FILE * out, char *str) 
     322static int do_com_write(FILE * out, char *str) 
    323323{ 
    324324    char *p; 
     
    380380                p = strchr(p, '@'); 
    381381                if (!p) { 
    382                     printf_error("expected '@' after '@SETSOURCE' (injected code)"); 
     382                    print_error("expected '@' after '@SETSOURCE' (injected code)"); 
    383383                    return 1; 
    384384                } 
     
    401401} 
    402402 
    403 int 
    404 do_com_print(char *str) 
     403static int do_com_print(char *str) 
    405404{ 
    406405    do_com_write(gl->out, str); 
    407406    return 0; 
    408407} 
    409 int 
    410 do_com_print2(char *str) 
     408static int do_com_print2(char *str) 
    411409{ 
    412410    do_com_write(stdout, str); 
     
    414412} 
    415413 
    416 int 
    417 do_com_tabstop(char *str) 
     414static int do_com_tabstop(char *str) 
    418415{ 
    419416    int             ts, i; 
     
    429426} 
    430427 
    431 int 
    432 do_com_tab(char *str) 
     428static int do_com_tab(char *str) 
    433429{ 
    434430    int             ts, val; 
     
    450446} 
    451447 
    452 int 
    453 do_com_error(char *str) 
     448static int do_com_error(char *str) 
    454449{ 
    455450    print_error(str); 
    456451    return 1; 
    457452} 
    458 int do_com_open(char *str) 
     453 
     454static int do_com_open(char *str) 
    459455{ 
    460456    FILE           *file; 
     
    469465    } 
    470466    if (strlen(fn) < 3) { 
    471         print_error("Filename too short (<3)"); 
     467        printf_error("Filename '%s' too short (<3)", fn); 
    472468        return 1; 
    473469    } 
    474470    for (i = 0; i < OPENFILES; i++) { 
    475471        if (gl->fouts[i]) { 
    476             if (!strcmp(gl->fouts[i], str)) { 
    477                 print_error("File already opened"); 
     472            if (strcmp(gl->fouts[i], str) == 0) { 
     473                printf_error("File '%s' already opened", str); 
    478474                return 1; 
    479475            } 
     
    486482    } 
    487483    if (i == OPENFILES) { 
    488         print_error("Too many Files open"); 
     484        print_error("Too many open files"); 
    489485        return 1; 
    490486    } 
    491487    file = fopen(fn, "w"); 
    492488    if (!file) { 
    493         print_error("Cannot open File"); 
     489        printf_error("Cannot open file '%s'", fn); 
    494490        return 1; 
    495491    } 
     
    517513} 
    518514 
    519 int do_com_close(char *str) 
     515static int do_com_close(char *str) 
    520516{ 
    521517    int             i; 
     
    541537} 
    542538 
    543 int do_com_out(char *str) 
     539static int do_com_out(char *str) 
    544540{ 
    545541    int             i; 
     
    554550        } 
    555551    } 
    556     print_error("File not opened for OUT Command"); 
     552    printf_error("File '%s' not opened for OUT Command", str); 
    557553    return 1; 
    558554} 
    559555 
    560 int do_com_moveto(char *str) 
     556static int do_com_moveto(char *str) 
    561557{ 
    562558    AD             *fo; 
     
    590586} 
    591587 
    592 int do_com_set(char *str) 
     588static int do_com_set(char *str) 
    593589{ 
    594590    char           *st; 
     
    611607    def = read_hash_local(st,&hs); 
    612608    if (!def) { 
    613         sprintf(error_buf, "not defined Ident '%s' in SET (use CREATE first)", st); 
    614         print_error(error_buf); 
     609        printf_error("undefined Ident '%s' in SET (use CREATE first)", st); 
    615610        return 1; 
    616611    } 
     
    624619} 
    625620 
    626 int do_com_create(char *str) 
     621static int do_com_create(char *str) 
    627622{ 
    628623    char           *st; 
     
    643638    def = read_hash( gl->st->hs,st); 
    644639    if (def) { 
    645         sprintf(error_buf, "Ident '%s' in CREATE already defined", st); 
    646         print_error(error_buf); 
     640        printf_error("Ident '%s' in CREATE already defined", st); 
    647641        return 1; 
    648642    } 
     
    656650} 
    657651 
    658 int 
    659 do_com_if(char *str) 
     652static int do_com_if(char *str) 
    660653{ 
    661654    char           *equ; 
     
    663656    char           *la; 
    664657    char           *kom2; 
    665     int         op = 0; /* 0=   1~ 2< 3> !+8 */ 
     658 
     659    int op = 0;                                     /* 0=   1~ 2< 3> !+8 */ 
    666660    for (equ = str;*equ;equ++) { 
    667661        if (*equ =='=') { op = 0; break;} 
     
    670664          if (*equ =='>') { op = 3; break;}*/ 
    671665    } 
    672     if (equ[-1] == '!') op +=8; 
    673666    la = equ; 
    674     if (!*la) return 0; 
     667    if (!*la) { // no operator found -> assume condition true, even if empty or undefined 
     668        return 0; 
     669    } 
     670 
     671    aisc_assert(equ>str); 
     672    if (equ[-1] == '!') op += 8; 
     673 
    675674    READ_RSPACES(la); 
    676675    *(++la) = 0; 
     
    690689            case 1:     if ( find_string(str, equ)) return 0; break; 
    691690            case 9:     if (!find_string(str, equ)) return 0; break; 
    692             case 2:     if (strcmp(str, equ)< 0) return 0; break; 
    693             case 10:if (strcmp(str, equ)>=0) return 0; break; 
    694             case 3:     if (strcmp(str, equ)> 0) return 0; break; 
    695             case 11:if (strcmp(str, equ)<=0) return 0; break; 
     691                /* case 2:     if (strcmp(str, equ)< 0) return 0; break; */ 
     692                /* case 10:if (strcmp(str, equ)>=0) return 0; break; */ 
     693                /* case 3:     if (strcmp(str, equ)> 0) return 0; break; */ 
     694                /* case 11:if (strcmp(str, equ) <= 0) return 0; break; */ 
     695            default : 
     696                printf_error("Unhandled operator (op=%i)", op); 
     697                return 1; 
    696698        } 
    697699        equ = kom2; 
    698700    } 
    699     gl->nextpc = gl->pc->ELSE->next; 
    700     return 0; 
    701 } 
    702  
    703 int do_com_for_add(CL *co) 
     701 
     702    // condition wrong -> goto else 
     703    gl->nextpc = gl->pc->ELSE->next;  
     704    return 0; 
     705} 
     706 
     707static int do_com_for_add(CL *co) 
    704708{ 
    705709    struct for_data_struct *fd; 
     
    710714} 
    711715 
    712 int do_com_for_sub(CL *co) 
     716static int do_com_for_sub(CL *co) 
    713717{ 
    714718    struct for_data_struct *fd; 
     
    738742} 
    739743 
    740 int do_com_pop(const char *str) 
     744static int do_com_pop(const char *str) 
    741745{ 
    742746    struct stack_struct *st; 
     
    754758} 
    755759 
    756 int do_com_gosub(char *str) 
     760static int do_com_gosub(char *str) 
    757761{ 
    758762    char *fn; 
     
    773777    fn = read_hash(gl->fns,str); 
    774778    if (!fn) { 
    775         print_error("Funktion not found"); 
     779        printf_error("Function '%s' not found", str); 
    776780        return 1; 
    777781    } 
     
    784788    for (para = params; *para;para=npara,fpara=nfpara){ 
    785789        if (!*fpara) { 
    786             sprintf(error_buf,"Too many Parameters %s",para); 
    787             print_error(error_buf); 
     790            printf_error("Too many Parameters %s",para); 
    788791            return 1; 
    789792        } 
     
    795798        *s = 0; 
    796799        s = read_hash( gl->st->hs,para); 
    797         if (s) {        sprintf(error_buf,"duplikated formal parameter %s",para); 
    798             print_error(error_buf); 
     800        if (s) { 
     801            printf_error("duplicated formal parameter %s", para); 
    799802            return 1; 
    800803        } 
     
    802805    } 
    803806    if (*fpara) { 
    804         sprintf(error_buf,"Too less Parameters %s",fpara); 
    805         print_error(error_buf); 
     807        printf_error("Not enough parameters '%s'", fpara); 
    806808        return 1; 
    807809    } 
     
    811813} 
    812814 
    813 int do_com_goto(char *str) 
     815static int do_com_goto(char *str) 
    814816{ 
    815817    char *fn; 
    816818    fn = read_hash(gl->fns,str); 
    817819    if (!fn) { 
    818         print_error("Function not found"); 
     820        printf_error("Function '%s' not found", str); 
    819821        return 1; 
    820822    } 
     
    823825} 
    824826 
    825 int do_com_return(char *str) 
     827static int do_com_return(char *str) 
    826828{ 
    827829    gl->nextpc = gl->st->pc->next; 
     
    830832    return 0; 
    831833} 
    832 int do_com_exit(char *str) 
     834static int do_com_exit(char *str) 
    833835{ 
    834836    str = str; 
     
    836838} 
    837839 
    838 int 
    839 do_com_for(char *str) 
     840static int do_com_for(char *str) 
    840841{ 
    841842    AD             *fo; 
     
    872873        p = (char *) read_hash_local(st, &hs); 
    873874        if (!p) { 
    874             sprintf(error_buf, "not defined Ident '%s' in FOR (use CREATE first)", st); 
    875             print_error(error_buf); 
     875            printf_error("Undefined Ident '%s' in FOR (use CREATE first)", st); 
    876876            return 1; 
    877877        } 
    878         sprintf(error_buf, "%li", gl->pc->fd->forval); 
    879         write_hash(hs, st, error_buf); 
     878        sprintf(string_buf, "%li", gl->pc->fd->forval); 
     879        write_hash(hs, st, string_buf); 
    880880        gl->pc->fd->forstr = strdup(st); 
    881881    } else { 
     
    902902} 
    903903 
    904 int do_com_next(const char *str) 
     904static int do_com_next(const char *str) 
    905905{ 
    906906    AD             *fo; 
     
    925925            gl->nextpc = gl->pc->FOR->next; 
    926926            p = read_hash_local(gl->pc->FOR->fd->forstr,&hs); 
    927             sprintf(error_buf, "%li", gl->pc->FOR->fd->forval); 
    928             write_hash(hs, gl->pc->FOR->fd->forstr, error_buf); 
     927            sprintf(string_buf, "%li", gl->pc->FOR->fd->forval); 
     928            write_hash(hs, gl->pc->FOR->fd->forstr, string_buf); 
    929929        } 
    930930 
     
    934934} 
    935935 
    936 #define COMMAND(str,string,len,func)                                    \ 
    937     if ( string[0] == str[0] && !strncmp(string,str,len)) {             \ 
    938         char *s=str+len;                                                \ 
    939         READ_SPACES(s);                                                 \ 
    940         if (func(s)) break;                                             \ 
    941         continue;                                                       \ 
    942     } 
    943  
    944 #define COMMAND_NOFAIL(str,string,len,func)                             \ 
    945     if ( string[0] == str[0] && !strncmp(string,str,len)) {             \ 
    946         char *s=str+len;                                                \ 
    947         READ_SPACES(s);                                                 \ 
    948         if (func(s)) return -1;                                         \ 
    949         continue;                                                       \ 
    950     } 
    951  
    952 #define COMMAND2(str,string,len,func)                                   \ 
    953     if ( string[0] == str[0] && !strncmp(string,str,len)) {             \ 
    954         char *s=str+len;                                                \ 
    955         if (func(s)) break;                                             \ 
    956         continue;                                                       \ 
    957     } 
    958  
    959 #define COMMAND2_NOFAIL(str,string,len,func)                            \ 
    960     if (string[0] == str[0] && !strncmp(string,str,len)) {              \ 
    961         char *s=str+len;                                                \ 
    962         if (func(s)) return -1;                                         \ 
    963         continue;                                                       \ 
     936#define COMMAND(str,string,len,func)                            \ 
     937    if ( string[0] == str[0] && !strncmp(string,str,len)) {     \ 
     938        char *s=str+len;                                        \ 
     939        READ_SPACES(s);                                         \ 
     940        if (func(s)) break;                                     \ 
     941        continue;                                               \ 
     942    } 
     943 
     944#define COMMAND_NOFAIL(str,string,len,func)                     \ 
     945    if ( string[0] == str[0] && !strncmp(string,str,len)) {     \ 
     946        char *s=str+len;                                        \ 
     947        READ_SPACES(s);                                         \ 
     948        if (func(s)) return -1;                                 \ 
     949        continue;                                               \ 
     950    } 
     951 
     952#define COMMAND2(str,string,len,func)                           \ 
     953    if ( string[0] == str[0] && !strncmp(string,str,len)) {     \ 
     954        char *s=str+len;                                        \ 
     955        if (func(s)) break;                                     \ 
     956        continue;                                               \ 
     957    } 
     958 
     959#define COMMAND2_NOFAIL(str,string,len,func)                    \ 
     960    if (string[0] == str[0] && !strncmp(string,str,len)) {      \ 
     961        char *s=str+len;                                        \ 
     962        if (func(s)) return -1;                                 \ 
     963        continue;                                               \ 
    964964    } 
    965965 
     
    976976                        break; 
    977977                    } 
     978                     
    978979                    if (do_com_if(gl->linebuf)) 
    979980                        return 1; 
     
    10271028            return err; 
    10281029 
    1029         COMMAND2(gl->linebuf,"PRINT",5,do_com_print) 
    1030             COMMAND2(gl->linebuf,"P ",2,do_com_print) 
    1031             COMMAND2(gl->linebuf,"P\t",2,do_com_print) 
    1032             COMMAND(gl->linebuf,"GOSUB",5,do_com_gosub) 
    1033             COMMAND(gl->linebuf,"CALL",4,do_com_gosub) 
    1034             COMMAND(gl->linebuf,"GOTO",4,do_com_goto) 
    1035             COMMAND(gl->linebuf,"RETURN",6,do_com_return) 
    1036             COMMAND(gl->linebuf,"PUSH",4,do_com_push) 
    1037             COMMAND(gl->linebuf,"POP",3,do_com_pop) 
    1038             COMMAND(gl->linebuf,"CONTINUE",8,do_com_next) 
    1039  
    1040  
    1041             COMMAND(gl->linebuf,"OPEN",4,do_com_open) 
    1042             COMMAND(gl->linebuf,"CLOSE",5,do_com_close) 
    1043             COMMAND(gl->linebuf,"OUT",3,do_com_out) 
    1044             COMMAND2_NOFAIL(gl->linebuf,"ERROR",5,do_com_error) 
    1045             COMMAND(gl->linebuf,"TABSTOP",7,do_com_tabstop) 
    1046             COMMAND(gl->linebuf,"TAB",3,do_com_tab) 
    1047             COMMAND(gl->linebuf,"PP",2,do_com_print2) 
    1048             COMMAND(gl->linebuf,"EXIT",4,do_com_exit) 
    1049             COMMAND_NOFAIL(gl->linebuf,"DATA",4,do_com_data) 
    1050             COMMAND(gl->linebuf,"DBG",3,do_com_dbg) 
    1051             printf_error("Unknown Command '%s'", gl->pc->str); 
     1030        COMMAND2(gl->linebuf,"PRINT",5,do_com_print); 
     1031        COMMAND2(gl->linebuf,"P ",2,do_com_print); 
     1032        COMMAND2(gl->linebuf,"P\t",2,do_com_print); 
     1033        COMMAND(gl->linebuf,"GOSUB",5,do_com_gosub); 
     1034        COMMAND(gl->linebuf,"CALL",4,do_com_gosub); 
     1035        COMMAND(gl->linebuf,"GOTO",4,do_com_goto); 
     1036        COMMAND(gl->linebuf,"RETURN",6,do_com_return); 
     1037        COMMAND(gl->linebuf,"PUSH",4,do_com_push); 
     1038        COMMAND(gl->linebuf,"POP",3,do_com_pop); 
     1039        COMMAND(gl->linebuf,"CONTINUE",8,do_com_next); 
     1040 
     1041 
     1042        COMMAND(gl->linebuf,"OPEN",4,do_com_open); 
     1043        COMMAND(gl->linebuf,"CLOSE",5,do_com_close); 
     1044        COMMAND(gl->linebuf,"OUT",3,do_com_out); 
     1045        COMMAND2_NOFAIL(gl->linebuf,"ERROR",5,do_com_error); 
     1046        COMMAND(gl->linebuf,"TABSTOP",7,do_com_tabstop); 
     1047        COMMAND(gl->linebuf,"TAB",3,do_com_tab); 
     1048        COMMAND(gl->linebuf,"PP",2,do_com_print2); 
     1049        COMMAND(gl->linebuf,"EXIT",4,do_com_exit); 
     1050        COMMAND_NOFAIL(gl->linebuf,"DATA",4,do_com_data); 
     1051        COMMAND(gl->linebuf,"DBG",3,do_com_dbg); 
     1052 
     1053        printf_error("Unknown Command '%s'", gl->pc->str); 
    10521054        return -1; 
    10531055    } 
    1054     return 0; 
    1055 } 
     1056 
     1057    aisc_assert(error_count == 0); 
     1058    return 0; 
     1059} 
  • trunk/AISC/aisc_mix.c

    r5439 r5875  
    221221            free(co->str); 
    222222            co->str = s2; 
    223             sprintf(error_buf,"%li",(long)co); 
    224             write_hash(gl->fns,buf2,error_buf); 
     223            sprintf(string_buf,"%li",(long)co); 
     224            write_hash(gl->fns,buf2,string_buf); 
    225225            continue; 
    226226        } 
     
    232232            free(co->str); 
    233233            co->str = buf2; 
    234             sprintf(error_buf,"%li",(long)co); 
    235             write_hash(gl->fns,buf2,error_buf); 
    236             continue; 
    237         } 
    238     } 
    239     return 0; 
    240 } 
    241  
    242 int hash_index(const char *key, int size) 
     234            sprintf(string_buf,"%li",(long)co); 
     235            write_hash(gl->fns,buf2,string_buf); 
     236            continue; 
     237        } 
     238    } 
     239    return 0; 
     240} 
     241 
     242static int hash_index(const char *key, int size) 
    243243{ 
    244244    int         x; 
  • trunk/AISC/aisc_proto.h

    r5126 r5875  
    2727/* aisc.c */ 
    2828char *read_aisc_file P_((char *path)); 
    29 void aisc_init P_((void)); 
    30 void p_err P_((const char *error)); 
    31 void p_err_eof P_((void)); 
    32 void p_error_brih P_((void)); 
    33 void p_error_nobr P_((void)); 
    34 void p_error_nocbr P_((void)); 
    35 void p_error_emwbr P_((void)); 
    36 void p_error_hewnoid P_((void)); 
    37 void p_error_mixhnh P_((void)); 
    38 void p_error_misscom P_((void)); 
    39 void p_error_missco P_((void)); 
    40 void p_error_exp_string P_((void)); 
    41 char *read_aisc_string P_((char **in, int *is_m)); 
    42 AD *make_AD P_((void)); 
    43 HS *make_HS P_((void)); 
    4429CL *make_CL P_((void)); 
    45 AD *read_aisc_line P_((char **in, HS **hs)); 
    4630AD *read_aisc P_((char **in)); 
    47 CL *read_prog P_((char **in, char *file)); 
    4831 
    4932/* aisc_commands.c */ 
    50 int print_error P_((const char *err)); 
    51 int printf_error P_((const char *format, ...)) __ATTR__FORMAT(1); 
    52 void memcopy P_((char *dest, const char *source, int len)); 
    53 char *find_string P_((const char *str, const char *key)); 
    54 char *calc_rest_line P_((char *str, int size, int presize)); 
    55 int calc_line P_((char *str, char *buf)); 
    56 int calc_line2 P_((char *str, char *buf)); 
    57 void write_aisc P_((AD *ad, FILE *out, int deep)); 
    58 void write_prg P_((CL *cl, FILE *out, int deep)); 
    59 int do_com_dbg P_((char *str)); 
    60 int do_com_data P_((char *str)); 
    61 int do_com_write P_((FILE *out, char *str)); 
    62 int do_com_print P_((char *str)); 
    63 int do_com_print2 P_((char *str)); 
    64 int do_com_tabstop P_((char *str)); 
    65 int do_com_tab P_((char *str)); 
    66 int do_com_error P_((char *str)); 
    67 int do_com_open P_((char *str)); 
     33void print_error_internal P_((const char *err, const char *launcher_file, int launcher_line)); 
     34void print_warning_internal P_((const char *err, const char *launcher_file, int launcher_line)); 
     35const char *formatted P_((const char *format, ...)) __ATTR__FORMAT(1); 
    6836void aisc_remove_files P_((void)); 
    69 int do_com_close P_((char *str)); 
    70 int do_com_out P_((char *str)); 
    71 int do_com_moveto P_((char *str)); 
    72 int do_com_set P_((char *str)); 
    73 int do_com_create P_((char *str)); 
    74 int do_com_if P_((char *str)); 
    75 int do_com_for_add P_((CL *co)); 
    76 int do_com_for_sub P_((CL *co)); 
    7737int do_com_push P_((const char *str)); 
    78 int do_com_pop P_((const char *str)); 
    79 int do_com_gosub P_((char *str)); 
    80 int do_com_goto P_((char *str)); 
    81 int do_com_return P_((char *str)); 
    82 int do_com_exit P_((char *str)); 
    83 int do_com_for P_((char *str)); 
    84 int do_com_next P_((const char *str)); 
    8538int run_prg P_((void)); 
    8639 
     
    8841CL *aisc_calc_blocks P_((CL *co, CL *afor, CL *aif, int up)); 
    8942int aisc_calc_special_commands P_((void)); 
    90 int hash_index P_((const char *key, int size)); 
    9143struct hash_struct *create_hash P_((int size)); 
    9244char *read_hash_local P_((char *key, struct hash_struct **hs)); 
     
    9648 
    9749/* aisc_var_ref.c */ 
    98 AD *aisc_match P_((AD *var, char *varid, char *varct)); 
    9950AD *aisc_find_var_hier P_((AD *cursor, char *str, int next, int extended, int goup)); 
    10051AD *aisc_find_var P_((AD *cursor, char *str, int next, int extended, int goup)); 
  • trunk/AISC/aisc_var_ref.c

    r5390 r5875  
    66#include "aisc_proto.h" 
    77 
    8 AD *aisc_match(AD * var, char *varid, char *varct) { 
     8static AD *aisc_match(AD * var, char *varid, char *varct) { 
    99    if (varid) { 
    1010        if (strcmp(var->key, varid)) { 
     
    168168                    return 0; 
    169169                } 
    170                 fprintf(stderr, "%s: ", var); 
    171                 print_error("Ident not found"); 
     170                /* fprintf(stderr, "%s: ", var); */ 
     171                printf_error("Ident '%s' not found", var); 
    172172                return 0; 
    173173            } 
     
    190190        } else { 
    191191            if (cur->sub) { 
    192                 fprintf(stderr, "%s: ", var); 
    193                 print_error("Ident is a Hierarchical Type"); 
     192                printf_error("Ident '%s' is a hierarchical type", var); 
    194193                return 0; 
    195194            } else { 
     
    210209            *(nextdp++) = 0; 
    211210        if (!doppelpunkt[0]) { 
    212             print_error("Ident Replacement is missing an '='"); 
     211            print_error("Ident replacement is missing an '='"); 
    213212            return 0; 
    214213        } 
     
    218217            *(bar++) = 0; 
    219218        } else { 
    220             print_error("Ident Replacement is missing an '='"); 
     219            print_error("Ident replacement is missing an '='"); 
    221220            return 0; 
    222221        } 
  • trunk/NAMES_COM/Makefile

    r5873 r5875  
    1111AISC_SAVE = YES 
    1212 
     13# C++ Compiler 
    1314COMPILER = $(CPP) $(cflags) -I$(ARBHOME)/INCLUDE 
    1415CLIENTCOMPILER = $(COMPILER) 
    1516 
    16 AISC_COMPILER=../AISC/aisc 
     17# AISC dependencies 
     18AISC_COMPILER=../MAKEBIN/aisc 
     19AISC_DEPENDS = $(wildcard AISC/*.pa) $(AISC_COMPILER) 
    1720 
    1821include AISC/export2sub 
    1922 
    20 server.a: $(MAIN_SOURCE) $(PRIVATE_SERVER_OBJECTS:.o=.c) $(PUBLIC_SOURCES) $(AISC_COMPILER) 
     23server.a: $(MAIN_SOURCE) $(PRIVATE_SERVER_OBJECTS:.o=.c) $(PUBLIC_SOURCES) $(AISC_DEPENDS) 
    2124        @$(MAKE) -r -f AISC/Makefile 
    2225 
  • trunk/PROBE_COM/Makefile

    r5873 r5875  
    1111AISC_SAVE := NO 
    1212 
     13# C++ Compiler 
    1314COMPILER := $(CPP) $(cflags) -I$(ARBHOME)/INCLUDE 
    1415CLIENTCOMPILER := $(COMPILER) 
    1516 
    16 AISC_COMPILER=../AISC/aisc 
     17# AISC dependencies 
     18AISC_COMPILER=../MAKEBIN/aisc 
     19AISC_DEPENDS = $(wildcard AISC/*.pa) $(AISC_COMPILER) 
    1720 
    1821include AISC/export2sub 
    1922 
    20 server.a:       $(MAIN_SOURCE)  $(PRIVATE_SERVER_OBJECTS:.o=.c) $(PUBLIC_SOURCES) $(AISC_COMPILER) 
     23server.a:       $(MAIN_SOURCE)  $(PRIVATE_SERVER_OBJECTS:.o=.c) $(PUBLIC_SOURCES) $(AISC_DEPENDS) 
    2124                @$(MAKE) -r -f AISC/Makefile 
    2225