Annotation of sbbs/sbbs3/baja.c, revision 1.1.1.1

1.1       root        1: /* baja.c */
                      2: 
                      3: /* Synchronet command shell/module compiler */
                      4: 
                      5: /* $Id: baja.c,v 1.13 2000/11/14 02:16:57 rswindell Exp $ */
                      6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
                     11:  * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html         *
                     12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
                     38: /* OS-specific */
                     39: #ifndef __unix__
                     40:        #include <io.h>
                     41:        #include <share.h>
                     42: #endif
                     43: #ifdef _WIN32
                     44:        #include <windows.h>
                     45: #endif
                     46: 
                     47: /* ANSI */
                     48: #include <stdio.h>
                     49: #include <string.h>
                     50: #include <ctype.h>
                     51: #include <fcntl.h>
                     52: 
                     53: /* Synchronet-specific */
                     54: #include "cmdshell.h"
                     55: #include "ars_defs.h"
                     56: #include "crc32.h"
                     57: #include "smbwrap.h"   /* portability wrappers */
                     58: 
                     59: #ifdef __BORLANDC__
                     60: unsigned _stklen=20000;        /* Set stack size in code, not header */
                     61: #endif
                     62: 
                     63: char **label_name=NULL
                     64:        ,**goto_file=NULL
                     65:        ,**goto_label=NULL
                     66:        ,**call_file=NULL
                     67:        ,**call_label=NULL;
                     68: 
                     69: ulong *var_name=NULL,vars=0;
                     70: 
                     71: char **define_str=NULL
                     72:        ,**define_val=NULL;
                     73: 
                     74: char *linestr="%s %d: %s\n";
                     75: char tmp[256];
                     76: 
                     77: uint *label_indx=NULL
                     78:        ,*goto_indx=NULL
                     79:        ,*goto_line=NULL
                     80:        ,*call_indx=NULL
                     81:        ,*call_line=NULL;
                     82: 
                     83: uint display=0,line=0,labels=0,gotos=0,calls=0,defines=0,case_sens=0;
                     84: 
                     85: FILE *out=NULL;
                     86: 
                     87: void bail(void)
                     88: {
                     89: if(out)
                     90:        chsize(fileno(out),0);
                     91: }
                     92: 
                     93: /****************************************************************************/
                     94: /* Truncates white-space chars off end of 'str'                                                                */
                     95: /****************************************************************************/
                     96: void truncsp(char *str)
                     97: {
                     98:        int c;
                     99: 
                    100:        c=strlen(str);
                    101:        while(c && str[c-1]<=SP) c--;
                    102:        str[c]=0;
                    103: }
                    104: 
                    105: /****************************************************************************/
                    106: /* Converts an ASCII Hex string into an ulong                                                          */
                    107: /****************************************************************************/
                    108: ulong ahtoul(char *str)
                    109: {
                    110:        ulong l,val=0;
                    111: 
                    112:        while((l=(*str++)|0x20)!=0x20)
                    113:                val=(l&0xf)+(l>>6&1)*9+val*16;
                    114:        return(val);
                    115: }
                    116: 
                    117: /* C Escape char */
                    118: 
                    119: uchar cesc(char ch)
                    120: {
                    121:        switch(ch) {
                    122:                case 'r':
                    123:                        return(CR);
                    124:                case 'n':
                    125:                        return(LF);
                    126:                case 't':
                    127:                        return(TAB);
                    128:                case 'b':
                    129:                        return(BS);
                    130:                case 'a':
                    131:                        return(BEL);
                    132:                case 'f':
                    133:                        return(FF);
                    134:                case 'v':
                    135:                        return(11);
                    136:                default:
                    137:                        return(ch); 
                    138:        }
                    139: }
                    140: 
                    141: long val(char *src, char *p)
                    142: {
                    143:        static int inside;
                    144:        long l;
                    145: 
                    146:        if(isdigit(*p) || *p=='-')      /* Dec, Hex, or Oct */
                    147:                l=strtol(p,&p,0);
                    148:        else if(*p=='\'') {  /* Char */
                    149:                p++;
                    150:                if(*p=='\\') {
                    151:                        p++;
                    152:                        l=cesc(*p); }
                    153:                else
                    154:                        l=*p;
                    155:                p++; }
                    156:        else if(*p=='.')    /* Bit */
                    157:                l=1L<<strtol(p+1,&p,0);
                    158:        else {
                    159:                printf("SYNTAX ERROR (expecting integer constant):\n");
                    160:                printf(linestr,src,line,*p ? p : "<end of line>");
                    161:                exit(1);
                    162:                return(0); }
                    163:        if(inside) {
                    164:                return(l); }
                    165:        inside=1;
                    166:        while(*p)
                    167:                switch(*(p++)) {
                    168:                        case '+':
                    169:                                l+=val(src,p);
                    170:                                break;
                    171:                        case '-':
                    172:                                l-=val(src,p);
                    173:                                break;
                    174:                        case '*':
                    175:                                l*=val(src,p);
                    176:                                break;
                    177:                        case '/':
                    178:                                l/=val(src,p);
                    179:                                break;
                    180:                        case '%':
                    181:                                l%=val(src,p);
                    182:                                break;
                    183:                        case '&':
                    184:                                l&=val(src,p);
                    185:                                break;
                    186:                        case '|':
                    187:                                l|=val(src,p);
                    188:                                break;
                    189:                        case '~':
                    190:                                l&=~val(src,p);
                    191:                                break;
                    192:                        case '^':
                    193:                                l^=val(src,p);
                    194:                                break;
                    195:                        case '>':
                    196:                                if(*p=='>') {
                    197:                                        p++;
                    198:                                        l>>=val(src,p); }
                    199:                                break;
                    200:                        case '<':
                    201:                                if(*p=='<') {
                    202:                                        p++;
                    203:                                        l<<=val(src,p); }
                    204:                                break;
                    205:                        case SP:
                    206:                        case '#':
                    207:                                inside=0;
                    208:                                return(l); }
                    209:        inside=0;
                    210:        return(l);
                    211: }
                    212: 
                    213: 
                    214: void writecstr(uchar *p)
                    215: {
                    216:        char str[1024];
                    217:        int j=0,inquotes=0;
                    218: 
                    219:        while(*p) {
                    220:                if(*p=='"') {   /* ignore quotes */
                    221:                        if(inquotes)
                    222:                                break;
                    223:                        inquotes=1;
                    224:                        p++;
                    225:                        continue; }
                    226:                if(*p=='\\')    { /* escape */
                    227:                        p++;
                    228:                        if(isdigit(*p)) {
                    229:                                str[j]=atoi(p);                 /* decimal, NOT octal */
                    230:                                if(isdigit(*(++p)))     /* skip up to 3 digits */
                    231:                                        if(isdigit(*(++p)))
                    232:                                                p++;
                    233:                                j++;
                    234:                                continue; }
                    235:                        switch(*(p++)) {
                    236:                                case 'x':
                    237:                                        tmp[0]=*(p++);
                    238:                                        tmp[1]=0;
                    239:                                        if(isxdigit(*p)) {      /* if another hex digit, skip too */
                    240:                                                tmp[1]=*(p++);
                    241:                                                tmp[2]=0; }
                    242:                                        str[j]=(char)ahtoul(tmp);
                    243:                                        break;
                    244:                                case 'r':
                    245:                                        str[j]=CR;
                    246:                                        break;
                    247:                                case 'n':
                    248:                                        str[j]=LF;
                    249:                                        break;
                    250:                                case 't':
                    251:                                        str[j]=TAB;
                    252:                                        break;
                    253:                                case 'b':
                    254:                                        str[j]=BS;
                    255:                                        break;
                    256:                                case 'a':
                    257:                                        str[j]=BEL;
                    258:                                        break;
                    259:                                case 'f':
                    260:                                        str[j]=FF;
                    261:                                        break;
                    262:                                case 'v':
                    263:                                        str[j]=11;      /* VT */
                    264:                                        break;
                    265:                                default:
                    266:                                        str[j]=*(p-1);
                    267:                                        break; }
                    268:                        j++;
                    269:                        continue; }
                    270:                str[j++]=*(p++); }
                    271:        str[j]=0;
                    272:        fwrite(str,1,j+1,out);
                    273: }
                    274: 
                    275: void writestr(uchar *p)
                    276: {
                    277:        char str[1024];
                    278:        int j=0;
                    279: 
                    280:        while(*p) {
                    281:                if(*p=='"') {   /* ignore quotes */
                    282:                        p++;
                    283:                        continue; }
                    284:                if(*p=='\\' && *(p+1)=='"' && *(p+2))
                    285:                        p++;
                    286:                str[j++]=*(p++); }
                    287:        str[j]=0;
                    288:        fwrite(str,1,j+1,out);
                    289: }
                    290: 
                    291: /****************************************************************************/
                    292: /* Returns 32-crc of string (not counting terminating NULL)                            */
                    293: /****************************************************************************/
                    294: ulong crc32(char *str)
                    295: {
                    296:        int i=0;
                    297:        ulong crc=0xffffffffUL;
                    298: 
                    299:        while(str[i])
                    300:                crc=ucrc32(str[i++],crc);
                    301:        crc=~crc;
                    302:        return(crc);
                    303: }
                    304: 
                    305: void cvttab(char *str)
                    306: {
                    307:        int i;
                    308: 
                    309:        for(i=0;str[i];i++)
                    310:                if(str[i]==TAB)
                    311:                        str[i]=SP;
                    312: }
                    313: 
                    314: void newvar(uchar *in)
                    315: {
                    316:        uchar name[128];
                    317:        long i,l;
                    318: 
                    319:        sprintf(name,"%.80s",in);
                    320:        if(!case_sens)
                    321:                strupr(name);
                    322:        l=crc32(name);
                    323:        for(i=0;i<vars;i++)
                    324:                if(var_name[i]==l)
                    325:                        break;
                    326:        if(i<vars)
                    327:                return;
                    328:        if((var_name=(ulong *)REALLOC(var_name,sizeof(long)*(vars+1)))==NULL) {
                    329:                printf("Too many (%lu) variables!\n",vars);
                    330:                exit(1); }
                    331:        var_name[vars]=l;
                    332:        if(display)
                    333:                printf("newvar(%08lX)=%s\n",l,in);
                    334:        vars++;
                    335: }
                    336: 
                    337: void writecrc(uchar *src, uchar *in)
                    338: {
                    339:        uchar   name[128];
                    340:        uchar*  p;
                    341:        long    i,l;
                    342: 
                    343:        /* Automatically terminate variable name Oct-09-2000 rswindell */
                    344:        sprintf(name,"%.80s",in);
                    345:        p=strchr(name,SP);
                    346:        if(p) *p=0;
                    347: 
                    348:        if(!case_sens)
                    349:                strupr(name);
                    350:        if(!stricmp(name,"STR") || !name[0])
                    351:                l=0;
                    352:        else {
                    353:                l=crc32(name);
                    354: 
                    355:                for(i=0;i<vars;i++)
                    356:                        if(var_name[i]==l)
                    357:                                break;
                    358:                if(i==vars) {
                    359:                        printf("SYNTAX ERROR (expecting variable name):\n");
                    360:                        printf(linestr,src,line,*in ? (char*)in : "<end of line>");
                    361:                        exit(1); 
                    362:                }
                    363:        }
                    364:        fwrite(&l,4,1,out);
                    365: }
                    366: 
                    367: long isvar(uchar *arg)
                    368: {
                    369:        uchar name[128],*p;
                    370:        long i,l;
                    371: 
                    372:        if(!arg || !(*arg))
                    373:                return(0);
                    374: 
                    375:        sprintf(name,"%.80s",arg);
                    376:        if((p=strchr(name,SP))!=NULL)   // Truncate at first space
                    377:                *p=0;
                    378:        if(!case_sens)
                    379:                strupr(name);
                    380:        l=crc32(name);
                    381: 
                    382:        for(i=0;i<vars;i++)
                    383:                if(var_name[i]==l)
                    384:                        break;
                    385:        if(i==vars)
                    386:                return(0);
                    387:        return(l);
                    388: }
                    389: 
                    390: int str_cmp(char *s1, char *s2)
                    391: {
                    392:        if(case_sens)
                    393:                return(strcmp(s1,s2));
                    394:        return(stricmp(s1,s2));
                    395: }
                    396: 
                    397: void expdefs(uchar *line)
                    398: {
                    399:        uchar str[512],*p,*sp,sav[2]={0};
                    400:        int i;
                    401: 
                    402:        str[0]=0;
                    403:        for(p=line;*p;p++) {
                    404:                if(*p==SP) {
                    405:                        strcat(str," ");
                    406:                        continue; }
                    407: 
                    408:                if(*p=='"') {               /* Skip quoted text */
                    409:                        sp=strchr(p+1,'"');
                    410:                        if(sp) *sp=0;
                    411:                        strcat(str,p);
                    412:                        if(!sp)
                    413:                                break;
                    414:                        strcat(str,"\"");
                    415:                        p+=strlen(p);
                    416:                        continue; }
                    417: 
                    418:                for(sp=p;*sp;sp++)
                    419:                        if(!isalnum(*sp) && *sp!='_')
                    420:                                break;
                    421:                sav[0]=*sp;             /* Save delimiter */
                    422:                sav[1]=0;
                    423:                *sp=0;
                    424:                for(i=0;i<defines;i++)
                    425:                        if(!str_cmp(define_str[i],p))
                    426:                                break;
                    427:                if(i<defines)
                    428:                        strcat(str,define_val[i]);
                    429:                else
                    430:                        strcat(str,p);
                    431:                if(!sav[0])             /* Last argument */
                    432:                        break;
                    433:                p+=strlen(p);
                    434:                strcat(str,sav);        /* Restore delimiter */
                    435:                }
                    436:        strcpy(line,str);
                    437: }
                    438: 
                    439: 
                    440: 
                    441: void compile(char *src)
                    442: {
                    443:        uchar *str,*save,*p,*sp,*tp,*arg,*arg2,*arg3,*ar,ch;
                    444:     ushort i,j;
                    445:        long l,savline;
                    446:        FILE *in;
                    447: 
                    448:        if((in=fopen(src,"rb"))==NULL) {
                    449:                printf("error opening %s for read\n",src);
                    450:                exit(1); }
                    451:        line=0;
                    452: 
                    453:        if((str=malloc(1024))==NULL) {
                    454:                printf("malloc error\n");
                    455:                exit(1);
                    456:        }
                    457: 
                    458:        if((save=malloc(1024))==NULL) {
                    459:                printf("malloc error\n");
                    460:                exit(1);
                    461:        }
                    462: 
                    463:        while(!feof(in) && !ferror(in)) {
                    464:                if(!fgets(str,1000,in))
                    465:                        break;
                    466:                truncsp(str);
                    467:                cvttab(str);
                    468:                line++;
                    469:                strcpy(save,str);
                    470:                p=str;
                    471:                while(*p && *p<=SP)   /* look for beginning of command */
                    472:                        p++;
                    473:                if((*p)==0)
                    474:                        continue;
                    475:                if(*p=='#')             /* remarks start with # */
                    476:                        continue;
                    477:                expdefs(p);                     /* expand defines */
                    478:                if(display)
                    479:                        printf("%s\n",p);
                    480:                sp=strchr(p,SP);
                    481:                arg=arg2=arg3="";
                    482:                if(sp) {
                    483:                        *sp=0;
                    484:                        arg=sp+1;
                    485:                        while(*arg && *arg<=SP) arg++;
                    486:                        sp=strchr(arg,SP);
                    487:                        if(sp) {
                    488:                                arg2=sp+1;
                    489:                                while(*arg2 && *arg2<=SP) arg2++;
                    490:                                sp=strchr(arg2,SP);
                    491:                                if(sp) {
                    492:                                        arg3=sp+1;
                    493:                                        while(*arg3 && *arg3<=SP) arg3++; } } }
                    494: 
                    495:                if(!stricmp(p,"!INCLUDE")) {
                    496:                        savline=line;
                    497:                        sp=strchr(arg,SP);
                    498:                        if(sp) *sp=0;
                    499:                        compile(arg);
                    500:                        line=savline;
                    501:                        continue; }
                    502: 
                    503:                if(!stricmp(p,"!DEFINE")) {                     /* define */
                    504:                        sp=strchr(arg,SP);
                    505:                        if(sp)
                    506:                                *sp=0;
                    507:                        else
                    508:                                break;
                    509:                        tp=strrchr(arg2,'\"');
                    510:                        if(!tp)
                    511:                                tp=arg2;
                    512:                        sp=strchr(tp,'#');
                    513:                        if(sp)
                    514:                                *sp=0;
                    515:                        truncsp(arg2);
                    516:                        if((define_str=(char **)REALLOC(define_str,sizeof(char *)*(defines+1)))
                    517:                                ==NULL) {
                    518:                                printf("Too many defines.\n");
                    519:                                exit(1); }
                    520:                        if((define_str[defines]=(char *)MALLOC(strlen(arg)+1))==NULL) {
                    521:                                printf("Too many defines.\n");
                    522:                                exit(1); }
                    523:                        if((define_val=(char **)REALLOC(define_val,sizeof(char *)*(defines+1)))
                    524:                                ==NULL) {
                    525:                                printf("Too many defines.\n");
                    526:                                exit(1); }
                    527:                        if((define_val[defines]=(char *)MALLOC(strlen(arg2)+1))==NULL) {
                    528:                                printf("Too many defines.\n");
                    529:                                exit(1); }
                    530:                        strcpy(define_str[defines],arg);
                    531:                        strcpy(define_val[defines],arg2);
                    532:                        defines++;
                    533:                        continue; }
                    534: 
                    535:                if(!stricmp(p,"!GLOBAL")) {             /* declare global variables */
                    536:                        if(!(*arg)) break;
                    537:                        for(p=arg;*p && *p!='#';) {
                    538:                                sp=strchr(p,SP);
                    539:                                if(sp) *sp=0;
                    540:                                newvar(p);
                    541:                                if(!sp)
                    542:                                        break;
                    543:                                p=sp+1;
                    544:                                while(*p && *p<=SP)
                    545:                                        p++; }
                    546:                        continue; }
                    547: 
                    548:                if(!stricmp(p,"PATCH")) {
                    549:                        if(!(*arg)) break;
                    550:                        p=arg;
                    551:                        while(*p) {
                    552:                                while(*p && *p<=SP) p++;
                    553:                                tmp[0]=*p++;
                    554:                                tmp[1]=*p++;
                    555:                                tmp[2]=0;
                    556:                                if(!tmp[0])
                    557:                                        break;
                    558:                                ch=ahtoul(tmp);
                    559:                                fputc(ch,out); }
                    560:                        continue; }
                    561: 
                    562:                if(!stricmp(p,"SHOW_VARS")) {
                    563:                        fputc(CS_VAR_INSTRUCTION,out);
                    564:                        fputc(SHOW_VARS,out);
                    565:                        continue; }
                    566: 
                    567:                if(!stricmp(p,"COMPARE_ARS")) {
                    568:                        if(!(*arg)) break;
                    569:                        strupr(arg);
                    570:                        ar=arstr(&i,arg,NULL);
                    571:                        fprintf(out,"%c%c",CS_COMPARE_ARS,(uchar)i);
                    572:                        fwrite(ar,i,1,out);
                    573:                        continue; }
                    574: 
                    575:                if(!stricmp(p,"CHKSYSPASS")) {
                    576:                        fprintf(out,"%c",CS_CHKSYSPASS);
                    577:                        continue; }
                    578:                if(!stricmp(p,"INFO_SYSTEM")) {
                    579:                        fprintf(out,"%c",CS_INFO_SYSTEM);
                    580:                        continue; }
                    581:                if(!stricmp(p,"INFO_SUBBOARD")) {
                    582:                        fprintf(out,"%c",CS_INFO_SUBBOARD);
                    583:                        continue; }
                    584:                if(!stricmp(p,"INFO_DIRECTORY")) {
                    585:                        fprintf(out,"%c",CS_INFO_DIRECTORY);
                    586:                        continue; }
                    587:                if(!stricmp(p,"INFO_VERSION")) {
                    588:                        fprintf(out,"%c",CS_INFO_VERSION);
                    589:                        continue; }
                    590:                if(!stricmp(p,"INFO_USER")) {
                    591:                        fprintf(out,"%c",CS_INFO_USER);
                    592:                        continue; }
                    593:                if(!stricmp(p,"INFO_XFER_POLICY")) {
                    594:                        fprintf(out,"%c",CS_INFO_XFER_POLICY);
                    595:                        continue; }
                    596:                if(!stricmp(p,"LOGKEY")) {
                    597:                        fprintf(out,"%c",CS_LOGKEY);
                    598:                        continue; }
                    599:                if(!stricmp(p,"LOGKEY_COMMA")) {
                    600:                        fprintf(out,"%c",CS_LOGKEY_COMMA);
                    601:                        continue; }
                    602:                if(!stricmp(p,"LOGSTR")) {
                    603:                        fprintf(out,"%c",CS_LOGSTR);
                    604:                        continue; }
                    605: 
                    606:                if(!stricmp(p,"ONLINE")) {
                    607:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_ONLINE);
                    608:                        continue; }
                    609:                if(!stricmp(p,"OFFLINE")) {
                    610:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_OFFLINE);
                    611:                        continue; }
                    612:                if(!stricmp(p,"NEWUSER")) {
                    613:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_NEWUSER);
                    614:                        continue; }
                    615:                if(!stricmp(p,"LOGON")) {
                    616:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_LOGON);
                    617:                        continue; }
                    618:                if(!stricmp(p,"LOGOUT")) {
                    619:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_LOGOUT);
                    620:                        continue; }
                    621:                if(!stricmp(p,"EXIT")) {
                    622:                        fprintf(out,"%c%c",CS_ONE_MORE_BYTE,CS_EXIT);
                    623:                        continue; }
                    624: 
                    625:                if(!stricmp(p,"USER_EVENT")) {
                    626:                        if(!(*arg))
                    627:                                break;
                    628:                        if((l=isvar(arg))!=0) {
                    629:                                fputc(CS_USE_INT_VAR,out);
                    630:                                fwrite(&l,4,1,out); // variable
                    631:                                fputc(2,out);           // int offset
                    632:                                fputc(1,out);       // int length
                    633:                                ch=0; }             // place holder
                    634:                        else
                    635:                                ch=val(src,arg);
                    636:                        fprintf(out,"%c%c",CS_TWO_MORE_BYTES,CS_USER_EVENT);
                    637:                        fwrite(&ch,1,1,out);
                    638:                        continue; }
                    639: 
                    640:                if(!stricmp(p,"PUT_NODE")) {
                    641:                        fprintf(out,"%c",CS_PUT_NODE);
                    642:                        continue; }
                    643:                if(!stricmp(p,"SYNC")) {
                    644:                        fprintf(out,"%c",CS_SYNC);
                    645:                        continue; }
                    646:                if(!stricmp(p,"ASYNC")) {
                    647:                        fprintf(out,"%c",CS_ASYNC);
                    648:                        continue; }
                    649:                if(!stricmp(p,"RIOSYNC")) {
                    650:                        fprintf(out,"%c",CS_RIOSYNC);
                    651:                        continue; }
                    652:                if(!stricmp(p,"GETTIMELEFT")) {
                    653:                        fprintf(out,"%c",CS_GETTIMELEFT);
                    654:                        continue; }
                    655:                if(!stricmp(p,"SAVELINE")) {
                    656:                        fprintf(out,"%c",CS_SAVELINE);
                    657:                        continue; }
                    658:                if(!stricmp(p,"RESTORELINE")) {
                    659:                        fprintf(out,"%c",CS_RESTORELINE);
                    660:                        continue; }
                    661:                if(!stricmp(p,"IF_TRUE") || !stricmp(p,"IF_EQUAL")) {
                    662:                        fprintf(out,"%c",CS_IF_TRUE);
                    663:                        continue; }
                    664:                if(!stricmp(p,"IF_FALSE") || !stricmp(p,"IF_NOT_EQUAL")) {
                    665:                        fprintf(out,"%c",CS_IF_FALSE);
                    666:                        continue; }
                    667:                if(!stricmp(p,"IF_GREATER")) {
                    668:                        fprintf(out,"%c",CS_IF_GREATER);
                    669:                        continue; }
                    670:                if(!stricmp(p,"IF_GREATER_OR_EQUAL")
                    671:                        || !stricmp(p,"IF_EQUAL_OR_GREATER")) {
                    672:                        fprintf(out,"%c",CS_IF_GREATER_OR_EQUAL);
                    673:                        continue; }
                    674:                if(!stricmp(p,"IF_LESS")) {
                    675:                        fprintf(out,"%c",CS_IF_LESS);
                    676:                        continue; }
                    677:                if(!stricmp(p,"IF_LESS_OR_EQUAL")
                    678:                        || !stricmp(p,"IF_EQUAL_OR_LESS")) {
                    679:                        fprintf(out,"%c",CS_IF_LESS_OR_EQUAL);
                    680:                        continue; }
                    681:                if(!stricmp(p,"ENDIF") || !stricmp(p,"END_IF")) {
                    682:                        fprintf(out,"%c",CS_ENDIF);
                    683:                        continue; }
                    684:                if(!stricmp(p,"ELSE")) {
                    685:                        fprintf(out,"%c",CS_ELSE);
                    686:                        continue; }
                    687:                if(p[0]==':') {                     /* :label */
                    688:                        p++;
                    689:                        sp=strchr(p,SP);
                    690:                        if(sp)
                    691:                                *sp=0;
                    692:                        for(i=0;i<labels;i++)
                    693:                                if(!stricmp(label_name[i],p))
                    694:                                        break;
                    695:                        if(i<labels) {
                    696:                                printf("SYNTAX ERROR (duplicate label name):\n");
                    697:                                printf(linestr,src,line,p);
                    698:                                exit(1); }
                    699:                        if((label_name=(char **)REALLOC(label_name,sizeof(char *)*(labels+1)))
                    700:                                ==NULL) {
                    701:                                printf("Too many labels.\n");
                    702:                                exit(1); }
                    703:                        if((label_indx=(uint *)REALLOC(label_indx,sizeof(int)*(labels+1)))
                    704:                                ==NULL) {
                    705:                                printf("Too many labels.\n");
                    706:                                exit(1); }
                    707:                        if((label_name[labels]=(char *)MALLOC(strlen(p)+1))==NULL) {
                    708:                                printf("Too many labels.\n");
                    709:                                exit(1); }
                    710:                        strcpy(label_name[labels],p);
                    711:                        label_indx[labels]=ftell(out);
                    712:                        labels++;
                    713:                        continue; }
                    714:                if(!stricmp(p,"GOTO")) {           /* goto */
                    715:                        if(!(*arg)) break;
                    716:                        sp=strchr(arg,SP);
                    717:                        if(sp)
                    718:                                *sp=0;
                    719:                        if((goto_label=(char **)REALLOC(goto_label,sizeof(char *)*(gotos+1)))
                    720:                                ==NULL) {
                    721:                                printf("Too many gotos.\n");
                    722:                                exit(1); }
                    723:                        if((goto_file=(char **)REALLOC(goto_file,sizeof(char *)*(gotos+1)))
                    724:                                ==NULL) {
                    725:                                printf("Too many gotos.\n");
                    726:                                exit(1); }
                    727:                        if((goto_indx=(uint *)REALLOC(goto_indx,sizeof(int)*(gotos+1)))
                    728:                                ==NULL) {
                    729:                                printf("Too many gotos.\n");
                    730:                                exit(1); }
                    731:                        if((goto_line=(uint *)REALLOC(goto_line,sizeof(int)*(gotos+1)))
                    732:                                ==NULL) {
                    733:                                printf("Too many gotos.\n");
                    734:                                exit(1); }
                    735:                        if((goto_label[gotos]=(char *)MALLOC(strlen(arg)+1))==NULL) {
                    736:                                printf("Too many gotos.\n");
                    737:                                exit(1); }
                    738:                        if((goto_file[gotos]=(char *)MALLOC(strlen(str)+1))==NULL) {
                    739:                                printf("Too many gotos.\n");
                    740:                                exit(1); }
                    741:                        strcpy(goto_label[gotos],arg);
                    742:                        strcpy(goto_file[gotos],str);
                    743:                        goto_indx[gotos]=ftell(out);
                    744:                        goto_line[gotos]=line;
                    745:                        gotos++;
                    746:                        fprintf(out,"%c%c%c",CS_GOTO,0xff,0xff);
                    747:                        continue; }
                    748:                if(!stricmp(p,"CALL")) {          /* call */
                    749:                        if(!(*arg)) break;
                    750:                        sp=strchr(arg,SP);
                    751:                        if(sp)
                    752:                                *sp=0;
                    753:                        if((call_label=(char **)REALLOC(call_label,sizeof(char *)*(calls+1)))
                    754:                                ==NULL) {
                    755:                                printf("Too many calls.\n");
                    756:                                exit(1); }
                    757:                        if((call_file=(char **)REALLOC(call_file,sizeof(char *)*(calls+1)))
                    758:                                ==NULL) {
                    759:                                printf("Too many calls.\n");
                    760:                                exit(1); }
                    761:                        if((call_indx=(uint *)REALLOC(call_indx,sizeof(int)*(calls+1)))
                    762:                                ==NULL) {
                    763:                                printf("Too many calls.\n");
                    764:                                exit(1); }
                    765:                        if((call_line=(uint *)REALLOC(call_line,sizeof(int)*(calls+1)))
                    766:                                ==NULL) {
                    767:                                printf("Too many calls.\n");
                    768:                                exit(1); }
                    769:                        if((call_label[calls]=(char *)MALLOC(strlen(arg)+1))==NULL) {
                    770:                                printf("Too many calls.\n");
                    771:                                exit(1); }
                    772:                        if((call_file[calls]=(char *)MALLOC(strlen(src)+1))==NULL) {
                    773:                                printf("Too many calls.\n");
                    774:                                exit(1); }
                    775: 
                    776:                        strcpy(call_label[calls],arg);
                    777:                        strcpy(call_file[calls],src);
                    778:                        call_indx[calls]=ftell(out);
                    779:                        call_line[calls]=line;
                    780:                        calls++;
                    781:                        fprintf(out,"%c%c%c",CS_CALL,0xff,0xff);
                    782:                        continue; }
                    783: 
                    784:                if(!stricmp(p,"RETURN")) {
                    785:                        fprintf(out,"%c",CS_RETURN);
                    786:                        continue; }
                    787:                if(!stricmp(p,"CMD_HOME")) {
                    788:                        fprintf(out,"%c",CS_CMD_HOME);
                    789:                        continue; }
                    790:                if(!stricmp(p,"CMDKEY")) {
                    791:                        if(!(*arg)) break;
                    792:                        if(!stricmp(arg,"DIGIT"))
                    793:                                ch=CS_DIGIT;
                    794:                        else if(!stricmp(arg,"EDIGIT"))
                    795:                                ch=CS_EDIGIT;
                    796:                        else
                    797:                                ch=toupper(*arg);
                    798:                        if(ch=='/')
                    799:                                ch=*(arg+1)|0x80;   /* high bit indicates slash required */
                    800:                        else if(ch=='^' && *(arg+1)>=0x40)
                    801:                                ch=*(arg+1)-0x40;   /* ctrl char */
                    802:                        else if(ch=='\\')
                    803:                                ch=cesc(*(arg+1));
                    804:                        else if(ch=='\'')
                    805:                                ch=*(arg+1);
                    806:                        fprintf(out,"%c%c",CS_CMDKEY,ch);
                    807:                        continue; }
                    808:                if(!stricmp(p,"CMDCHAR")) {
                    809:                        if(!(*arg)) break;
                    810:                        fprintf(out,"%c%c",CS_CMDKEY,*arg);
                    811:                        continue; }
                    812:                if(!stricmp(p,"SETLOGIC") || !stricmp(p,"SET_LOGIC")) {
                    813:                        if(!(*arg)) break;
                    814:                        if(!stricmp(arg,"TRUE") || !stricmp(arg,"EQUAL"))
                    815:                                ch=LOGIC_TRUE;
                    816:                        else if(!stricmp(arg,"GREATER"))
                    817:                                ch=LOGIC_GREATER;
                    818:                        else if(!stricmp(arg,"LESS"))
                    819:                                ch=LOGIC_LESS;
                    820:                        else
                    821:                                ch=LOGIC_FALSE;
                    822:                        fprintf(out,"%c%c",CS_SETLOGIC,ch);
                    823:                        continue; }
                    824: 
                    825:                if(!stricmp(p,"DEFINE_STR_VAR") || !stricmp(p,"STR")) {
                    826:                        if(!(*arg)) break;
                    827:                        for(p=arg;*p && *p!='#';) {
                    828:                                sp=strchr(p,SP);
                    829:                                if(sp) *sp=0;
                    830:                                fputc(CS_VAR_INSTRUCTION,out);
                    831:                                fputc(DEFINE_STR_VAR,out);
                    832:                                newvar(p);
                    833:                                writecrc(src,p);
                    834:                                if(!sp)
                    835:                                        break;
                    836:                                p=sp+1;
                    837:                                while(*p && *p<=SP)
                    838:                                        p++; }
                    839:                        continue; }
                    840:                if(!stricmp(p,"DEFINE_INT_VAR") || !stricmp(p,"INT")) {
                    841:                        if(!(*arg)) break;
                    842:                        for(p=arg;*p && *p!='#';) {
                    843:                                sp=strchr(p,SP);
                    844:                                if(sp) *sp=0;
                    845:                                fputc(CS_VAR_INSTRUCTION,out);
                    846:                                fputc(DEFINE_INT_VAR,out);
                    847:                                newvar(p);
                    848:                                writecrc(src,p);
                    849:                                if(!sp)
                    850:                                        break;
                    851:                                p=sp+1;
                    852:                                while(*p && *p<=SP)
                    853:                                        p++; }
                    854:                        continue; }
                    855:                if(!stricmp(p,"DEFINE_GLOBAL_STR_VAR") || !stricmp(p,"GLOBAL_STR")) {
                    856:                        if(!(*arg)) break;
                    857:                        for(p=arg;*p && *p!='#';) {
                    858:                                sp=strchr(p,SP);
                    859:                                if(sp) *sp=0;
                    860:                                fputc(CS_VAR_INSTRUCTION,out);
                    861:                                fputc(DEFINE_GLOBAL_STR_VAR,out);
                    862:                                newvar(p);
                    863:                                writecrc(src,p);
                    864:                                if(!sp)
                    865:                                        break;
                    866:                                p=sp+1;
                    867:                                while(*p && *p<=SP)
                    868:                                        p++; }
                    869:                        continue; }
                    870:                if(!stricmp(p,"DEFINE_GLOBAL_INT_VAR") || !stricmp(p,"GLOBAL_INT")) {
                    871:                        if(!(*arg)) break;
                    872:                        for(p=arg;*p && *p!='#';) {
                    873:                                sp=strchr(p,SP);
                    874:                                if(sp) *sp=0;
                    875:                                fputc(CS_VAR_INSTRUCTION,out);
                    876:                                fputc(DEFINE_GLOBAL_INT_VAR,out);
                    877:                                newvar(p);
                    878:                                writecrc(src,p);
                    879:                                if(!sp)
                    880:                                        break;
                    881:                                p=sp+1;
                    882:                                while(*p && *p<=SP)
                    883:                                        p++; }
                    884:                        continue; }
                    885: 
                    886:                if(!stricmp(p,"LOGIN")) {
                    887:                        if(!(*arg)) break;
                    888:                        fputc(CS_STR_FUNCTION,out);
                    889:                        fputc(CS_LOGIN,out);
                    890:                        writecstr(arg);
                    891:                        continue; }
                    892: 
                    893:                if(!stricmp(p,"LOAD_TEXT")) {
                    894:                        if(!(*arg)) break;
                    895:                        fputc(CS_STR_FUNCTION,out);
                    896:                        fputc(CS_LOAD_TEXT,out);
                    897:                        writestr(arg);
                    898:                        continue; }
                    899: 
                    900:                if(!stricmp(p,"SET_STR_VAR")
                    901:                        || (!stricmp(p,"SET") && strchr(arg,'"'))) {
                    902:                        if(!(*arg)) break;
                    903:                        fputc(CS_VAR_INSTRUCTION,out);
                    904:                        fputc(SET_STR_VAR,out);
                    905:                        p=strchr(arg,SP);
                    906:                        if(!p)
                    907:                                break;
                    908:                        *p=0;
                    909:                        writecrc(src,arg);
                    910:                        writecstr(arg2);
                    911:                        continue; }
                    912:                if(!stricmp(p,"CAT_STR_VAR")
                    913:                        || (!stricmp(p,"STRCAT") && strchr(arg,'"'))) {
                    914:                        fputc(CS_VAR_INSTRUCTION,out);
                    915:                        fputc(CAT_STR_VAR,out);
                    916:                        p=strchr(arg,SP);
                    917:                        if(!p)
                    918:                                break;
                    919:                        *p=0;
                    920:                        writecrc(src,arg);
                    921:                        writecstr(arg2);
                    922:                        continue; }
                    923:                if((!stricmp(p,"STRSTR") || !stricmp(p,"COMPARE_SUBSTR"))
                    924:                        && strchr(arg,'"')) {
                    925:                        fputc(CS_VAR_INSTRUCTION,out);
                    926:                        fputc(STRSTR_VAR,out);
                    927:                        p=strchr(arg,SP);
                    928:                        if(!p)
                    929:                                break;
                    930:                        *p=0;
                    931:                        writecrc(src,arg);
                    932:                        writecstr(arg2);
                    933:                        continue; }
                    934:                if(!stricmp(p,"STRSTR") || !stricmp(p,"COMPARE_SUBSTR")) {
                    935:                        if(!(*arg)) break;
                    936:                        fputc(CS_VAR_INSTRUCTION,out);
                    937:                        fputc(STRSTR_VARS,out);
                    938:                        p=strchr(arg,SP);
                    939:                        if(!p)
                    940:                                break;
                    941:                        *p=0;
                    942:                        writecrc(src,arg);
                    943:                        writecrc(src,arg2);
                    944:                        continue; }
                    945:                if(!stricmp(p,"COPY_FIRST_CHAR")) {
                    946:                        fputc(CS_VAR_INSTRUCTION,out);
                    947:                        fputc(COPY_FIRST_CHAR,out);
                    948:                        writecrc(src,arg);
                    949:                        writecrc(src,arg2);
                    950:                        continue; }
                    951:                if(!stricmp(p,"COMPARE_FIRST_CHAR")) {
                    952:                        fputc(CS_VAR_INSTRUCTION,out);
                    953:                        fputc(COMPARE_FIRST_CHAR,out);
                    954:                        writecrc(src,arg);
                    955:                        fputc((uchar)val(src,arg2),out);
                    956:                        continue; }
                    957:                if(!stricmp(p,"CAT_STR_VARS") || !stricmp(p,"STRCAT")) {
                    958:                        if(!(*arg)) break;
                    959:                        fputc(CS_VAR_INSTRUCTION,out);
                    960:                        fputc(CAT_STR_VARS,out);
                    961:                        p=strchr(arg,SP);
                    962:                        if(!p)
                    963:                                break;
                    964:                        *p=0;
                    965:                        writecrc(src,arg);
                    966:                        writecrc(src,arg2);
                    967:                        continue; }
                    968:                if(!stricmp(p,"FORMAT") || !stricmp(p,"SPRINTF")) {
                    969:                        if(!(*arg)) break;
                    970:                        fputc(CS_VAR_INSTRUCTION,out);
                    971:                        fputc(FORMAT_STR_VAR,out);
                    972:                        p=strchr(arg,SP);
                    973:                        if(!p)
                    974:                                break;
                    975:                        *p=0;
                    976:                        writecrc(src,arg);                                      /* Write destination variable */
                    977:                        p++;
                    978:                        while(*p && *p<=SP) p++;
                    979:                        arg=p;
                    980:                        p=strrchr(arg,'"');
                    981:                        if(!p)
                    982:                                break;
                    983:                        *p=0;
                    984:                        p++;
                    985:                        while(*p && *p<=SP) p++;
                    986:                        writecstr(arg);                 /* Write string */
                    987:                        l=ftell(out);
                    988:                        fputc(0,out);                   /* Write total number of args */
                    989:                        i=0;
                    990:                        while(p && *p) {
                    991:                                arg=p;
                    992:                                p=strchr(arg,SP);
                    993:                                if(p) {
                    994:                                        *p=0;
                    995:                                        p++; }
                    996:                                writecrc(src,arg);
                    997:                                i++; }
                    998:                        fseek(out,l,SEEK_SET);
                    999:                        fputc((char)i,out);
                   1000:                        fseek(out,i*4,SEEK_CUR);
                   1001:                        continue; }
                   1002: 
                   1003:                if(!stricmp(p,"STRFTIME") || !stricmp(p,"FTIME_STR")) {
                   1004:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   1005:                        fputc(CS_VAR_INSTRUCTION,out);
                   1006:                        fputc(FORMAT_TIME_STR,out);
                   1007:                        p=strchr(arg,SP);
                   1008:                        if(!p)
                   1009:                                break;
                   1010:                        *p=0;
                   1011:                        writecrc(src,arg);                                      /* Write destination variable */
                   1012:                        p++;
                   1013:                        while(*p && *p<=SP) p++;
                   1014:                        arg=p;
                   1015:                        p=strrchr(arg,'"');
                   1016:                        if(!p)
                   1017:                                break;
                   1018:                        *p=0;
                   1019:                        writecstr(arg);                 /* Write string */
                   1020:                        p++;
                   1021:                        while(*p && *p<=SP) p++;
                   1022:                        writecrc(src,p);
                   1023:                        continue; }
                   1024: 
                   1025:                if(!stricmp(p,"TIME_STR")) {
                   1026:                        if(!(*arg)) break;
                   1027:                        fputc(CS_VAR_INSTRUCTION,out);
                   1028:                        fputc(TIME_STR,out);
                   1029:                        p=strchr(arg,SP);
                   1030:                        if(!p)
                   1031:                                break;
                   1032:                        *p=0;
                   1033:                        writecrc(src,arg);
                   1034:                        writecrc(src,arg2);
                   1035:                        continue; }
                   1036: 
                   1037:                if(!stricmp(p,"DATE_STR")) {
                   1038:                        if(!(*arg)) break;
                   1039:                        fputc(CS_VAR_INSTRUCTION,out);
                   1040:                        fputc(DATE_STR,out);
                   1041:                        p=strchr(arg,SP);
                   1042:                        if(!p)
                   1043:                                break;
                   1044:                        *p=0;
                   1045:                        writecrc(src,arg);
                   1046:                        writecrc(src,arg2);
                   1047:                        continue; }
                   1048: 
                   1049:                if(!stricmp(p,"SECOND_STR")) {
                   1050:                        if(!(*arg)) break;
                   1051:                        fputc(CS_VAR_INSTRUCTION,out);
                   1052:                        fputc(SECOND_STR,out);
                   1053:                        p=strchr(arg,SP);
                   1054:                        if(!p)
                   1055:                                break;
                   1056:                        *p=0;
                   1057:                        writecrc(src,arg);
                   1058:                        writecrc(src,arg2);
                   1059:                        continue; }
                   1060: 
                   1061: 
                   1062:                if(!stricmp(p,"SET_INT_VAR")
                   1063:                        || (!stricmp(p,"SET") && *arg2!='"')) {
                   1064:                        if(!(*arg)) break;
                   1065:                        fputc(CS_VAR_INSTRUCTION,out);
                   1066:                        fputc(SET_INT_VAR,out);
                   1067:                        p=strchr(arg,SP);
                   1068:                        if(!p)
                   1069:                                break;
                   1070:                        *p=0;
                   1071:                        writecrc(src,arg);
                   1072:                        l=val(src,arg2);
                   1073:                        fwrite(&l,4,1,out);
                   1074:                        continue; }
                   1075: 
                   1076:                if(!stricmp(p,"COMPARE_STR_VAR") ||
                   1077:                        (!stricmp(p,"COMPARE") && *arg2=='"')) {
                   1078:                        if(!(*arg)) break;
                   1079:                        fputc(CS_VAR_INSTRUCTION,out);
                   1080:                        fputc(COMPARE_STR_VAR,out);
                   1081:                        p=strchr(arg,SP);
                   1082:                        if(!p)
                   1083:                                break;
                   1084:                        *p=0;
                   1085:                        writecrc(src,arg);
                   1086:                        writecstr(arg2);
                   1087:                        continue; }
                   1088: 
                   1089:                if(!stricmp(p,"COMPARE_STRN_VAR") ||
                   1090:                        ((!stricmp(p,"STRNCMP") || !stricmp(p,"COMPARE_STRN"))
                   1091:                                && *arg3 && strchr(arg3,'"'))) {
                   1092:                        if((l=isvar(arg))!=0) {
                   1093:                                fputc(CS_USE_INT_VAR,out);
                   1094:                                fwrite(&l,4,1,out); // variable
                   1095:                                fputc(2,out);           // int offset
                   1096:                                fputc(1,out);           // int length
                   1097:                                i=0; }                          // place holder
                   1098:                        else
                   1099:                                i=val(src,arg);
                   1100:                        fputc(CS_VAR_INSTRUCTION,out);
                   1101:                        fputc(STRNCMP_VAR,out);
                   1102:                        fwrite(&i,1,1,out); /* Length */
                   1103:                        p=strchr(arg2,SP);
                   1104:                        if(!p)
                   1105:                                break;
                   1106:                        *p=0;
                   1107:                        p++;
                   1108:                        while(*p && *p<=SP) p++;
                   1109:                        writecrc(src,arg2);
                   1110:                        writecstr(p);
                   1111:                        continue; }
                   1112: 
                   1113:                if(!stricmp(p,"COMPARE_STRN_VARS") || !stricmp(p,"STRNCMP")
                   1114:                        || !stricmp(p,"COMPARE_STRN")) {
                   1115:                        if(!(*arg) || !(*arg2) || !(*arg3))
                   1116:                                break;
                   1117:                        if((l=isvar(arg))!=0) {
                   1118:                                fputc(CS_USE_INT_VAR,out);
                   1119:                                fwrite(&l,4,1,out); // variable
                   1120:                                fputc(2,out);           // int offset
                   1121:                                fputc(1,out);           // int length
                   1122:                                i=0; }                          // place holder
                   1123:                        else
                   1124:                                i=val(src,arg);
                   1125:                        fputc(CS_VAR_INSTRUCTION,out);
                   1126:                        fputc(STRNCMP_VARS,out);
                   1127: 
                   1128:                        fwrite(&i,1,1,out); /* Length */
                   1129:                        p=strchr(arg2,SP);
                   1130:                        if(!p)
                   1131:                                break;
                   1132:                        *p=0;
                   1133:                        p++;
                   1134:                        while(*p && *p<=SP) p++;
                   1135:                        writecrc(src,arg2);
                   1136:                        writecrc(src,p);
                   1137:                        continue; }
                   1138: 
                   1139:                if(!stricmp(p,"COMPARE_INT_VAR") ||
                   1140:                        (!stricmp(p,"COMPARE")
                   1141:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1142:                        if(!(*arg)) break;
                   1143: 
                   1144:                        fputc(CS_VAR_INSTRUCTION,out);
                   1145:                        fputc(COMPARE_INT_VAR,out);
                   1146:                        p=strchr(arg,SP);
                   1147:                        if(!p)
                   1148:                                break;
                   1149:                        *p=0;
                   1150:                        writecrc(src,arg);
                   1151:                        l=val(src,arg2);
                   1152:                        fwrite(&l,4,1,out);
                   1153:                        continue; }
                   1154: 
                   1155:                if(!stricmp(p,"COMPARE")) {
                   1156:                        if(!(*arg)) break;
                   1157:                        fputc(CS_VAR_INSTRUCTION,out);
                   1158:                        fputc(COMPARE_VARS,out);
                   1159:                        p=strchr(arg,SP);
                   1160:                        if(!p)
                   1161:                                break;
                   1162:                        *p=0;
                   1163:                        writecrc(src,arg);
                   1164:                        writecrc(src,arg2);
                   1165:                        continue; }
                   1166:                if(!stricmp(p,"COPY")) {
                   1167:                        if(!(*arg)) break;
                   1168:                        fputc(CS_VAR_INSTRUCTION,out);
                   1169:                        fputc(COPY_VAR,out);
                   1170:                        p=strchr(arg,SP);
                   1171:                        if(!p)
                   1172:                                break;
                   1173:                        *p=0;
                   1174:                        writecrc(src,arg);
                   1175:                        writecrc(src,arg2);
                   1176:                        continue; }
                   1177:                if(!stricmp(p,"SWAP")) {
                   1178:                        if(!(*arg)) break;
                   1179:                        fputc(CS_VAR_INSTRUCTION,out);
                   1180:                        fputc(SWAP_VARS,out);
                   1181:                        p=strchr(arg,SP);
                   1182:                        if(!p)
                   1183:                                break;
                   1184:                        *p=0;
                   1185:                        writecrc(src,arg);
                   1186:                        writecrc(src,arg2);
                   1187:                        continue; }
                   1188: 
                   1189:                if(!stricmp(p,"TIME")) {
                   1190:                        if(!(*arg)) break;
                   1191:                        fputc(CS_VAR_INSTRUCTION,out);
                   1192:                        fputc(TIME_INT_VAR,out);
                   1193:                        writecrc(src,arg);
                   1194:                        continue; }
                   1195: 
                   1196:                if(!stricmp(p,"DATE_INT")) {
                   1197:                        if(!(*arg)) break;
                   1198:                        fputc(CS_VAR_INSTRUCTION,out);
                   1199:                        fputc(DATE_STR_TO_INT,out);
                   1200:                        p=strchr(arg,SP);
                   1201:                        if(!p)
                   1202:                                break;
                   1203:                        *p=0;
                   1204:                        writecrc(src,arg);
                   1205:                        writecrc(src,arg2);
                   1206:                        continue; }
                   1207: 
                   1208:                if(!stricmp(p,"CRC16")) {
                   1209:                        if(!(*arg)) break;
                   1210:                        fputc(CS_VAR_INSTRUCTION,out);
                   1211:                        fputc(CRC16_TO_INT,out);
                   1212:                        p=strchr(arg,SP);
                   1213:                        if(!p)
                   1214:                                break;
                   1215:                        *p=0;
                   1216:                        writecrc(src,arg);
                   1217:                        writecrc(src,arg2);
                   1218:                        continue; }
                   1219: 
                   1220:                if(!stricmp(p,"CRC32")) {
                   1221:                        if(!(*arg)) break;
                   1222:                        fputc(CS_VAR_INSTRUCTION,out);
                   1223:                        fputc(CRC32_TO_INT,out);
                   1224:                        p=strchr(arg,SP);
                   1225:                        if(!p)
                   1226:                                break;
                   1227:                        *p=0;
                   1228:                        writecrc(src,arg);
                   1229:                        writecrc(src,arg2);
                   1230:                        continue; }
                   1231: 
                   1232:                if(!stricmp(p,"CHKSUM")) {
                   1233:                        if(!(*arg)) break;
                   1234:                        fputc(CS_VAR_INSTRUCTION,out);
                   1235:                        fputc(CHKSUM_TO_INT,out);
                   1236:                        p=strchr(arg,SP);
                   1237:                        if(!p)
                   1238:                                break;
                   1239:                        *p=0;
                   1240:                        writecrc(src,arg);
                   1241:                        writecrc(src,arg2);
                   1242:                        continue; }
                   1243: 
                   1244:                if(!stricmp(p,"ADD_INT_VAR")
                   1245:                        || (!stricmp(p,"ADD")
                   1246:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1247:                        if(!(*arg)) break;
                   1248:                        fputc(CS_VAR_INSTRUCTION,out);
                   1249:                        fputc(ADD_INT_VAR,out);
                   1250:                        p=strchr(arg,SP);
                   1251:                        if(!p)
                   1252:                                break;
                   1253:                        *p=0;
                   1254:                        writecrc(src,arg);
                   1255:                        l=val(src,arg2);
                   1256:                        if(!l)
                   1257:                                break;
                   1258:                        fwrite(&l,4,1,out);
                   1259:                        continue; }
                   1260:                if(!stricmp(p,"ADD_INT_VARS") || !stricmp(p,"ADD")) {
                   1261:                        if(!(*arg)) break;
                   1262:                        fputc(CS_VAR_INSTRUCTION,out);
                   1263:                        fputc(ADD_INT_VARS,out);
                   1264:                        p=strchr(arg,SP);
                   1265:                        if(!p)
                   1266:                                break;
                   1267:                        *p=0;
                   1268:                        writecrc(src,arg);
                   1269:                        writecrc(src,arg2);
                   1270:                        continue; }
                   1271: 
                   1272:                if(!stricmp(p,"SUB_INT_VAR")
                   1273:                        || (!stricmp(p,"SUB")
                   1274:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1275:                        if(!(*arg)) break;
                   1276:                        fputc(CS_VAR_INSTRUCTION,out);
                   1277:                        fputc(SUB_INT_VAR,out);
                   1278:                        p=strchr(arg,SP);
                   1279:                        if(!p)
                   1280:                                break;
                   1281:                        *p=0;
                   1282:                        writecrc(src,arg);
                   1283:                        l=val(src,arg2);
                   1284:                        if(!l)
                   1285:                                break;
                   1286:                        fwrite(&l,4,1,out);
                   1287:                        continue; }
                   1288:                if(!stricmp(p,"SUB_INT_VARS") || !stricmp(p,"SUB")) {
                   1289:                        if(!(*arg)) break;
                   1290:                        fputc(CS_VAR_INSTRUCTION,out);
                   1291:                        fputc(SUB_INT_VARS,out);
                   1292:                        p=strchr(arg,SP);
                   1293:                        if(!p)
                   1294:                                break;
                   1295:                        *p=0;
                   1296:                        writecrc(src,arg);
                   1297:                        writecrc(src,arg2);
                   1298:                        continue; }
                   1299: 
                   1300:                if(!stricmp(p,"MUL_INT_VAR")
                   1301:                        || (!stricmp(p,"MUL")
                   1302:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1303:                        if(!(*arg)) break;
                   1304:                        fputc(CS_VAR_INSTRUCTION,out);
                   1305:                        fputc(MUL_INT_VAR,out);
                   1306:                        p=strchr(arg,SP);
                   1307:                        if(!p)
                   1308:                                break;
                   1309:                        *p=0;
                   1310:                        writecrc(src,arg);
                   1311:                        l=val(src,arg2);
                   1312:                        if(!l)
                   1313:                                break;
                   1314:                        fwrite(&l,4,1,out);
                   1315:                        continue; }
                   1316:                if(!stricmp(p,"MUL_INT_VARS") || !stricmp(p,"MUL")) {
                   1317:                        if(!(*arg)) break;
                   1318:                        fputc(CS_VAR_INSTRUCTION,out);
                   1319:                        fputc(MUL_INT_VARS,out);
                   1320:                        p=strchr(arg,SP);
                   1321:                        if(!p)
                   1322:                                break;
                   1323:                        *p=0;
                   1324:                        writecrc(src,arg);
                   1325:                        writecrc(src,arg2);
                   1326:                        continue; }
                   1327: 
                   1328:                if(!stricmp(p,"DIV_INT_VAR")
                   1329:                        || (!stricmp(p,"DIV")
                   1330:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1331:                        if(!(*arg)) break;
                   1332:                        fputc(CS_VAR_INSTRUCTION,out);
                   1333:                        fputc(DIV_INT_VAR,out);
                   1334:                        p=strchr(arg,SP);
                   1335:                        if(!p)
                   1336:                                break;
                   1337:                        *p=0;
                   1338:                        writecrc(src,arg);
                   1339:                        l=val(src,arg2);
                   1340:                        if(!l)
                   1341:                                break;
                   1342:                        fwrite(&l,4,1,out);
                   1343:                        continue; }
                   1344:                if(!stricmp(p,"DIV_INT_VARS") || !stricmp(p,"DIV")) {
                   1345:                        if(!(*arg)) break;
                   1346:                        fputc(CS_VAR_INSTRUCTION,out);
                   1347:                        fputc(DIV_INT_VARS,out);
                   1348:                        p=strchr(arg,SP);
                   1349:                        if(!p)
                   1350:                                break;
                   1351:                        *p=0;
                   1352:                        writecrc(src,arg);
                   1353:                        writecrc(src,arg2);
                   1354:                        continue; }
                   1355: 
                   1356:                if(!stricmp(p,"MOD_INT_VAR")
                   1357:                        || (!stricmp(p,"MOD")
                   1358:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1359:                        if(!(*arg)) break;
                   1360:                        fputc(CS_VAR_INSTRUCTION,out);
                   1361:                        fputc(MOD_INT_VAR,out);
                   1362:                        p=strchr(arg,SP);
                   1363:                        if(!p)
                   1364:                                break;
                   1365:                        *p=0;
                   1366:                        writecrc(src,arg);
                   1367:                        l=val(src,arg2);
                   1368:                        if(!l)
                   1369:                                break;
                   1370:                        fwrite(&l,4,1,out);
                   1371:                        continue; }
                   1372:                if(!stricmp(p,"MOD_INT_VARS") || !stricmp(p,"MOD")) {
                   1373:                        if(!(*arg)) break;
                   1374:                        fputc(CS_VAR_INSTRUCTION,out);
                   1375:                        fputc(MOD_INT_VARS,out);
                   1376:                        p=strchr(arg,SP);
                   1377:                        if(!p)
                   1378:                                break;
                   1379:                        *p=0;
                   1380:                        writecrc(src,arg);
                   1381:                        writecrc(src,arg2);
                   1382:                        continue; }
                   1383: 
                   1384:                if(!stricmp(p,"AND_INT_VAR")
                   1385:                        || (!stricmp(p,"AND")
                   1386:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1387:                        if(!(*arg)) break;
                   1388:                        fputc(CS_VAR_INSTRUCTION,out);
                   1389:                        fputc(AND_INT_VAR,out);
                   1390:                        p=strchr(arg,SP);
                   1391:                        if(!p)
                   1392:                                break;
                   1393:                        *p=0;
                   1394:                        writecrc(src,arg);
                   1395:                        l=val(src,arg2);
                   1396:                        fwrite(&l,4,1,out);
                   1397:                        continue; }
                   1398:                if(!stricmp(p,"AND_INT_VARS") || !stricmp(p,"AND")) {
                   1399:                        if(!(*arg)) break;
                   1400:                        fputc(CS_VAR_INSTRUCTION,out);
                   1401:                        fputc(AND_INT_VARS,out);
                   1402:                        p=strchr(arg,SP);
                   1403:                        if(!p)
                   1404:                                break;
                   1405:                        *p=0;
                   1406:                        writecrc(src,arg);
                   1407:                        writecrc(src,arg2);
                   1408:                        continue; }
                   1409: 
                   1410:                if(!stricmp(p,"OR_INT_VAR")
                   1411:                        || (!stricmp(p,"OR")
                   1412:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1413:                        if(!(*arg)) break;
                   1414:                        fputc(CS_VAR_INSTRUCTION,out);
                   1415:                        fputc(OR_INT_VAR,out);
                   1416:                        p=strchr(arg,SP);
                   1417:                        if(!p)
                   1418:                                break;
                   1419:                        *p=0;
                   1420:                        writecrc(src,arg);
                   1421:                        l=val(src,arg2);
                   1422:                        fwrite(&l,4,1,out);
                   1423:                        continue; }
                   1424:                if(!stricmp(p,"OR_INT_VARS") || !stricmp(p,"OR")) {
                   1425:                        if(!(*arg)) break;
                   1426:                        fputc(CS_VAR_INSTRUCTION,out);
                   1427:                        fputc(OR_INT_VARS,out);
                   1428:                        p=strchr(arg,SP);
                   1429:                        if(!p)
                   1430:                                break;
                   1431:                        *p=0;
                   1432:                        writecrc(src,arg);
                   1433:                        writecrc(src,arg2);
                   1434:                        continue; }
                   1435: 
                   1436:                if(!stricmp(p,"NOT_INT_VAR")
                   1437:                        || (!stricmp(p,"NOT")
                   1438:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1439:                        if(!(*arg)) break;
                   1440:                        fputc(CS_VAR_INSTRUCTION,out);
                   1441:                        fputc(NOT_INT_VAR,out);
                   1442:                        p=strchr(arg,SP);
                   1443:                        if(!p)
                   1444:                                break;
                   1445:                        *p=0;
                   1446:                        writecrc(src,arg);
                   1447:                        l=val(src,arg2);
                   1448:                        fwrite(&l,4,1,out);
                   1449:                        continue; }
                   1450:                if(!stricmp(p,"NOT_INT_VARS") || !stricmp(p,"NOT")) {
                   1451:                        if(!(*arg)) break;
                   1452:                        fputc(CS_VAR_INSTRUCTION,out);
                   1453:                        fputc(NOT_INT_VARS,out);
                   1454:                        p=strchr(arg,SP);
                   1455:                        if(!p)
                   1456:                                break;
                   1457:                        *p=0;
                   1458:                        writecrc(src,arg);
                   1459:                        writecrc(src,arg2);
                   1460:                        continue; }
                   1461: 
                   1462:                if(!stricmp(p,"XOR_INT_VAR")
                   1463:                        || (!stricmp(p,"XOR")
                   1464:                                && (isdigit(*arg2) || atol(arg2) || *arg2=='\'' || *arg2=='.'))) {
                   1465:                        if(!(*arg)) break;
                   1466:                        fputc(CS_VAR_INSTRUCTION,out);
                   1467:                        fputc(XOR_INT_VAR,out);
                   1468:                        p=strchr(arg,SP);
                   1469:                        if(!p)
                   1470:                                break;
                   1471:                        *p=0;
                   1472:                        writecrc(src,arg);
                   1473:                        l=val(src,arg2);
                   1474:                        fwrite(&l,4,1,out);
                   1475:                        continue; }
                   1476:                if(!stricmp(p,"XOR_INT_VARS") || !stricmp(p,"XOR")) {
                   1477:                        if(!(*arg)) break;
                   1478:                        fputc(CS_VAR_INSTRUCTION,out);
                   1479:                        fputc(XOR_INT_VARS,out);
                   1480:                        p=strchr(arg,SP);
                   1481:                        if(!p)
                   1482:                                break;
                   1483:                        *p=0;
                   1484:                        writecrc(src,arg);
                   1485:                        writecrc(src,arg2);
                   1486:                        continue; }
                   1487: 
                   1488:                if(!stricmp(p,"RANDOM_INT_VAR") || !stricmp(p,"RANDOM")) {
                   1489:                        if(!(*arg)) break;
                   1490:                        if((l=isvar(arg2))!=0) {
                   1491:                                fputc(CS_USE_INT_VAR,out);
                   1492:                                fwrite(&l,4,1,out); // variable
                   1493:                                fputc(6,out);           // int offset
                   1494:                                fputc(4,out);           // int length
                   1495:                                l=0; }                          // place holder
                   1496:                        else
                   1497:                                l=val(src,arg2);
                   1498:                        fputc(CS_VAR_INSTRUCTION,out);
                   1499:                        fputc(RANDOM_INT_VAR,out);
                   1500:                        p=strchr(arg,SP);
                   1501:                        if(!p)
                   1502:                                break;
                   1503:                        *p=0;
                   1504:                        writecrc(src,arg);
                   1505:                        fwrite(&l,4,1,out);
                   1506:                        continue; }
                   1507: 
                   1508:                if(!stricmp(p,"SWITCH")) {
                   1509:                        if(!(*arg)) break;
                   1510:                        fputc(CS_SWITCH,out);
                   1511:                        writecrc(src,arg);
                   1512:                        continue; }
                   1513:                if(!stricmp(p,"END_SWITCH")) {
                   1514:                        fputc(CS_END_SWITCH,out);
                   1515:                        continue; }
                   1516:                if(!stricmp(p,"CASE")) {
                   1517:                        if(!(*arg)) break;
                   1518:                        fputc(CS_CASE,out);
                   1519:                        l=val(src,arg);
                   1520:                        fwrite(&l,4,1,out);
                   1521:                        continue; }
                   1522:                if(!stricmp(p,"DEFAULT")) {
                   1523:                        fputc(CS_DEFAULT,out);
                   1524:                        continue; }
                   1525:                if(!stricmp(p,"END_CASE")) {
                   1526:                        fputc(CS_END_CASE,out);
                   1527:                        continue; }
                   1528: 
                   1529:                if(!stricmp(p,"PRINT") && !strchr(arg,'"') && !strchr(arg,'\\')
                   1530:                        && !strchr(arg,SP)) {
                   1531:                        if(!(*arg)) break;
                   1532:                        fputc(CS_VAR_INSTRUCTION,out);
                   1533:                        fputc(PRINT_VAR,out);
                   1534:                        writecrc(src,arg);
                   1535:                        continue; }
                   1536: 
                   1537:                if(!stricmp(p,"PRINTF")) {
                   1538:                        if(!(*arg)) break;
                   1539:                        fputc(CS_VAR_INSTRUCTION,out);
                   1540:                        fputc(VAR_PRINTF,out);
                   1541:                        p=strrchr(arg,'"');
                   1542:                        if(!p)
                   1543:                                break;
                   1544:                        *p=0;
                   1545:                        p++;
                   1546:                        while(*p && *p<=SP) p++;
                   1547:                        writecstr(arg);                 /* Write string */
                   1548:                        l=ftell(out);
                   1549:                        fputc(0,out);                   /* Write total number of args */
                   1550:                        i=0;
                   1551:                        while(p && *p) {
                   1552:                                arg=p;
                   1553:                                p=strchr(arg,SP);
                   1554:                                if(p) {
                   1555:                                        *p=0;
                   1556:                                        p++; }
                   1557:                                writecrc(src,arg);
                   1558:                                i++; }
                   1559:                        fseek(out,l,SEEK_SET);
                   1560:                        fputc((char)i,out);
                   1561:                        fseek(out,i*4,SEEK_CUR);
                   1562:                        continue; }
                   1563: 
                   1564:                if(!stricmp(p,"FOPEN")) {
                   1565:                        if(!(*arg) || !(*arg2) || !(*arg3)) break;
                   1566:                        if((l=isvar(arg2))!=0) {
                   1567:                                fputc(CS_USE_INT_VAR,out);
                   1568:                                fwrite(&l,4,1,out); // variable
                   1569:                                fputc(6,out);           // int offset
                   1570:                                fputc(2,out);           // int length
                   1571:                                i=0; }                          // place holder
                   1572:                        else
                   1573:                                i=val(src,arg2);
                   1574: 
                   1575:                        fputc(CS_FIO_FUNCTION,out);
                   1576:                        if(*arg3=='"')
                   1577:                                fputc(FIO_OPEN,out);
                   1578:                        else
                   1579:                                fputc(FIO_OPEN_VAR,out);
                   1580:                        p=strchr(arg,SP);
                   1581:                        if(!p)
                   1582:                                break;
                   1583:                        *p=0;
                   1584:                        writecrc(src,arg);
                   1585:                        p=strchr(arg2,SP);
                   1586:                        if(!p)
                   1587:                                break;
                   1588:                        *p=0;
                   1589:                        p++;
                   1590:                        fwrite(&i,2,1,out);
                   1591:                        while(*p && *p<=SP) p++;
                   1592:                        if(*p=='"')
                   1593:                                writestr(p);
                   1594:                        else
                   1595:                                writecrc(src,p);
                   1596:                        continue; }
                   1597:                if(!stricmp(p,"FCLOSE")) {
                   1598:                        if(!(*arg)) break;
                   1599:                        fputc(CS_FIO_FUNCTION,out);
                   1600:                        fputc(FIO_CLOSE,out);
                   1601:                        writecrc(src,arg);
                   1602:                        continue; }
                   1603:                if(!stricmp(p,"FFLUSH")) {
                   1604:                        if(!(*arg)) break;
                   1605:                        fputc(CS_FIO_FUNCTION,out);
                   1606:                        fputc(FIO_FLUSH,out);
                   1607:                        writecrc(src,arg);
                   1608:                        continue; }
                   1609:                if(!stricmp(p,"FREAD")) {
                   1610:                        if(!(*arg)) break;
                   1611: 
                   1612:                        fputc(CS_FIO_FUNCTION,out);
                   1613:                        if(!(*arg3) || isdigit(*arg3) || atoi(arg3))
                   1614:                                fputc(FIO_READ,out);
                   1615:                        else
                   1616:                                fputc(FIO_READ_VAR,out);
                   1617:                        p=strchr(arg,SP);
                   1618:                        if(!p)
                   1619:                                break;
                   1620:                        *p=0;
                   1621:                        writecrc(src,arg);                      /* File handle */
                   1622:                        p=strchr(arg2,SP);
                   1623:                        if(p)
                   1624:                                *p=0;
                   1625:                        writecrc(src,arg2);             /* Variable */
                   1626:                        if(isdigit(*arg3))
                   1627:                                i=val(src,arg3);         /* Length */
                   1628:                        else
                   1629:                                i=0;
                   1630:                        if(i || !(*arg3))
                   1631:                                fwrite(&i,2,1,out);
                   1632:                        else
                   1633:                                writecrc(src,arg3);
                   1634:                        continue; }
                   1635:                if(!stricmp(p,"FWRITE")) {
                   1636:                        if(!(*arg)) break;
                   1637:                        fputc(CS_FIO_FUNCTION,out);
                   1638:                        if(!(*arg3) || isdigit(*arg3) || atoi(arg3))
                   1639:                                fputc(FIO_WRITE,out);
                   1640:                        else
                   1641:                                fputc(FIO_WRITE_VAR,out);
                   1642:                        p=strchr(arg,SP);
                   1643:                        if(!p)
                   1644:                                break;
                   1645:                        *p=0;
                   1646:                        writecrc(src,arg);                      /* File handle */
                   1647:                        p=strchr(arg2,SP);
                   1648:                        if(p)
                   1649:                                *p=0;
                   1650:                        writecrc(src,arg2);             /* Variable */
                   1651:                        if(isdigit(*arg3))
                   1652:                                i=val(src,arg3);         /* Length */
                   1653:                        else
                   1654:                                i=0;
                   1655:                        if(i || !(*arg3))
                   1656:                                fwrite(&i,2,1,out);
                   1657:                        else
                   1658:                                writecrc(src,arg3);
                   1659:                        continue; }
                   1660:                if(!stricmp(p,"FGET_LENGTH")
                   1661:                        || !stricmp(p,"FGETLENGTH")
                   1662:                        || !stricmp(p,"GETFLENGTH")) {
                   1663:                        if(!(*arg) || !(*arg2)) break;
                   1664:                        fputc(CS_FIO_FUNCTION,out);
                   1665:                        fputc(FIO_GET_LENGTH,out);
                   1666:                        p=strchr(arg,SP);
                   1667:                        if(!p)
                   1668:                                break;
                   1669:                        *p=0;
                   1670:                        writecrc(src,arg);                      /* File handle */
                   1671:                        writecrc(src,arg2);             /* Variable */
                   1672:                        continue; }
                   1673:                if(!stricmp(p,"FREAD_LINE")) {
                   1674:                        if(!(*arg) || !(*arg2)) break;
                   1675:                        fputc(CS_FIO_FUNCTION,out);
                   1676:                        fputc(FIO_READ_LINE,out);
                   1677:                        p=strchr(arg,SP);
                   1678:                        if(!p)
                   1679:                                break;
                   1680:                        *p=0;
                   1681:                        writecrc(src,arg);                      /* File handle */
                   1682:                        writecrc(src,arg2);             /* Variable */
                   1683:                        continue; }
                   1684:                if(!stricmp(p,"FEOF")) {
                   1685:                        if(!(*arg)) break;
                   1686:                        fputc(CS_FIO_FUNCTION,out);
                   1687:                        fputc(FIO_EOF,out);
                   1688:                        writecrc(src,arg);
                   1689:                        continue; }
                   1690:                if(!stricmp(p,"FGET_POS")) {
                   1691:                        if(!(*arg) || !(*arg2)) break;
                   1692:                        fputc(CS_FIO_FUNCTION,out);
                   1693:                        fputc(FIO_GET_POS,out);
                   1694:                        p=strchr(arg,SP);
                   1695:                        if(!p)
                   1696:                                break;
                   1697:                        *p=0;
                   1698:                        writecrc(src,arg);                      /* File handle */
                   1699:                        writecrc(src,arg2);             /* Variable */
                   1700:                        continue; }
                   1701:                if(!stricmp(p,"FSET_POS") || !stricmp(p,"FSEEK")) {
                   1702:                        if(!(*arg)) break;
                   1703:                        fputc(CS_FIO_FUNCTION,out);
                   1704:                        if(isdigit(*arg2) || atol(arg2))
                   1705:                                fputc(FIO_SEEK,out);
                   1706:                        else
                   1707:                                fputc(FIO_SEEK_VAR,out);
                   1708:                        p=strchr(arg,SP);
                   1709:                        if(!p)
                   1710:                                break;
                   1711:                        *p=0;
                   1712:                        writecrc(src,arg);                      /* File handle */
                   1713:                        p=strchr(arg2,SP);
                   1714:                        if(p)
                   1715:                                *p=0;
                   1716:                        if(atol(arg2) || isdigit(*arg2)) {
                   1717:                                l=val(src,arg2);
                   1718:                                fwrite(&l,4,1,out); }
                   1719:                        else
                   1720:                                writecrc(src,arg2);             /* Offset variable */
                   1721:                        i=0;
                   1722:                        if(p) {
                   1723:                                p++;
                   1724:                                while(*p && *p<=SP) p++;
                   1725:                                i=atoi(p);
                   1726:                                if(!stricmp(p,"CUR"))
                   1727:                                        i=SEEK_CUR;
                   1728:                                else if(!stricmp(p,"END"))
                   1729:                                        i=SEEK_END; }
                   1730:                        fwrite(&i,2,1,out);
                   1731:                        continue; }
                   1732:                if(!stricmp(p,"FLOCK")) {
                   1733:                        if(!(*arg)) break;
                   1734:                        fputc(CS_FIO_FUNCTION,out);
                   1735:                        if(isdigit(*arg2) || atol(arg2))
                   1736:                                fputc(FIO_LOCK,out);
                   1737:                        else
                   1738:                                fputc(FIO_LOCK_VAR,out);
                   1739:                        p=strchr(arg,SP);
                   1740:                        if(!p)
                   1741:                                break;
                   1742:                        *p=0;
                   1743:                        writecrc(src,arg);                      /* File handle */
                   1744:                        if(atol(arg2) || isdigit(*arg2)) {
                   1745:                                l=val(src,arg2);
                   1746:                                if(!l)
                   1747:                                        break;
                   1748:                                fwrite(&l,4,1,out); }
                   1749:                        else
                   1750:                                writecrc(src,arg2);     /* Length variable */
                   1751:                        continue; }
                   1752:                if(!stricmp(p,"FUNLOCK")) {
                   1753:                        if(!(*arg)) break;
                   1754:                        fputc(CS_FIO_FUNCTION,out);
                   1755:                        if(isdigit(*arg2) || atol(arg2))
                   1756:                                fputc(FIO_UNLOCK,out);
                   1757:                        else
                   1758:                                fputc(FIO_UNLOCK_VAR,out);
                   1759:                        p=strchr(arg,SP);
                   1760:                        if(!p)
                   1761:                                break;
                   1762:                        *p=0;
                   1763:                        writecrc(src,arg);                      /* File handle */
                   1764:                        if(atol(arg2) || isdigit(*arg2)) {
                   1765:                                l=val(src,arg2);
                   1766:                                if(!l)
                   1767:                                        break;
                   1768:                                fwrite(&l,4,1,out); }
                   1769:                        else
                   1770:                                writecrc(src,arg2);             /* Length variable */
                   1771:                        continue; }
                   1772:                if(!stricmp(p,"FSET_LENGTH")) {
                   1773:                        if(!(*arg)) break;
                   1774:                        fputc(CS_FIO_FUNCTION,out);
                   1775:                        if(isdigit(*arg2) || atol(arg2))
                   1776:                                fputc(FIO_SET_LENGTH,out);
                   1777:                        else
                   1778:                                fputc(FIO_SET_LENGTH_VAR,out);
                   1779:                        p=strchr(arg,SP);
                   1780:                        if(!p)
                   1781:                                break;
                   1782:                        *p=0;
                   1783:                        writecrc(src,arg);                      /* File handle */
                   1784:                        if(atol(arg2) || isdigit(*arg2)) {
                   1785:                                l=val(src,arg2);
                   1786:                                fwrite(&l,4,1,out); }
                   1787:                        else
                   1788:                                writecrc(src,arg2);             /* Length variable */
                   1789:                        continue; }
                   1790:                if(!stricmp(p,"FPRINTF")) {
                   1791:                        if(!(*arg)) break;
                   1792:                        fputc(CS_FIO_FUNCTION,out);
                   1793:                        fputc(FIO_PRINTF,out);
                   1794:                        p=strchr(arg,SP);
                   1795:                        if(!p)
                   1796:                                break;
                   1797:                        *p=0;
                   1798:                        writecrc(src,arg);                                      /* Write destination variable */
                   1799:                        p++;
                   1800:                        while(*p && *p<=SP) p++;
                   1801:                        arg=p;
                   1802:                        p=strrchr(arg,'"');
                   1803:                        if(!p)
                   1804:                                break;
                   1805:                        *p=0;
                   1806:                        p++;
                   1807:                        while(*p && *p<=SP) p++;
                   1808:                        writecstr(arg);                 /* Write string */
                   1809:                        l=ftell(out);
                   1810:                        fputc(0,out);                   /* Write total number of args */
                   1811:                        i=0;
                   1812:                        while(p && *p) {
                   1813:                                arg=p;
                   1814:                                p=strchr(arg,SP);
                   1815:                                if(p) {
                   1816:                                        *p=0;
                   1817:                                        p++; }
                   1818:                                writecrc(src,arg);
                   1819:                                i++; }
                   1820:                        fseek(out,l,SEEK_SET);
                   1821:                        fputc((char)i,out);
                   1822:                        fseek(out,i*4,SEEK_CUR);
                   1823:                        continue; }
                   1824:                if(!stricmp(p,"FSET_ETX")) {
                   1825:                        if(!(*arg)) break;
                   1826:                        if((l=isvar(arg))!=0) {
                   1827:                                fputc(CS_USE_INT_VAR,out);
                   1828:                                fwrite(&l,4,1,out); // variable
                   1829:                                fputc(2,out);       // int offset
                   1830:                                fputc(1,out);       // int length
                   1831:                                ch=0; }                         // place holder
                   1832:                        else
                   1833:                                ch=val(src,arg);
                   1834: 
                   1835:                        fputc(CS_FIO_FUNCTION,out);
                   1836:                        fputc(FIO_SET_ETX,out);
                   1837:                        fwrite(&ch,1,1,out);
                   1838:                        continue; }
                   1839:                if(!stricmp(p,"FGET_TIME")) {
                   1840:                        if(!(*arg) || !(*arg2)) break;
                   1841:                        fputc(CS_FIO_FUNCTION,out);
                   1842:                        fputc(FIO_GET_TIME,out);
                   1843:                        p=strchr(arg,SP);
                   1844:                        if(!p)
                   1845:                                break;
                   1846:                        *p=0;
                   1847:                        writecrc(src,arg);                      /* File handle */
                   1848:                        writecrc(src,arg2);             /* Variable */
                   1849:                        continue; }
                   1850:                if(!stricmp(p,"FSET_TIME")) {
                   1851:                        if(!(*arg) || !(*arg2)) break;
                   1852:                        fputc(CS_FIO_FUNCTION,out);
                   1853:                        fputc(FIO_SET_TIME,out);
                   1854:                        p=strchr(arg,SP);
                   1855:                        if(!p)
                   1856:                                break;
                   1857:                        *p=0;
                   1858:                        writecrc(src,arg);                      /* File handle */
                   1859:                        writecrc(src,arg2);             /* Variable */
                   1860:                        continue; }
                   1861:                if(!stricmp(p,"REMOVE_FILE")) {
                   1862:                        if(!(*arg)) break;
                   1863:                        fputc(CS_FIO_FUNCTION,out);
                   1864:                        fputc(REMOVE_FILE,out);
                   1865:                        writecrc(src,arg);                      /* Str var */
                   1866:                        continue; }
                   1867:                if(!stricmp(p,"RENAME_FILE")) {
                   1868:                        if(!(*arg) || !(*arg2)) break;
                   1869:                        fputc(CS_FIO_FUNCTION,out);
                   1870:                        fputc(RENAME_FILE,out);
                   1871:                        p=strchr(arg,SP);
                   1872:                        if(!p)
                   1873:                                break;
                   1874:                        *p=0;
                   1875:                        writecrc(src,arg);                      /* str var */
                   1876:                        writecrc(src,arg2);             /* str var */
                   1877:                        continue; }
                   1878:                if(!stricmp(p,"COPY_FILE")) {
                   1879:                        if(!(*arg) || !(*arg2)) break;
                   1880:                        fputc(CS_FIO_FUNCTION,out);
                   1881:                        fputc(COPY_FILE,out);
                   1882:                        p=strchr(arg,SP);
                   1883:                        if(!p)
                   1884:                                break;
                   1885:                        *p=0;
                   1886:                        writecrc(src,arg);                      /* str var */
                   1887:                        writecrc(src,arg2);             /* str var */
                   1888:                        continue; }
                   1889:                if(!stricmp(p,"MOVE_FILE")) {
                   1890:                        if(!(*arg) || !(*arg2)) break;
                   1891:                        fputc(CS_FIO_FUNCTION,out);
                   1892:                        fputc(MOVE_FILE,out);
                   1893:                        p=strchr(arg,SP);
                   1894:                        if(!p)
                   1895:                                break;
                   1896:                        *p=0;
                   1897:                        writecrc(src,arg);                      /* str var */
                   1898:                        writecrc(src,arg2);             /* str var */
                   1899:                        continue; }
                   1900:                if(!stricmp(p,"GET_FILE_ATTRIB")) {
                   1901:                        if(!(*arg) || !(*arg2)) break;
                   1902:                        fputc(CS_FIO_FUNCTION,out);
                   1903:                        fputc(GET_FILE_ATTRIB,out);
                   1904:                        p=strchr(arg,SP);
                   1905:                        if(!p)
                   1906:                                break;
                   1907:                        *p=0;
                   1908:                        writecrc(src,arg);                      /* str var */
                   1909:                        writecrc(src,arg2);             /* int var */
                   1910:                        continue; }
                   1911:                if(!stricmp(p,"SET_FILE_ATTRIB")) {
                   1912:                        if(!(*arg) || !(*arg2)) break;
                   1913:                        fputc(CS_FIO_FUNCTION,out);
                   1914:                        fputc(SET_FILE_ATTRIB,out);
                   1915:                        p=strchr(arg,SP);
                   1916:                        if(!p)
                   1917:                                break;
                   1918:                        *p=0;
                   1919:                        writecrc(src,arg);                      /* str var */
                   1920:                        writecrc(src,arg2);             /* int var */
                   1921:                        continue; }
                   1922:                if(!stricmp(p,"RMDIR") || !stricmp(p,"REMOVE_DIR")) {
                   1923:                        if(!(*arg)) break;
                   1924:                        fputc(CS_FIO_FUNCTION,out);
                   1925:                        fputc(REMOVE_DIR,out);
                   1926:                        writecrc(src,arg);                      /* Str var */
                   1927:                        continue; }
                   1928:                if(!stricmp(p,"MKDIR") || !stricmp(p,"MAKE_DIR")) {
                   1929:                        if(!(*arg)) break;
                   1930:                        fputc(CS_FIO_FUNCTION,out);
                   1931:                        fputc(MAKE_DIR,out);
                   1932:                        writecrc(src,arg);                      /* Str var */
                   1933:                        continue; }
                   1934:                if(!stricmp(p,"CHDIR") || !stricmp(p,"CHANGE_DIR")) {
                   1935:                        if(!(*arg)) break;
                   1936:                        fputc(CS_FIO_FUNCTION,out);
                   1937:                        fputc(CHANGE_DIR,out);
                   1938:                        writecrc(src,arg);                      /* Str var */
                   1939:                        continue; }
                   1940:                if(!stricmp(p,"OPEN_DIR")) {
                   1941:                        if(!(*arg) || !(*arg2)) break;
                   1942:                        fputc(CS_FIO_FUNCTION,out);
                   1943:                        fputc(OPEN_DIR,out);
                   1944:                        p=strchr(arg,SP);
                   1945:                        if(!p)
                   1946:                                break;
                   1947:                        *p=0;
                   1948:                        writecrc(src,arg);                      /* int var */
                   1949:                        writecrc(src,arg2);             /* str var */
                   1950:                        continue; }
                   1951:                if(!stricmp(p,"READ_DIR")) {
                   1952:                        if(!(*arg) || !(*arg2)) break;
                   1953:                        fputc(CS_FIO_FUNCTION,out);
                   1954:                        fputc(READ_DIR,out);
                   1955:                        p=strchr(arg,SP);
                   1956:                        if(!p)
                   1957:                                break;
                   1958:                        *p=0;
                   1959:                        writecrc(src,arg);                      /* int var */
                   1960:                        writecrc(src,arg2);             /* str var */
                   1961:                        continue; }
                   1962:                if(!stricmp(p,"REWIND_DIR")) {
                   1963:                        if(!(*arg)) break;
                   1964:                        fputc(CS_FIO_FUNCTION,out);
                   1965:                        fputc(REWIND_DIR,out);
                   1966:                        writecrc(src,arg);                      /* int var */
                   1967:                        continue; }
                   1968:                if(!stricmp(p,"CLOSE_DIR")) {
                   1969:                        if(!(*arg)) break;
                   1970:                        fputc(CS_FIO_FUNCTION,out);
                   1971:                        fputc(CLOSE_DIR,out);
                   1972:                        writecrc(src,arg);                      /* int var */
                   1973:                        continue; }
                   1974: 
                   1975:                if(!stricmp(p,"NODE_ACTION")) {
                   1976:                        if(!(*arg)) break;
                   1977:                        if((l=isvar(arg))!=0) {
                   1978:                                fputc(CS_USE_INT_VAR,out);
                   1979:                                fwrite(&l,4,1,out); // variable
                   1980:                                fputc(1,out);           // int offset
                   1981:                                fputc(1,out);       // int length
                   1982:                                ch=0; }                         // place holder
                   1983:                        else
                   1984:                                ch=val(src,arg);
                   1985: 
                   1986:                        fprintf(out,"%c%c",CS_NODE_ACTION,ch);
                   1987:                        continue; }
                   1988:                if(!stricmp(p,"NODE_STATUS")) {
                   1989:                        if(!(*arg)) break;
                   1990:                        if((l=isvar(arg))!=0) {
                   1991:                                fputc(CS_USE_INT_VAR,out);
                   1992:                                fwrite(&l,4,1,out); // variable
                   1993:                                fputc(1,out);           // int offset
                   1994:                                fputc(1,out);       // int length
                   1995:                                ch=0; }                         // place holder
                   1996:                        else
                   1997:                                ch=val(src,arg);
                   1998: 
                   1999:                        fprintf(out,"%c%c",CS_NODE_STATUS,ch);
                   2000:                        continue; }
                   2001:                if(!stricmp(p,"END_CMD") || !stricmp(p,"ENDCMD")) {
                   2002:                        fprintf(out,"%c",CS_END_CMD);
                   2003:                        continue; }
                   2004:                if(!stricmp(p,"CMD_POP") || !stricmp(p,"CMDPOP")) {
                   2005:                        fprintf(out,"%c",CS_CMD_POP);
                   2006:                        continue; }
                   2007:                if(!stricmp(p,"CLS")) {
                   2008:                        fprintf(out,"%c",CS_CLS);
                   2009:                        continue; }
                   2010:                if(!stricmp(p,"CRLF")) {
                   2011:                        fprintf(out,"%c",CS_CRLF);
                   2012:                        continue; }
                   2013:                if(!stricmp(p,"PAUSE")) {
                   2014:                        fprintf(out,"%c",CS_PAUSE);
                   2015:                        continue; }
                   2016:                if(!stricmp(p,"PAUSE_RESET")) {
                   2017:                        fprintf(out,"%c",CS_PAUSE_RESET);
                   2018:                        continue; }
                   2019:                if(!stricmp(p,"CLEAR_ABORT")) {
                   2020:                        fprintf(out,"%c",CS_CLEAR_ABORT);
                   2021:                        continue; }
                   2022:                if(!stricmp(p,"GETLINES")) {
                   2023:                        fprintf(out,"%c",CS_GETLINES);
                   2024:                        continue; }
                   2025:                if(!stricmp(p,"GETFILESPEC")) {
                   2026:                        fprintf(out,"%c",CS_GETFILESPEC);
                   2027:                        continue; }
                   2028:                if(!stricmp(p,"FINDUSER")) {
                   2029:                        fprintf(out,"%c",CS_FINDUSER);
                   2030:                        continue; }
                   2031: 
                   2032:                if(!stricmp(p,"LOG")) {
                   2033:                        if(!(*arg)) break;
                   2034:                        fprintf(out,"%c",CS_LOG);
                   2035:                        writecstr(arg);
                   2036:                        continue; }
                   2037:                if(!stricmp(p,"MNEMONICS")) {
                   2038:                        if(!(*arg)) break;
                   2039:                        fprintf(out,"%c",CS_MNEMONICS);
                   2040:                        writecstr(arg);
                   2041:                        continue; }
                   2042:                if(!stricmp(p,"PRINT")) {
                   2043:                        if(!(*arg)) break;
                   2044:                        fprintf(out,"%c",CS_PRINT);
                   2045:                        writecstr(arg);
                   2046:                        continue; }
                   2047:                if(!stricmp(p,"PRINT_LOCAL")) {
                   2048:                        if(!(*arg)) break;
                   2049:                        fprintf(out,"%c",CS_PRINT_LOCAL);
                   2050:                        writecstr(arg);
                   2051:                        continue; }
                   2052:                if(!stricmp(p,"PRINT_REMOTE")) {
                   2053:                        if(!(*arg)) break;
                   2054:                        fprintf(out,"%c",CS_PRINT_REMOTE);
                   2055:                        writecstr(arg);
                   2056:                        continue; }
                   2057:                if(!stricmp(p,"PRINTFILE")) {
                   2058:                        if(!(*arg)) break;
                   2059:                        if(*arg=='"') { /* NEED TO SUPPORT MODE HERE */
                   2060:                                fprintf(out,"%c",CS_PRINTFILE);
                   2061:                                writestr(arg); }
                   2062:                        else {
                   2063:                                if((l=isvar(arg2))!=0) {
                   2064:                                        fputc(CS_USE_INT_VAR,out);
                   2065:                                        fwrite(&l,4,1,out); // variable
                   2066:                                        fputc(6,out);           // int offset
                   2067:                                        fputc(2,out);           // int length
                   2068:                                        i=0; }                          // place holder
                   2069:                                else
                   2070:                                        i=val(src,arg2);
                   2071: 
                   2072:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,PRINTFILE_VAR_MODE);
                   2073:                                p=strchr(arg,SP);
                   2074:                                if(p) *p=0;
                   2075:                                writecrc(src,arg);
                   2076:                                fwrite(&i,2,1,out); }
                   2077:                        continue; }
                   2078:                if(!stricmp(p,"PRINTTAIL")) {
                   2079:                        if(!(*arg) || !(*arg2))
                   2080:                                break;
                   2081:                        if((l=isvar(arg3))!=0) {
                   2082:                                fputc(CS_USE_INT_VAR,out);
                   2083:                                fwrite(&l,4,1,out); // variable
                   2084:                                fputc(8,out);           // int offset
                   2085:                                fputc(1,out);       // int length
                   2086:                                j=0; }                          // place holder
                   2087:                        else
                   2088:                                j=val(src,arg3);
                   2089: 
                   2090:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,PRINTTAIL_VAR_MODE);
                   2091:                        p=strchr(arg,SP);
                   2092:                        if(p) *p=0;
                   2093:                        writecrc(src,arg);
                   2094:                        i=val(src,arg2);
                   2095:                        fwrite(&i,2,1,out);
                   2096:                        fwrite(&j,1,1,out);
                   2097:                        continue; }
                   2098: 
                   2099:                if(!stricmp(p,"PRINTFILE_STR")) {
                   2100:                        fprintf(out,"%c",CS_PRINTFILE_STR);
                   2101:                        continue; }
                   2102:                if(!stricmp(p,"PRINTFILE_LOCAL")) {
                   2103:                        if(!(*arg)) break;
                   2104:                        fprintf(out,"%c",CS_PRINTFILE_LOCAL);
                   2105:                        writestr(arg);
                   2106:                        continue; }
                   2107:                if(!stricmp(p,"PRINTFILE_REMOTE")) {
                   2108:                        if(!(*arg)) break;
                   2109:                        fprintf(out,"%c",CS_PRINTFILE_REMOTE);
                   2110:                        writestr(arg);
                   2111:                        continue; }
                   2112: 
                   2113:                if(!stricmp(p,"TELNET_GATE")) {
                   2114:                        if(!(*arg)) break;
                   2115:                        if((l=isvar(arg2))!=0) {
                   2116:                                fputc(CS_USE_INT_VAR,out);
                   2117:                                fwrite(&l,4,1,out); // variable
                   2118:                                fputc(2,out);           // int offset
                   2119:                                fputc(4,out);           // int length
                   2120:                                l=0; }                          // place holder
                   2121:                        else if(*arg2)
                   2122:                                l=val(src,arg2);
                   2123:                        else
                   2124:                                l=0;
                   2125: 
                   2126:                        if(*arg=='"') {
                   2127:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,TELNET_GATE_STR);
                   2128:                                fwrite(&l,4,1,out);
                   2129:                                writestr(arg); 
                   2130:                        } else {
                   2131:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,TELNET_GATE_VAR);
                   2132:                                fwrite(&l,4,1,out);
                   2133:                                p=strchr(arg,SP);
                   2134:                                if(p) *p=0;
                   2135:                                writecrc(src,arg);
                   2136:                        }
                   2137:                        continue; 
                   2138:                }
                   2139: 
                   2140:                if(!stricmp(p,"EXEC")) {
                   2141:                        if(!(*arg)) break;
                   2142:                        fprintf(out,"%c",CS_EXEC);
                   2143:                        writestr(arg);
                   2144:                        continue; }
                   2145:                if(!stricmp(p,"EXEC_INT")) {
                   2146:                        if(!(*arg)) break;
                   2147:                        fprintf(out,"%c",CS_EXEC_INT);
                   2148:                        writestr(arg);
                   2149:                        continue; }
                   2150:                if(!stricmp(p,"EXEC_BIN")) {
                   2151:                        if(!(*arg)) break;
                   2152:                        fprintf(out,"%c",CS_EXEC_BIN);
                   2153:                        writestr(arg);
                   2154:                        continue; }
                   2155:                if(!stricmp(p,"EXEC_XTRN")) {
                   2156:                        if(!(*arg)) break;
                   2157:                        fprintf(out,"%c",CS_EXEC_XTRN);
                   2158:                        writestr(arg);
                   2159:                        continue; }
                   2160: 
                   2161:                if(!stricmp(p,"SELECT_SHELL")) {
                   2162:                        fprintf(out,"%c",CS_SELECT_SHELL);
                   2163:                        continue; }
                   2164:                if(!stricmp(p,"SET_SHELL")) {
                   2165:                        fprintf(out,"%c",CS_SET_SHELL);
                   2166:                        continue; }
                   2167:                if(!stricmp(p,"SELECT_EDITOR")) {
                   2168:                        fprintf(out,"%c",CS_SELECT_EDITOR);
                   2169:                        continue; }
                   2170:                if(!stricmp(p,"SET_EDITOR")) {
                   2171:                        fprintf(out,"%c",CS_SET_EDITOR);
                   2172:                        continue; }
                   2173: 
                   2174:                if(!stricmp(p,"YES_NO")) {
                   2175:                        if(!(*arg)) break;
                   2176:                        fprintf(out,"%c",CS_YES_NO);
                   2177:                        writecstr(arg);
                   2178:                        continue; }
                   2179:                if(!stricmp(p,"NO_YES")) {
                   2180:                        if(!(*arg)) break;
                   2181:                        fprintf(out,"%c",CS_NO_YES);
                   2182:                        writecstr(arg);
                   2183:                        continue; }
                   2184:                if(!stricmp(p,"MENU")) {
                   2185:                        if(!(*arg)) break;
                   2186:                        fprintf(out,"%c",CS_MENU);
                   2187:                        writestr(arg);
                   2188:                        continue; }
                   2189:                if(!stricmp(p,"SET_MENU_DIR")) {
                   2190:                        if(!(*arg)) break;
                   2191:                        fprintf(out,"%c",CS_SET_MENU_DIR);
                   2192:                        writestr(arg);
                   2193:                        continue; }
                   2194:                if(!stricmp(p,"SET_MENU_FILE")) {
                   2195:                        if(!(*arg)) break;
                   2196:                        fprintf(out,"%c",CS_SET_MENU_FILE);
                   2197:                        writestr(arg);
                   2198:                        continue; }
                   2199:                if(!stricmp(p,"SEND_FILE_VIA")) {
                   2200:                        if(!(*arg) || !(*arg2)) break;
                   2201:                        if(*arg2=='"') {
                   2202:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,SEND_FILE_VIA,*arg);
                   2203:                                writestr(arg2); }
                   2204:                        else {
                   2205:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,SEND_FILE_VIA_VAR,*arg);
                   2206:                                writecrc(src,arg2); }
                   2207:                        continue; }
                   2208:                if(!stricmp(p,"RECEIVE_FILE_VIA")) {
                   2209:                        if(!(*arg) || !(*arg2)) break;
                   2210:                        if(*arg2=='"') {
                   2211:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,RECEIVE_FILE_VIA,*arg);
                   2212:                                writestr(arg2); }
                   2213:                        else {
                   2214:                                fprintf(out,"%c%c%c",CS_VAR_INSTRUCTION,RECEIVE_FILE_VIA_VAR,*arg);
                   2215:                                writecrc(src,arg2); }
                   2216:                        continue; }
                   2217:                if(!stricmp(p,"CHKFILE")) {
                   2218:                        if(!(*arg)) break;
                   2219:                        if(*arg=='"') {
                   2220:                                fprintf(out,"%c",CS_CHKFILE);
                   2221:                                writestr(arg); }
                   2222:                        else {
                   2223:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,CHKFILE_VAR);
                   2224:                                writecrc(src,arg); }
                   2225:                        continue; }
                   2226:                if(!stricmp(p,"GET_FILE_LENGTH")) {
                   2227:                        if(!(*arg) || !(*arg2))
                   2228:                                break;
                   2229:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,FLENGTH_TO_INT);
                   2230:                        p=strchr(arg,SP);
                   2231:                        if(p) *p=0;
                   2232:                        writecrc(src,arg);
                   2233:                        writecrc(src,arg2);
                   2234:                        continue; }
                   2235:                if(!stricmp(p,"GET_FILE_TIME")) {
                   2236:                        if(!(*arg) || !(*arg2))
                   2237:                                break;
                   2238:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,FTIME_TO_INT);
                   2239:                        p=strchr(arg,SP);
                   2240:                        if(p) *p=0;
                   2241:                        writecrc(src,arg);
                   2242:                        writecrc(src,arg2);
                   2243:                        continue; }
                   2244:                if(!stricmp(p,"CHARVAL")) {
                   2245:                        if(!(*arg) || !(*arg2))
                   2246:                                break;
                   2247:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,CHARVAL_TO_INT);
                   2248:                        p=strchr(arg,SP);
                   2249:                        if(p) *p=0;
                   2250:                        writecrc(src,arg);
                   2251:                        writecrc(src,arg2);
                   2252:                        continue; }
                   2253:                if(!stricmp(p,"SETSTR")) {
                   2254:                        if(!(*arg)) break;
                   2255:                        fprintf(out,"%c",CS_SETSTR);
                   2256:                        writecstr(arg);
                   2257:                        continue; }
                   2258:                if(!stricmp(p,"COMPARE_STR")) {
                   2259:                        if(!(*arg)) break;
                   2260:                        fprintf(out,"%c",CS_COMPARE_STR);
                   2261:                        writecstr(arg);
                   2262:                        continue; }
                   2263:                if(!stricmp(p,"GET_TEMPLATE")) {
                   2264:                        if(!(*arg)) break;
                   2265:                        fprintf(out,"%c",CS_GET_TEMPLATE);
                   2266:                        writestr(arg);
                   2267:                        continue; }
                   2268:                if(!stricmp(p,"READ_SIF")) {
                   2269:                        if(!(*arg)) break;
                   2270:                        fprintf(out,"%c",CS_READ_SIF);
                   2271:                        writestr(arg);
                   2272:                        continue; }
                   2273:                if(!stricmp(p,"CREATE_SIF")) {
                   2274:                        if(!(*arg)) break;
                   2275:                        fprintf(out,"%c",CS_CREATE_SIF);
                   2276:                        writestr(arg);
                   2277:                        continue; }
                   2278:                if(!stricmp(p,"TRASHCAN")) {
                   2279:                        if(!(*arg)) break;
                   2280:                        fprintf(out,"%c",CS_TRASHCAN);
                   2281:                        writestr(arg);
                   2282:                        continue; }
                   2283:                if(!stricmp(p,"CMDSTR")) {
                   2284:                        if(!(*arg)) break;
                   2285:                        fprintf(out,"%c",CS_CMDSTR);
                   2286:                        writecstr(arg);
                   2287:                        continue; }
                   2288:                if(!stricmp(p,"CMDKEYS")) {
                   2289:                        if(!(*arg)) break;
                   2290:                        fprintf(out,"%c",CS_CMDKEYS);
                   2291:                        for(p=arg;*p && *p!='#';p++) {
                   2292:                                ch=*p;
                   2293:                                if(ch=='"')
                   2294:                                        continue;
                   2295:                                if(ch=='/') {
                   2296:                                        p++;
                   2297:                                        ch=*p|0x80; }  /* high bit indicates slash required */
                   2298:                                else if(ch=='^' && *(p+1)>=0x40) {
                   2299:                                        p++;
                   2300:                                        ch=*p;
                   2301:                                        ch-=0x40; }
                   2302:                                else if(ch=='\\') {
                   2303:                                        p++;
                   2304:                                        ch=cesc(*p); }
                   2305:                                fputc(ch,out); }
                   2306:                        fputc(0,out);
                   2307:                        continue; }
                   2308:                if(!stricmp(p,"COMPARE_WORD")) {
                   2309:                        if(!(*arg)) break;
                   2310:                        fprintf(out,"%c",CS_COMPARE_WORD);
                   2311:                        writecstr(arg);
                   2312:                        continue; }
                   2313:                if(!stricmp(p,"GETSTR")) {
                   2314:                        p=strchr(arg,SP);
                   2315:                        if(p) *p=0;
                   2316:                        if((!(*arg) || isdigit(*arg) || !stricmp(arg,"STR")) && !(*arg3))
                   2317:                                fprintf(out,"%c%c",CS_GETSTR,atoi(arg) ? atoi(arg)
                   2318:                                        : *arg2 ? atoi(arg2) : 128);
                   2319:                        else {
                   2320:                                if((l=isvar(arg2))!=0) {
                   2321:                                        fputc(CS_USE_INT_VAR,out);
                   2322:                                        fwrite(&l,4,1,out); // variable
                   2323:                                        fputc(6,out);           // int offset
                   2324:                                        fputc(1,out);           // int length
                   2325:                                        i=0; }                          // place holder
                   2326:                                else if(*arg2)
                   2327:                                        i=val(src,arg2);
                   2328:                                else
                   2329:                                        i=0;
                   2330: 
                   2331:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION
                   2332:                                        ,*arg3 ? GETSTR_MODE : GETSTR_VAR);
                   2333:                                writecrc(src,arg);
                   2334:                
                   2335:                                if(!i) i=128;
                   2336:                                fwrite(&i,1,1,out);
                   2337:                                if(*arg3) {
                   2338:                                        l=val(src,arg3);
                   2339:                                        fwrite(&l,4,1,out); } }
                   2340:                        continue; }
                   2341:                if(!stricmp(p,"GETNUM")) {
                   2342:                        if(!(*arg)) break;
                   2343:                        p=strchr(arg,SP);
                   2344:                        if(p) *p=0;
                   2345:                        if(isdigit(*arg)) {
                   2346:                                i=val(src,arg);
                   2347:                                fprintf(out,"%c",CS_GETNUM);
                   2348:                                fwrite(&i,2,1,out); }
                   2349:                        else {
                   2350:                                if((l=isvar(arg2))!=0) {
                   2351:                                        fputc(CS_USE_INT_VAR,out);
                   2352:                                        fwrite(&l,4,1,out); // variable
                   2353:                                        fputc(6,out);           // int offset
                   2354:                                        fputc(2,out);           // int length
                   2355:                                        i=0; }                          // place holder
                   2356:                                else
                   2357:                                        i=val(src,arg2);
                   2358: 
                   2359:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETNUM_VAR);
                   2360:                                writecrc(src,arg);
                   2361:                                fwrite(&i,2,1,out); }
                   2362:                        continue; }
                   2363:                if(!stricmp(p,"MSWAIT")) {
                   2364:                        if(!(*arg)) break;
                   2365:                        if((l=isvar(arg))!=0) {
                   2366:                                fputc(CS_USE_INT_VAR,out);
                   2367:                                fwrite(&l,4,1,out); // variable
                   2368:                                fputc(1,out);           // int offset
                   2369:                                fputc(2,out);           // int length
                   2370:                                i=0; }                          // place holder
                   2371:                        else
                   2372:                                i=val(src,arg);
                   2373: 
                   2374:                        fprintf(out,"%c",CS_MSWAIT);
                   2375:                        fwrite(&i,2,1,out);
                   2376:                        continue; }
                   2377:                if(!stricmp(p,"GETLINE")) {
                   2378:                        p=strchr(arg,SP);
                   2379:                        if(p) *p=0;
                   2380:                        if(!(*arg) || isdigit(*arg))
                   2381:                                fprintf(out,"%c%c",CS_GETLINE,*arg ? atoi(arg) :128);
                   2382:                        else {
                   2383:                                if((l=isvar(arg2))!=0) {
                   2384:                                        fputc(CS_USE_INT_VAR,out);
                   2385:                                        fwrite(&l,4,1,out); // variable
                   2386:                                        fputc(6,out);           // int offset
                   2387:                                        fputc(1,out);           // int length
                   2388:                                        i=0; }                          // place holder
                   2389:                                else
                   2390:                                        i=val(src,arg2);
                   2391: 
                   2392:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETLINE_VAR);
                   2393:                                writecrc(src,arg);
                   2394:                                if(!i) i=128;
                   2395:                                fwrite(&i,1,1,out); }
                   2396:                        continue; }
                   2397:                if(!stricmp(p,"GETSTRUPR")) {
                   2398:                        p=strchr(arg,SP);
                   2399:                        if(p) *p=0;
                   2400:                        if(!(*arg) || isdigit(*arg))
                   2401:                                fprintf(out,"%c%c",CS_GETSTRUPR,*arg ? atoi(arg) :128);
                   2402:                        else {
                   2403:                                if((l=isvar(arg2))!=0) {
                   2404:                                        fputc(CS_USE_INT_VAR,out);
                   2405:                                        fwrite(&l,4,1,out); // variable
                   2406:                                        fputc(6,out);           // int offset
                   2407:                                        fputc(1,out);           // int length
                   2408:                                        i=0; }                          // place holder
                   2409:                                else
                   2410:                                        i=val(src,arg2);
                   2411: 
                   2412:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETSTRUPR_VAR);
                   2413:                                writecrc(src,arg);
                   2414:                                if(!i) i=128;
                   2415:                                fwrite(&i,1,1,out); }
                   2416:                        continue; }
                   2417:                if(!stricmp(p,"GETNAME")) {
                   2418:                        p=strchr(arg,SP);
                   2419:                        if(p) *p=0;
                   2420:                        if(!(*arg) || isdigit(*arg))
                   2421:                                fprintf(out,"%c%c",CS_GETNAME,*arg ? atoi(arg) :25);
                   2422:                        else {
                   2423:                                if((l=isvar(arg2))!=0) {
                   2424:                                        fputc(CS_USE_INT_VAR,out);
                   2425:                                        fwrite(&l,4,1,out); // variable
                   2426:                                        fputc(6,out);           // int offset
                   2427:                                        fputc(1,out);           // int length
                   2428:                                        i=0; }                          // place holder
                   2429:                                else
                   2430:                                        i=atoi(arg2);
                   2431: 
                   2432:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,GETNAME_VAR);
                   2433:                                writecrc(src,arg);
                   2434:                                if(!i) i=128;
                   2435:                                fwrite(&i,1,1,out); }
                   2436:                        continue; }
                   2437:                if(!stricmp(p,"SHIFT_STR")) {
                   2438:                        if(!(*arg)) break;
                   2439:                        p=strchr(arg,SP);
                   2440:                        if(p) *p=0;
                   2441:                        if(!(*arg) || isdigit(*arg))
                   2442:                                fprintf(out,"%c%c",CS_SHIFT_STR,atoi(arg));
                   2443:                        else {
                   2444:                                if((l=isvar(arg2))!=0) {
                   2445:                                        fputc(CS_USE_INT_VAR,out);
                   2446:                                        fwrite(&l,4,1,out); // variable
                   2447:                                        fputc(6,out);           // int offset
                   2448:                                        fputc(1,out);           // int length
                   2449:                                        i=0; }                          // place holder
                   2450:                                else
                   2451:                                        i=atoi(arg2);
                   2452: 
                   2453:                                fprintf(out,"%c%c",CS_VAR_INSTRUCTION,SHIFT_STR_VAR);
                   2454:                                writecrc(src,arg);
                   2455:                                if(!i) i=128;
                   2456:                                fwrite(&i,1,1,out); }
                   2457:                        continue; }
                   2458:                if(!stricmp(p,"TRUNCSP")) {
                   2459:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,TRUNCSP_STR_VAR);
                   2460:                        writecrc(src,arg);
                   2461:                        continue; }
                   2462:                if(!stricmp(p,"STRIP_CTRL")) {
                   2463:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRIP_CTRL_STR_VAR);
                   2464:                        writecrc(src,arg);
                   2465:                        continue; }
                   2466:                if(!stricmp(p,"STRUPR")) {
                   2467:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRUPR_VAR);
                   2468:                        writecrc(src,arg);
                   2469:                        continue; }
                   2470:                if(!stricmp(p,"STRLWR")) {
                   2471:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRLWR_VAR);
                   2472:                        writecrc(src,arg);
                   2473:                        continue; }
                   2474:                if(!stricmp(p,"STRLEN")) {
                   2475:                        if(!(*arg)) break;
                   2476:                        fprintf(out,"%c%c",CS_VAR_INSTRUCTION,STRLEN_INT_VAR);
                   2477:                        p=strchr(arg,SP);
                   2478:                        if(!p)
                   2479:                                break;
                   2480:                        *p=0;
                   2481:                        writecrc(src,arg);
                   2482:                        writecrc(src,arg2);
                   2483:                        continue; }
                   2484:                if(!stricmp(p,"REPLACE_TEXT")) {
                   2485:                        if(!(*arg) || !(*arg2)) break;
                   2486:                        if((l=isvar(arg))!=0) {
                   2487:                                fputc(CS_USE_INT_VAR,out);
                   2488:                                fwrite(&l,4,1,out); // variable
                   2489:                                fputc(1,out);           // int offset
                   2490:                                fputc(2,out);           // int length
                   2491:                                i=0; }                          // place holder
                   2492:                        else
                   2493:                                i=val(src,arg);
                   2494: 
                   2495:                        fprintf(out,"%c",CS_REPLACE_TEXT);
                   2496:                        fwrite(&i,2,1,out);
                   2497:                        writecstr(arg2);
                   2498:                        continue; }
                   2499:                if(!stricmp(p,"REVERT_TEXT")) {
                   2500:                        if(!(*arg)) break;
                   2501:                        if(!stricmp(arg,"ALL"))
                   2502:                                i=0xffff;
                   2503:                        else {
                   2504:                                if((l=isvar(arg))!=0) {
                   2505:                                        fputc(CS_USE_INT_VAR,out);
                   2506:                                        fwrite(&l,4,1,out); // variable
                   2507:                                        fputc(1,out);           // int offset
                   2508:                                        fputc(2,out);           // int length
                   2509:                                        i=0; }                          // place holder
                   2510:                                else
                   2511:                                        i=val(src,arg); }
                   2512: 
                   2513:                        fprintf(out,"%c",CS_REVERT_TEXT);
                   2514:                        fwrite(&i,2,1,out);
                   2515:                        continue; }
                   2516:                if(!stricmp(p,"TOGGLE_USER_MISC")
                   2517:                        || !stricmp(p,"COMPARE_USER_MISC")) {
                   2518:                        if(!(*arg)) break;
                   2519: 
                   2520:                        if((l=isvar(arg))!=0) {
                   2521:                                fputc(CS_USE_INT_VAR,out);
                   2522:                                fwrite(&l,4,1,out); // variable
                   2523:                                fputc(1,out);           // int offset
                   2524:                                fputc(4,out);           // int length
                   2525:                                l=0; }                          // place holder
                   2526:                        else
                   2527:                                l=val(src,arg);
                   2528: 
                   2529:                        if(!stricmp(p,"TOGGLE_USER_MISC"))
                   2530:                                fprintf(out,"%c",CS_TOGGLE_USER_MISC);
                   2531:                        else
                   2532:                                fprintf(out,"%c",CS_COMPARE_USER_MISC);
                   2533:                        fwrite(&l,4,1,out);
                   2534:                        continue; }
                   2535: 
                   2536:                if(!stricmp(p,"TOGGLE_USER_CHAT")
                   2537:                        || !stricmp(p,"COMPARE_USER_CHAT")) {
                   2538:                        if(!(*arg)) break;
                   2539: 
                   2540:                        if((l=isvar(arg))!=0) {
                   2541:                                fputc(CS_USE_INT_VAR,out);
                   2542:                                fwrite(&l,4,1,out); // variable
                   2543:                                fputc(1,out);           // int offset
                   2544:                                fputc(4,out);           // int length
                   2545:                                l=0; }                          // place holder
                   2546:                        else
                   2547:                                l=val(src,arg);
                   2548: 
                   2549:                        if(!stricmp(p,"TOGGLE_USER_CHAT"))
                   2550:                                fprintf(out,"%c",CS_TOGGLE_USER_CHAT);
                   2551:                        else
                   2552:                                fprintf(out,"%c",CS_COMPARE_USER_CHAT);
                   2553:                        fwrite(&l,4,1,out);
                   2554:                        continue; }
                   2555: 
                   2556:                if(!stricmp(p,"TOGGLE_USER_QWK")
                   2557:                        || !stricmp(p,"COMPARE_USER_QWK")) {
                   2558:                        if(!(*arg)) break;
                   2559: 
                   2560:                        if((l=isvar(arg))!=0) {
                   2561:                                fputc(CS_USE_INT_VAR,out);
                   2562:                                fwrite(&l,4,1,out); // variable
                   2563:                                fputc(1,out);           // int offset
                   2564:                                fputc(4,out);           // int length
                   2565:                                l=0; }                          // place holder
                   2566:                        else
                   2567:                                l=val(src,arg);
                   2568: 
                   2569:                        if(!stricmp(p,"TOGGLE_USER_QWK"))
                   2570:                                fprintf(out,"%c",CS_TOGGLE_USER_QWK);
                   2571:                        else
                   2572:                                fprintf(out,"%c",CS_COMPARE_USER_QWK);
                   2573:                        fwrite(&l,4,1,out);
                   2574:                        continue; }
                   2575: 
                   2576:                if(!stricmp(p,"TOGGLE_NODE_MISC")
                   2577:                        || !stricmp(p,"COMPARE_NODE_MISC")) {
                   2578:                        if(!(*arg)) break;
                   2579: 
                   2580:                        if((l=isvar(arg))!=0) {
                   2581:                                fputc(CS_USE_INT_VAR,out);
                   2582:                                fwrite(&l,4,1,out); // variable
                   2583:                                fputc(1,out);           // int offset
                   2584:                                fputc(2,out);           // int length
                   2585:                                i=0; }                          // place holder
                   2586:                        else
                   2587:                                i=val(src,arg);
                   2588: 
                   2589:                        if(!stricmp(p,"TOGGLE_NODE_MISC"))
                   2590:                                fprintf(out,"%c",CS_TOGGLE_NODE_MISC);
                   2591:                        else
                   2592:                                fprintf(out,"%c",CS_COMPARE_NODE_MISC);
                   2593:                        fwrite(&i,2,1,out);
                   2594:                        continue; }
                   2595: 
                   2596:                if(!stricmp(p,"TOGGLE_USER_FLAG")) {
                   2597:                        if(!(*arg)) break;
                   2598:                        p=arg;
                   2599:                        fprintf(out,"%c%c",CS_TOGGLE_USER_FLAG,toupper(*p++));
                   2600:                        while(*p && *p<=SP) p++;
                   2601:                        fprintf(out,"%c",toupper(*p));
                   2602:                        continue; }
                   2603: 
                   2604:                if(!stricmp(p,"SET_USER_LEVEL")) {
                   2605:                        if(!(*arg)) break;
                   2606: 
                   2607:                        if((l=isvar(arg))!=0) {
                   2608:                                fputc(CS_USE_INT_VAR,out);
                   2609:                                fwrite(&l,4,1,out); // variable
                   2610:                                fputc(1,out);           // int offset
                   2611:                                fputc(1,out);           // int length
                   2612:                                ch=0; }                         // place holder
                   2613:                        else
                   2614:                                ch=val(src,arg);
                   2615: 
                   2616:                        fprintf(out,"%c%c",CS_SET_USER_LEVEL,ch);
                   2617:                        continue; }
                   2618: 
                   2619:                if(!stricmp(p,"SET_USER_STRING")) {
                   2620:                        if(!(*arg)) break;
                   2621: 
                   2622:                        if((l=isvar(arg))!=0) {
                   2623:                                fputc(CS_USE_INT_VAR,out);
                   2624:                                fwrite(&l,4,1,out); // variable
                   2625:                                fputc(1,out);           // int offset
                   2626:                                fputc(1,out);           // int length
                   2627:                                ch=0; }                         // place holder
                   2628:                        else
                   2629:                                ch=val(src,arg);
                   2630: 
                   2631:                        fprintf(out,"%c%c",CS_SET_USER_STRING,ch);
                   2632:                        continue; }
                   2633: 
                   2634: 
                   2635:                if(!stricmp(p,"ADJUST_USER_CREDITS")) {
                   2636:                        if(!(*arg)) break;
                   2637: 
                   2638:                        if((l=isvar(arg))!=0) {
                   2639:                                fputc(CS_USE_INT_VAR,out);
                   2640:                                fwrite(&l,4,1,out); // variable
                   2641:                                fputc(1,out);           // int offset
                   2642:                                fputc(2,out);           // int length
                   2643:                                i=0; }                     // place holder
                   2644:                        else
                   2645:                                i=val(src,arg);
                   2646: 
                   2647:                        fprintf(out,"%c",CS_ADJUST_USER_CREDITS);
                   2648:                        fwrite(&i,2,1,out);
                   2649:                        continue; }
                   2650: 
                   2651:                if(!stricmp(p,"ADJUST_USER_MINUTES")) {
                   2652:                        if(!(*arg)) break;
                   2653: 
                   2654:                        if((l=isvar(arg))!=0) {
                   2655:                                fputc(CS_USE_INT_VAR,out);
                   2656:                                fwrite(&l,4,1,out); // variable
                   2657:                                fputc(1,out);           // int offset
                   2658:                                fputc(2,out);           // int length
                   2659:                                i=0; }                          // place holder
                   2660:                        else
                   2661:                                i=val(src,arg);
                   2662: 
                   2663:                        fprintf(out,"%c",CS_ADJUST_USER_MINUTES);
                   2664:                        fwrite(&i,2,1,out);
                   2665:                        continue; }
                   2666: 
                   2667:                if(!stricmp(p,"SHOW_MEM")) {
                   2668:                        fprintf(out,"%c",CS_SHOW_MEM);
                   2669:                        continue; }
                   2670:                if(!stricmp(p,"GURU_LOG")) {
                   2671:                        fprintf(out,"%c",CS_GURU_LOG);
                   2672:                        continue; }
                   2673:                if(!stricmp(p,"ERROR_LOG")) {
                   2674:                        fprintf(out,"%c",CS_ERROR_LOG);
                   2675:                        continue; }
                   2676:                if(!stricmp(p,"SYSTEM_LOG")) {
                   2677:                        fprintf(out,"%c",CS_SYSTEM_LOG);
                   2678:                        continue; }
                   2679:                if(!stricmp(p,"SYSTEM_YLOG")) {
                   2680:                        fprintf(out,"%c",CS_SYSTEM_YLOG);
                   2681:                        continue; }
                   2682:                if(!stricmp(p,"SYSTEM_STATS")) {
                   2683:                        fprintf(out,"%c",CS_SYSTEM_STATS);
                   2684:                        continue; }
                   2685:                if(!stricmp(p,"NODE_STATS")) {
                   2686:                        fprintf(out,"%c",CS_NODE_STATS);
                   2687:                        continue; }
                   2688:                if(!stricmp(p,"CHANGE_USER")) {
                   2689:                        fprintf(out,"%c",CS_CHANGE_USER);
                   2690:                        continue; }
                   2691:                if(!stricmp(p,"ANSI_CAPTURE")) {
                   2692:                        fprintf(out,"%c",CS_ANSI_CAPTURE);
                   2693:                        continue; }
                   2694:                if(!stricmp(p,"LIST_TEXT_FILE")) {
                   2695:                        fprintf(out,"%c",CS_LIST_TEXT_FILE);
                   2696:                        continue; }
                   2697:                if(!stricmp(p,"EDIT_TEXT_FILE")) {
                   2698:                        fprintf(out,"%c",CS_EDIT_TEXT_FILE);
                   2699:                        continue; }
                   2700: 
                   2701: 
                   2702:                if(!stricmp(p,"COMPARE_KEY")) {
                   2703:                        if(!stricmp(arg,"DIGIT"))
                   2704:                                ch=CS_DIGIT;
                   2705:                        else if(!stricmp(arg,"EDIGIT"))
                   2706:                                ch=CS_EDIGIT;
                   2707:                        else
                   2708:                                ch=toupper(*arg);
                   2709:                        if(ch=='/')
                   2710:                                ch=(*arg)|0x80;   /* high bit indicates slash required */
                   2711:                        else if(ch=='^' && (*(arg+1))>=0x40)
                   2712:                                ch=(*(arg+1))-0x40;   /* ctrl char */
                   2713:                        else if(ch=='\\')
                   2714:                                ch=cesc(*(arg+1));
                   2715:                        else if(ch=='\'')
                   2716:                                ch=*(arg+1);
                   2717:                        fprintf(out,"%c%c",CS_COMPARE_KEY,ch);
                   2718:                        continue; }
                   2719:                if(!stricmp(p,"COMPARE_CHAR")) {
                   2720:                        ch=*arg;
                   2721:                        fprintf(out,"%c%c",CS_COMPARE_CHAR,ch);
                   2722:                        continue; }
                   2723:                if(!stricmp(p,"COMPARE_KEYS")) {
                   2724:                        fputc(CS_COMPARE_KEYS,out);
                   2725:                        for(p=arg;*p && *p!='#';p++) {
                   2726:                                ch=*p;
                   2727:                                if(ch=='"')
                   2728:                                        continue;
                   2729:                                if(ch=='/') {
                   2730:                                        p++;
                   2731:                                        ch=*p|0x80; }  /* high bit indicates slash required */
                   2732:                                else if(ch=='^' && *(p+1)>=0x40) {
                   2733:                                        p++;
                   2734:                                        ch=*p;
                   2735:                                        ch-=0x40; }
                   2736:                                else if(ch=='\\') {
                   2737:                                        p++;
                   2738:                                        ch=cesc(*p); }
                   2739:                                fputc(ch,out); }
                   2740:                        fputc(0,out);
                   2741:                        continue; }
                   2742:                if(!stricmp(p,"GETCMD")) {
                   2743:                        fprintf(out,"%c",CS_GETCMD);
                   2744:                        writecstr(arg);
                   2745:                        continue; }
                   2746:                if(!stricmp(p,"INKEY")) {
                   2747:                        fprintf(out,"%c",CS_INKEY);
                   2748:                        continue; }
                   2749:                if(!stricmp(p,"GETKEY")) {
                   2750:                        fprintf(out,"%c",CS_GETKEY);
                   2751:                        continue; }
                   2752:                if(!stricmp(p,"GETCHAR")) {
                   2753:                        fprintf(out,"%c",CS_GETCHAR);
                   2754:                        continue; }
                   2755:                if(!stricmp(p,"GETKEYE")) {
                   2756:                        fprintf(out,"%c",CS_GETKEYE);
                   2757:                        continue; }
                   2758:                if(!stricmp(p,"UNGETKEY")) {
                   2759:                        fprintf(out,"%c",CS_UNGETKEY);
                   2760:                        continue; }
                   2761:                if(!stricmp(p,"UNGETSTR")) {
                   2762:                        fprintf(out,"%c",CS_UNGETSTR);
                   2763:                        continue; }
                   2764:                if(!stricmp(p,"PRINTKEY")) {
                   2765:                        fprintf(out,"%c",CS_PRINTKEY);
                   2766:                        continue; }
                   2767:                if(!stricmp(p,"PRINTSTR")) {
                   2768:                        fprintf(out,"%c",CS_PRINTSTR);
                   2769:                        continue; }
                   2770: 
                   2771:                /* FUNCTIONS */
                   2772: 
                   2773:                if(!stricmp(p,"NODELIST_ALL")) {
                   2774:                        fprintf(out,"%c",CS_NODELIST_ALL);
                   2775:                        continue; }
                   2776:                if(!stricmp(p,"NODELIST_USERS")) {
                   2777:                        fprintf(out,"%c",CS_NODELIST_USERS);
                   2778:                        continue; }
                   2779: 
                   2780:                if(!stricmp(p,"USERLIST_ALL")) {
                   2781:                        fprintf(out,"%c",CS_USERLIST_ALL);
                   2782:                        continue; }
                   2783:                if(!stricmp(p,"USERLIST_SUB")) {
                   2784:                        fprintf(out,"%c",CS_USERLIST_SUB);
                   2785:                        continue; }
                   2786:                if(!stricmp(p,"USERLIST_DIR")) {
                   2787:                        fprintf(out,"%c",CS_USERLIST_DIR);
                   2788:                        continue; }
                   2789:                if(!stricmp(p,"USERLIST_LOGONS")) {
                   2790:                        fprintf(out,"%c",CS_USERLIST_LOGONS);
                   2791:                        continue; }
                   2792: 
                   2793:                if(!stricmp(p,"HANGUP")) {
                   2794:                        fprintf(out,"%c",CS_HANGUP);
                   2795:                        continue; }
                   2796: 
                   2797:                if(!stricmp(p,"LOGOFF")) {
                   2798:                        fprintf(out,"%c",CS_LOGOFF);
                   2799:                        continue; }
                   2800: 
                   2801:                if(!stricmp(p,"LOGOFF_FAST")) {
                   2802:                        fprintf(out,"%c",CS_LOGOFF_FAST);
                   2803:                        continue; }
                   2804: 
                   2805:                if(!stricmp(p,"AUTO_MESSAGE")) {
                   2806:                        fprintf(out,"%c",CS_AUTO_MESSAGE);
                   2807:                        continue; }
                   2808: 
                   2809:                if(!stricmp(p,"MINUTE_BANK")) {
                   2810:                        fprintf(out,"%c",CS_MINUTE_BANK);
                   2811:                        continue; }
                   2812: 
                   2813:                if(!stricmp(p,"USER_EDIT")) {
                   2814:                        fprintf(out,"%c",CS_USER_EDIT);
                   2815:                        continue; }
                   2816: 
                   2817:                if(!stricmp(p,"USER_DEFAULTS")) {
                   2818:                        fprintf(out,"%c",CS_USER_DEFAULTS);
                   2819:                        continue; }
                   2820: 
                   2821:                if(!stricmp(p,"PAGE_SYSOP")) {
                   2822:                        fprintf(out,"%c",CS_PAGE_SYSOP);
                   2823:                        continue; }
                   2824:                if(!stricmp(p,"PAGE_GURU")) {
                   2825:                        fprintf(out,"%c",CS_PAGE_GURU);
                   2826:                        continue; }
                   2827:                if(!stricmp(p,"SPY")) {
                   2828:                        fprintf(out,"%c",CS_SPY);
                   2829:                        continue; }
                   2830: 
                   2831: 
                   2832:                if(!stricmp(p,"PRIVATE_CHAT")) {
                   2833:                        fprintf(out,"%c",CS_PRIVATE_CHAT);
                   2834:                        continue; }
                   2835: 
                   2836:                if(!stricmp(p,"PRIVATE_MESSAGE")) {
                   2837:                        fprintf(out,"%c",CS_PRIVATE_MESSAGE);
                   2838:                        continue; }
                   2839: 
                   2840:                if(!stricmp(p,"MAIL_READ")) {
                   2841:                        fprintf(out,"%c",CS_MAIL_READ);
                   2842:                        continue; }
                   2843:                if(!stricmp(p,"MAIL_READ_SENT")) {       /* Kill/read sent mail */
                   2844:                        fprintf(out,"%c",CS_MAIL_READ_SENT);
                   2845:                        continue; }
                   2846:                if(!stricmp(p,"MAIL_READ_ALL")) {
                   2847:                        fprintf(out,"%c",CS_MAIL_READ_ALL);
                   2848:                        continue; }
                   2849:                if(!stricmp(p,"MAIL_SEND")) {       /* Send E-mail */
                   2850:                        fprintf(out,"%c",CS_MAIL_SEND);
                   2851:                        continue; }
                   2852:                if(!stricmp(p,"MAIL_SEND_FEEDBACK")) {       /* Feedback */
                   2853:                        fprintf(out,"%c",CS_MAIL_SEND_FEEDBACK);
                   2854:                        continue; }
                   2855:                if(!stricmp(p,"MAIL_SEND_NETMAIL")) {
                   2856:                        fprintf(out,"%c",CS_MAIL_SEND_NETMAIL);
                   2857:                        continue; }
                   2858:                if(!stricmp(p,"MAIL_SEND_NETFILE")) {
                   2859:                        fprintf(out,"%c",CS_MAIL_SEND_NETFILE);
                   2860:                        continue; }
                   2861:                if(!stricmp(p,"MAIL_SEND_FILE")) {   /* Upload Attached File to E-mail */
                   2862:                        fprintf(out,"%c",CS_MAIL_SEND_FILE);
                   2863:                        continue; }
                   2864:                if(!stricmp(p,"MAIL_SEND_BULK")) {
                   2865:                        fprintf(out,"%c",CS_MAIL_SEND_BULK);
                   2866:                        continue; }
                   2867: 
                   2868: 
                   2869:                if(!stricmp(p,"MSG_SET_AREA")) {
                   2870:                        fprintf(out,"%c",CS_MSG_SET_AREA);
                   2871:                        continue; }
                   2872:                if(!stricmp(p,"MSG_SET_GROUP")) {
                   2873:                        fprintf(out,"%c",CS_MSG_SET_GROUP);
                   2874:                        continue; }
                   2875:                if(!stricmp(p,"MSG_SELECT_AREA")) {
                   2876:                        fprintf(out,"%c",CS_MSG_SELECT_AREA);
                   2877:                        continue; }
                   2878:                if(!stricmp(p,"MSG_SHOW_GROUPS")) {
                   2879:                        fprintf(out,"%c",CS_MSG_SHOW_GROUPS);
                   2880:                        continue; }
                   2881:                if(!stricmp(p,"MSG_SHOW_SUBBOARDS")) {
                   2882:                        fprintf(out,"%c",CS_MSG_SHOW_SUBBOARDS);
                   2883:                        continue; }
                   2884:                if(!stricmp(p,"MSG_GROUP_UP")) {
                   2885:                        fprintf(out,"%c",CS_MSG_GROUP_UP);
                   2886:                        continue; }
                   2887:                if(!stricmp(p,"MSG_GROUP_DOWN")) {
                   2888:                        fprintf(out,"%c",CS_MSG_GROUP_DOWN);
                   2889:                        continue; }
                   2890:                if(!stricmp(p,"MSG_SUBBOARD_UP")) {
                   2891:                        fprintf(out,"%c",CS_MSG_SUBBOARD_UP);
                   2892:                        continue; }
                   2893:                if(!stricmp(p,"MSG_SUBBOARD_DOWN")) {
                   2894:                        fprintf(out,"%c",CS_MSG_SUBBOARD_DOWN);
                   2895:                        continue; }
                   2896:                if(!stricmp(p,"MSG_GET_SUB_NUM")) {
                   2897:                        fprintf(out,"%c",CS_MSG_GET_SUB_NUM);
                   2898:                        continue; }
                   2899:                if(!stricmp(p,"MSG_GET_GRP_NUM")) {
                   2900:                        fprintf(out,"%c",CS_MSG_GET_GRP_NUM);
                   2901:                        continue; }
                   2902:                if(!stricmp(p,"MSG_READ")) {
                   2903:                        fprintf(out,"%c",CS_MSG_READ);
                   2904:                        continue; }
                   2905:                if(!stricmp(p,"MSG_POST")) {
                   2906:                        fprintf(out,"%c",CS_MSG_POST);
                   2907:                        continue; }
                   2908:                if(!stricmp(p,"MSG_QWK")) {
                   2909:                        fprintf(out,"%c",CS_MSG_QWK);
                   2910:                        continue; }
                   2911:                if(!stricmp(p,"MSG_PTRS_CFG")) {
                   2912:                        fprintf(out,"%c",CS_MSG_PTRS_CFG);
                   2913:                        continue; }
                   2914:                if(!stricmp(p,"MSG_PTRS_REINIT")) {
                   2915:                        fprintf(out,"%c",CS_MSG_PTRS_REINIT);
                   2916:                        continue; }
                   2917:                if(!stricmp(p,"MSG_NEW_SCAN_CFG")) {
                   2918:                        fprintf(out,"%c",CS_MSG_NEW_SCAN_CFG);
                   2919:                        continue; }
                   2920:                if(!stricmp(p,"MSG_NEW_SCAN")) {
                   2921:                        fprintf(out,"%c",CS_MSG_NEW_SCAN);
                   2922:                        continue; }
                   2923:                if(!stricmp(p,"MSG_NEW_SCAN_SUB")) {
                   2924:                        fprintf(out,"%c",CS_MSG_NEW_SCAN_SUB);
                   2925:                        continue; }
                   2926:                if(!stricmp(p,"MSG_NEW_SCAN_ALL")) {
                   2927:                        fprintf(out,"%c",CS_MSG_NEW_SCAN_ALL);
                   2928:                        continue; }
                   2929:                if(!stricmp(p,"MSG_CONT_SCAN")) {
                   2930:                        fprintf(out,"%c",CS_MSG_CONT_SCAN);
                   2931:                        continue; }
                   2932:                if(!stricmp(p,"MSG_CONT_SCAN_ALL")) {
                   2933:                        fprintf(out,"%c",CS_MSG_CONT_SCAN_ALL);
                   2934:                        continue; }
                   2935:                if(!stricmp(p,"MSG_BROWSE_SCAN")) {
                   2936:                        fprintf(out,"%c",CS_MSG_BROWSE_SCAN);
                   2937:                        continue; }
                   2938:                if(!stricmp(p,"MSG_BROWSE_SCAN_ALL")) {
                   2939:                        fprintf(out,"%c",CS_MSG_BROWSE_SCAN_ALL);
                   2940:                        continue; }
                   2941:                if(!stricmp(p,"MSG_FIND_TEXT")) {
                   2942:                        fprintf(out,"%c",CS_MSG_FIND_TEXT);
                   2943:                        continue; }
                   2944:                if(!stricmp(p,"MSG_FIND_TEXT_ALL")) {
                   2945:                        fprintf(out,"%c",CS_MSG_FIND_TEXT_ALL);
                   2946:                        continue; }
                   2947:                if(!stricmp(p,"MSG_YOUR_SCAN_CFG")) {
                   2948:                        fprintf(out,"%c",CS_MSG_YOUR_SCAN_CFG);
                   2949:                        continue; }
                   2950:                if(!stricmp(p,"MSG_YOUR_SCAN")) {
                   2951:                        fprintf(out,"%c",CS_MSG_YOUR_SCAN);
                   2952:                        continue; }
                   2953:                if(!stricmp(p,"MSG_YOUR_SCAN_ALL")) {
                   2954:                        fprintf(out,"%c",CS_MSG_YOUR_SCAN_ALL);
                   2955:                        continue; }
                   2956:                if(!stricmp(p,"CHAT_SECTION")) {
                   2957:                        fprintf(out,"%c",CS_CHAT_SECTION);
                   2958:                        continue; }
                   2959:                if(!stricmp(p,"TEXT_FILE_SECTION")) {
                   2960:                        fprintf(out,"%c",CS_TEXT_FILE_SECTION);
                   2961:                        continue; }
                   2962:                if(!stricmp(p,"XTRN_EXEC")) {
                   2963:                        fprintf(out,"%c",CS_XTRN_EXEC);
                   2964:                        continue; }
                   2965:                if(!stricmp(p,"XTRN_SECTION")) {
                   2966:                        fprintf(out,"%c",CS_XTRN_SECTION);
                   2967:                        continue; }
                   2968: 
                   2969:                if(!stricmp(p,"FILE_SET_AREA")) {
                   2970:                        fprintf(out,"%c",CS_FILE_SET_AREA);
                   2971:                        continue; }
                   2972:                if(!stricmp(p,"FILE_SET_LIBRARY")) {
                   2973:                        fprintf(out,"%c",CS_FILE_SET_LIBRARY);
                   2974:                        continue; }
                   2975:                if(!stricmp(p,"FILE_SELECT_AREA")) {
                   2976:                        fprintf(out,"%c",CS_FILE_SELECT_AREA);
                   2977:                        continue; }
                   2978:                if(!stricmp(p,"FILE_SHOW_LIBRARIES")) {
                   2979:                        fprintf(out,"%c",CS_FILE_SHOW_LIBRARIES);
                   2980:                        continue; }
                   2981:                if(!stricmp(p,"FILE_SHOW_DIRECTORIES")) {
                   2982:                        fprintf(out,"%c",CS_FILE_SHOW_DIRECTORIES);
                   2983:                        continue; }
                   2984:                if(!stricmp(p,"FILE_LIBRARY_UP")) {
                   2985:                        fprintf(out,"%c",CS_FILE_LIBRARY_UP);
                   2986:                        continue; }
                   2987:                if(!stricmp(p,"FILE_LIBRARY_DOWN")) {
                   2988:                        fprintf(out,"%c",CS_FILE_LIBRARY_DOWN);
                   2989:                        continue; }
                   2990:                if(!stricmp(p,"FILE_DIRECTORY_UP")) {
                   2991:                        fprintf(out,"%c",CS_FILE_DIRECTORY_UP);
                   2992:                        continue; }
                   2993:                if(!stricmp(p,"FILE_DIRECTORY_DOWN")) {
                   2994:                        fprintf(out,"%c",CS_FILE_DIRECTORY_DOWN);
                   2995:                        continue; }
                   2996:                if(!stricmp(p,"FILE_GET_DIR_NUM")) {
                   2997:                        fprintf(out,"%c",CS_FILE_GET_DIR_NUM);
                   2998:                        continue; }
                   2999:                if(!stricmp(p,"FILE_GET_LIB_NUM")) {
                   3000:                        fprintf(out,"%c",CS_FILE_GET_LIB_NUM);
                   3001:                        continue; }
                   3002:                if(!stricmp(p,"FILE_UPLOAD")) {
                   3003:                        fprintf(out,"%c",CS_FILE_UPLOAD);
                   3004:                        continue; }
                   3005:                if(!stricmp(p,"FILE_UPLOAD_USER")) {
                   3006:                        fprintf(out,"%c",CS_FILE_UPLOAD_USER);
                   3007:                        continue; }
                   3008:                if(!stricmp(p,"FILE_UPLOAD_BULK")) {
                   3009:                        fprintf(out,"%c",CS_FILE_UPLOAD_BULK);
                   3010:                        continue; }
                   3011:                if(!stricmp(p,"FILE_UPLOAD_SYSOP")) {
                   3012:                        fprintf(out,"%c",CS_FILE_UPLOAD_SYSOP);
                   3013:                        continue; }
                   3014:                if(!stricmp(p,"FILE_RESORT_DIRECTORY")) {
                   3015:                        fprintf(out,"%c",CS_FILE_RESORT_DIRECTORY);
                   3016:                        continue; }
                   3017:                if(!stricmp(p,"FILE_SET_ALT_PATH")) {
                   3018:                        fprintf(out,"%c",CS_FILE_SET_ALT_PATH);
                   3019:                        continue; }
                   3020:                if(!stricmp(p,"FILE_GET")) {
                   3021:                        fprintf(out,"%c",CS_FILE_GET);
                   3022:                        continue; }
                   3023:                if(!stricmp(p,"FILE_SEND")) {
                   3024:                        fprintf(out,"%c",CS_FILE_SEND);
                   3025:                        continue; }
                   3026:                if(!stricmp(p,"FILE_PUT")) {
                   3027:                        fprintf(out,"%c",CS_FILE_PUT);
                   3028:                        continue; }
                   3029:                if(!stricmp(p,"FILE_FIND_OLD")) {
                   3030:                        fprintf(out,"%c",CS_FILE_FIND_OLD);
                   3031:                        continue; }
                   3032:                if(!stricmp(p,"FILE_FIND_OPEN")) {
                   3033:                        fprintf(out,"%c",CS_FILE_FIND_OPEN);
                   3034:                        continue; }
                   3035:                if(!stricmp(p,"FILE_FIND_OFFLINE")) {
                   3036:                        fprintf(out,"%c",CS_FILE_FIND_OFFLINE);
                   3037:                        continue; }
                   3038:                if(!stricmp(p,"FILE_FIND_OLD_UPLOADS")) {
                   3039:                        fprintf(out,"%c",CS_FILE_FIND_OLD_UPLOADS);
                   3040:                        continue; }
                   3041:                if(!stricmp(p,"FILE_DOWNLOAD")) {
                   3042:                        fprintf(out,"%c",CS_FILE_DOWNLOAD);
                   3043:                        continue; }
                   3044:                if(!stricmp(p,"FILE_DOWNLOAD_USER")) {
                   3045:                        fprintf(out,"%c",CS_FILE_DOWNLOAD_USER);
                   3046:                        continue; }
                   3047:                if(!stricmp(p,"FILE_DOWNLOAD_BATCH")) {
                   3048:                        fprintf(out,"%c",CS_FILE_DOWNLOAD_BATCH);
                   3049:                        continue; }
                   3050:                if(!stricmp(p,"FILE_REMOVE")) {
                   3051:                        fprintf(out,"%c",CS_FILE_REMOVE);
                   3052:                        continue; }
                   3053:                if(!stricmp(p,"FILE_LIST")) {
                   3054:                        fprintf(out,"%c",CS_FILE_LIST);
                   3055:                        continue; }
                   3056:                if(!stricmp(p,"FILE_LIST_EXTENDED")) {
                   3057:                        fprintf(out,"%c",CS_FILE_LIST_EXTENDED);
                   3058:                        continue; }
                   3059:                if(!stricmp(p,"FILE_VIEW")) {
                   3060:                        fprintf(out,"%c",CS_FILE_VIEW);
                   3061:                        continue; }
                   3062:                if(!stricmp(p,"FILE_FIND_TEXT")) {
                   3063:                        fprintf(out,"%c",CS_FILE_FIND_TEXT);
                   3064:                        continue; }
                   3065:                if(!stricmp(p,"FILE_FIND_TEXT_ALL")) {
                   3066:                        fprintf(out,"%c",CS_FILE_FIND_TEXT_ALL);
                   3067:                        continue; }
                   3068:                if(!stricmp(p,"FILE_FIND_NAME")) {
                   3069:                        fprintf(out,"%c",CS_FILE_FIND_NAME);
                   3070:                        continue; }
                   3071:                if(!stricmp(p,"FILE_FIND_NAME_ALL")) {
                   3072:                        fprintf(out,"%c",CS_FILE_FIND_NAME_ALL);
                   3073:                        continue; }
                   3074:                if(!stricmp(p,"FILE_BATCH_SECTION")) {
                   3075:                        fprintf(out,"%c",CS_FILE_BATCH_SECTION);
                   3076:                        continue; }
                   3077:                if(!stricmp(p,"FILE_TEMP_SECTION")) {
                   3078:                        fprintf(out,"%c",CS_FILE_TEMP_SECTION);
                   3079:                        continue; }
                   3080:                if(!stricmp(p,"FILE_NEW_SCAN")) {
                   3081:                        fprintf(out,"%c",CS_FILE_NEW_SCAN);
                   3082:                        continue; }
                   3083:                if(!stricmp(p,"FILE_NEW_SCAN_ALL")) {
                   3084:                        fprintf(out,"%c",CS_FILE_NEW_SCAN_ALL);
                   3085:                        continue; }
                   3086:                if(!stricmp(p,"FILE_NEW_SCAN_CFG")) {
                   3087:                        fprintf(out,"%c",CS_FILE_NEW_SCAN_CFG);
                   3088:                        continue; }
                   3089:                if(!stricmp(p,"FILE_PTRS_CFG")) {
                   3090:                        fprintf(out,"%c",CS_FILE_PTRS_CFG);
                   3091:                        continue; }
                   3092:                if(!stricmp(p,"FILE_BATCH_ADD")) {
                   3093:                        fprintf(out,"%c",CS_FILE_BATCH_ADD);
                   3094:                        continue; }
                   3095:                if(!stricmp(p,"FILE_BATCH_ADD_LIST")) {
                   3096:                        fprintf(out,"%c",CS_FILE_BATCH_ADD_LIST);
                   3097:                        continue; }
                   3098:                if(!stricmp(p,"FILE_BATCH_CLEAR")) {
                   3099:                        fprintf(out,"%c",CS_FILE_BATCH_CLEAR);
                   3100:                        continue; }
                   3101: 
                   3102:                if(!stricmp(p,"INC_MAIN_CMDS")) {
                   3103:                        fprintf(out,"%c",CS_INC_MAIN_CMDS);
                   3104:                        continue; }
                   3105:                if(!stricmp(p,"INC_FILE_CMDS")) {
                   3106:                        fprintf(out,"%c",CS_INC_FILE_CMDS);
                   3107:                        continue; }
                   3108: 
                   3109:                break; }
                   3110: 
                   3111: 
                   3112:        if(!feof(in)) {
                   3113:                printf("SYNTAX ERROR:\n");
                   3114:                printf(linestr,src,line,save);
                   3115:                exit(1); }
                   3116:        fclose(in);
                   3117:        free(str);
                   3118:        free(save);
                   3119: }
                   3120: 
                   3121: char *banner=  "\n"
                   3122:                                "BAJA v2.20 - Synchronet Shell/Module Compiler - "
                   3123:                                "Copyright 2000 Rob Swindell\n";
                   3124: 
                   3125: char *usage=   "\n"
                   3126:                                "usage: baja [/opts] file[.src]\n"
                   3127:                                "\n"
                   3128:                                " opts: /d display debug during compile\n"
                   3129:                                "       /c case sensitive variables, labels, and macros\n"
                   3130:                                "       /o set output directory (e.g. /o/sbbs/exec)\n"
                   3131:                                "       /q quiet mode (no banner)\n"
                   3132:                                ;
                   3133: 
                   3134: int main(int argc, char **argv)
                   3135: {
                   3136:        uchar str[128],src[128]="",*p,outdir[128]="",outfname[128]="";
                   3137:        int i,j;
                   3138:        int show_banner=1;
                   3139: 
                   3140:        for(i=1;i<argc;i++)
                   3141:                if(argv[i][0]=='/')
                   3142:                        switch(toupper(argv[i][1])) {
                   3143:                                case 'D':
                   3144:                                        display=1;
                   3145:                                        break;
                   3146:                                case 'C':
                   3147:                                        case_sens=1;
                   3148:                                        break;
                   3149:                                case 'O':
                   3150:                                        strcpy(outdir,argv[i]+2);
                   3151:                                        break;
                   3152:                                case 'Q':
                   3153:                                        show_banner=0;
                   3154:                                        break;
                   3155:                                default:
                   3156:                                        printf(banner);
                   3157:                                        printf(usage);
                   3158:                                        exit(1); }
                   3159:                else
                   3160:                        strcpy(src,argv[i]);
                   3161: 
                   3162:        if(show_banner)
                   3163:                printf(banner);
                   3164: 
                   3165:        if(!src[0]) {
                   3166:                printf(usage);
                   3167:                exit(1); }
                   3168: 
                   3169:        strcpy(str,src);
                   3170:        if(!strchr(str,'.'))
                   3171:                sprintf(src,"%s.src",str);
                   3172: 
                   3173:        strcpy(str,src);
                   3174:        p=strrchr(str,'.');
                   3175:        if(p)
                   3176:                *p=0;
                   3177:        strcat(str,".bin");
                   3178: 
                   3179:        if(outdir[0]) {
                   3180:                p=strrchr(str,'\\');
                   3181:                if(!p)
                   3182:                        p=strrchr(str,':');
                   3183:                if(p)
                   3184:                        strcpy(outfname,p+1);
                   3185:                else
                   3186:                        strcpy(outfname,str);
                   3187:                if(outdir[strlen(outdir)-1]!='\\'
                   3188:                        && outdir[strlen(outdir)-1]!=':')
                   3189:                        strcat(outdir,"\\");
                   3190:                sprintf(str,"%s%s",outdir,outfname); }
                   3191: 
                   3192:        if((out=fopen(str,"wb"))==NULL) {
                   3193:                printf("error opening %s for write\n",str);
                   3194:                exit(1); }
                   3195: 
                   3196:        atexit(bail);
                   3197: 
                   3198:        printf("\nCompiling %s...\n",src);
                   3199: 
                   3200:        compile(src);
                   3201: 
                   3202:        /****************************/
                   3203:        /* Resolve GOTOS and CALLS */
                   3204:        /****************************/
                   3205: 
                   3206:        printf("Resolving labels...\n");
                   3207: 
                   3208:        for(i=0;i<gotos;i++) {
                   3209:                for(j=0;j<labels;j++)
                   3210:                        if(!stricmp(goto_label[i],label_name[j]))
                   3211:                                break;
                   3212:                if(j>=labels) {
                   3213:                        printf("%s line %d: label (%s) not found.\n"
                   3214:                                ,goto_file[i],goto_line[i],goto_label[i]);
                   3215:                        exit(1); }
                   3216:                fseek(out,(long)(goto_indx[i]+1),SEEK_SET);
                   3217:                fwrite(&label_indx[j],2,1,out); }
                   3218: 
                   3219:        for(i=0;i<calls;i++) {
                   3220:                for(j=0;j<labels;j++)
                   3221:                        if((!case_sens
                   3222:                                && !strnicmp(call_label[i],label_name[j],strlen(call_label[i])))
                   3223:                        || (case_sens
                   3224:                                && !strncmp(call_label[i],label_name[j],strlen(call_label[i]))))
                   3225:                                break;
                   3226:                if(j>=labels) {
                   3227:                        printf("%s line %d: label (%s) not found.\n"
                   3228:                                ,call_file[i],call_line[i],call_label[i]);
                   3229:                        exit(1); }
                   3230:                fseek(out,(long)(call_indx[i]+1),SEEK_SET);
                   3231:                fwrite(&label_indx[j],2,1,out); }
                   3232: 
                   3233:        fclose(out);
                   3234:        out=NULL; /* so bail() won't truncate */
                   3235: 
                   3236:        printf("\nDone.\n");
                   3237:        return(0);
                   3238: }
                   3239: 
                   3240: 
                   3241: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.