OPTION STRICT ACLS KEY 1, "class " KEY 2, "def " KEY 3, "public " KEY 4, "void " KEY 5, "end " VAR ORIG_LEN=17,TRIGGERED%=FALSE,TOSWITCH$,CNAME$,INCLASS% VAR INOCLASS%,PRIVNAME$="priv"+STR$(RND(900000)+100000) VAR SKPNUM%=0 DIM STRFUNCTS$[ORIG_LEN],TOREPL$[ORIG_LEN] DIM GLOBALS$[0],GTOREPL$[0],TEMP$[0],TEMP2$[0] DIM END$[0],OBJECTS$[0],FUNCTS$[0],IMPS$[0] DIM OPS$[10],OTOREPL$[LEN(OPS$)] PARSE INS_FUNCS CLS PRINT "Compilation to slot 1 complete. Type RUN 1 to run" PRINT "or SAVE"+CHR$(34)+"PRG1:PRGNAME"+CHR$(34)+" to save." ??? DEF PARSE VAR I%,J%,BLINE$,INFUNCT%,DEBUGLN$ DIM LINE$[100] RESTORE @REPLACE FOR I%=0 TO LEN(STRFUNCTS$)-1 READ STRFUNCTS$[I%] NEXT RESTORE @TOREPL FOR I%=0 TO LEN(TOREPL$)-1 READ TOREPL$[I%] NEXT RESTORE @OPS FOR I%=0 TO LEN(OPS$)-1 READ OPS$[I%] NEXT RESTORE @OTOREPL FOR I%=0 TO LEN(OTOREPL$)-1 READ OTOREPL$[I%] NEXT TOREPL$[12]=TOREPL$[12]+CHR$(34) OTOREPL$[1]=OTOREPL$[1]+CHR$(34) OTOREPL$[2]=CHR$(34)+OTOREPL$[2] OTOREPL$[5]=CHR$(34)+PRIVNAME$+CHR$(34)+"+str(" OTOREPL$[7]=")+"+CHR$(34)+PRIVNAME$+CHR$(34)+"+str(" OTOREPL$[8]=CHR$(34) OTOREPL$[9]=CHR$(34) FOR I%=1 TO PRGSIZE(0) PRGEDIT 0,I% DEBUGLN$=PRGGET$() DEBUGLN$=LEFT$(DEBUGLN$,LEN(DEBUGLN$)-1) IF LEFT$(DEBUGLN$,3)=="use" && !INARRAY(BETWQUOTES$(DEBUGLN$),IMPS$) THEN LOAD "PRG2:"+BETWQUOTES$(DEBUGLN$)+".LIB",0 PUSH IMPS$,BETWQUOTES$(DEBUGLN$) VAR TEMP%=PRGSIZE(2) FOR J%=1 TO TEMP% PRGEDIT 2,1 DEBUGLN$=PRGGET$() PRGDEL 1 DEBUGLN$=LEFT$(DEBUGLN$,LEN(DEBUGLN$)-1) PRGEDIT 0,J% PRGINS DEBUGLN$ NEXT ENDIF NEXT PRGEDIT 3 PRGDEL -1 PRGEDIT 1 PRGDEL -1 PRGINS "OPTION STRICT"+CHR$(10)+"VAR I__%=0" FOR I%=1 TO PRGSIZE(0) CLS ?"Compiling line "+STR$(I%)+"/"+STR$(PRGSIZE(0)) PRGEDIT 0,I% DEBUGLN$=PRGGET$() DEBUGLN$=LEFT$(DEBUGLN$,LEN(DEBUGLN$)-1) LINE$=SPLIT$(REMSPACES$(DEBUGLN$)," ") IF REMENDSPACES$(REMSPACES$(DEBUGLN$))=="end" && LEN(END$)==1 THEN PRGEDIT 1,-1 PRGINS POP(END$) PRGEDIT 0,I% INFUNCT%=FALSE CLEARVARS ENDIF IF REMENDSPACES$(REMSPACES$(DEBUGLN$))=="end static" THEN VAR N% FOR N%=0 TO LEN(GLOBALS$)-1 IF ((LEN(GTOREPL$[N%])>10 && MID$(GTOREPL$[N%],LEN(CNAME$)+1,10)!=PRIVNAME$) || LEN(GTOREPL$[N%])<11) && LEFT$(GLOBALS$[N%],5)!="this." THEN PUSH TEMP$,GTOREPL$[N%] PUSH TEMP2$,GLOBALS$[N%] ENDIF NEXT GTOREPL$=TEMP$ GLOBALS$=TEMP2$ TEMP$=EMPTY$() TEMP2$=EMPTY$() FOR N%=0 TO LEN(GLOBALS$)-1 IF LEN(SPLIT$(GLOBALS$[N%],"."))==1 THEN GLOBALS$[N%]=CNAME$+"."+GLOBALS$[N%] ENDIF NEXT CNAME$="" INCLASS%=FALSE ENDIF IF REMENDSPACES$(REMSPACES$(DEBUGLN$))=="end class" THEN FOR N%=0 TO LEN(GLOBALS$)-1 IF (LEN(GTOREPL$[N%])>10 && MID$(GTOREPL$[N%],LEN(CNAME$)+1,10)!=PRIVNAME$) || LEN(GTOREPL$[N%])<11 THEN PUSH TEMP$,GTOREPL$[N%] PUSH TEMP2$,GLOBALS$[N%] ENDIF NEXT GTOREPL$=TEMP$ GLOBALS$=TEMP2$ TEMP$=EMPTY$() TEMP2$=EMPTY$() FOR N%=0 TO LEN(GLOBALS$)-1 IF LEN(SPLIT$(GLOBALS$[N%],"."))==1 THEN GLOBALS$[N%]=CNAME$+"."+GLOBALS$[N%] ENDIF NEXT CNAME$="" INOCLASS%=FALSE ENDIF IF REMENDSPACES$(REMSPACES$(DEBUGLN$))!="end static" && REMENDSPACES$(REMSPACES$(DEBUGLN$))!="end class" && REMENDSPACES$(REMSPACES$(DEBUGLN$))!="end" && LINE$[0]!="static" && LINE$[0]!="class" && !ISBLANK(LINE$) && INFUNCT%==FALSE && LEFT$(REMSPACES$(DEBUGLN$),1)!="'" THEN P_DEF DEBUGLN$,LINE$,I% OUT INFUNCT%,BLINE$ IF INFUNCT% THEN PUSH END$,"END" ELSEIF REMENDSPACES$(REMSPACES$(DEBUGLN$))!="end" && LINE$[0]=="static" && LINE$[1]=="class" && INFUNCT%==FALSE THEN CNAME$=LINE$[2] INCLASS%=TRUE ELSEIF REMENDSPACES$(REMSPACES$(DEBUGLN$))!="end" && LINE$[0]=="class" && INFUNCT%==FALSE THEN CNAME$=LINE$[1] INOCLASS%=TRUE ELSEIF INFUNCT% THEN BLINE$=P_LINE(DEBUGLN$,I%,BLINE$) INC I%,SKPNUM% SKPNUM%=0 ENDIF PRGEDIT 1,-1 IF BLINE$!="" THEN PRGINS BLINE$ BLINE$="" NEXT TEMP%=PRGSIZE(0) IF LEN(IMPS$)>0 THEN PRGEDIT 0,1 FOR I%=0 TO TEMP% PRGEDIT 0,1 IF LEFT$(PRGGET$(),3)!="use" THEN PRGDEL 1 ELSE BREAK NEXT ENDIF PRGEDIT 1,-1 PRGSET "ENTRY_MAIN_" END DEF P_LINE(DEBUGLN$,I%,BLINE$) DEBUGLN$=REMSPACES$(DEBUGLN$) VAR LINNUM%=I% IF LEFT$(REMSPACES$(DEBUGLN$),4)=="[SB]" THEN RETURN RIGHT$(DEBUGLN$,LEN(DEBUGLN$)-4) IF REMENDSPACES$(DEBUGLN$)=="end" THEN RETURN POP(END$) IF DEBUGLN$=="" THEN RETURN "" DIM LINE$[100] LINE$=SPLIT$(DEBUGLN$," ") IF LINE$[0]=="string"||LINE$[0]=="int"||LINE$[0]=="float"||LINE$[0]=="object"||LINE$[0]=="int[]"||LINE$[0]=="string[]"||LINE$[0]=="float[]"||LINE$[0]=="lazy" THEN DIM ARGS$[20] ARGS$=SEPELEM$(RIGHT$(DEBUGLN$,LEN(DEBUGLN$)-LEN(LINE$[0])-1)) BLINE$="VAR " FOR I%=0 TO LEN(ARGS$)-1 BLINE$=BLINE$+REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]) IF LINE$[0]=="string" THEN BLINE$=BLINE$+"$" PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"$" ENDIF IF LINE$[0]=="int" THEN BLINE$=BLINE$+"%" PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"%" ENDIF IF LINE$[0]=="float" THEN BLINE$=BLINE$+"#" PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"#" ENDIF IF LINE$[0]=="lazy" THEN PUSH STRFUNCTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]) PUSH TOREPL$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])+"()" PUSH OBJECTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]) BLINE$="LAMBDA___ "+CHR$(34)+REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])+"("+P_DEFPAREN$(BETWPAREN$(DEBUGLN$),"")+")"+CHR$(34)+"," BLINE$=BLINE$+CHR$(34)+"RETURN "+FIXLAM$(STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"=")[1]))+CHR$(34) ENDIF IF LINE$[0]=="object"&&LEN(SPLIT$(DEBUGLN$,"<-"))==1 THEN IF LEN(SPLIT$(DEBUGLN$,"->"))==1 THEN BLINE$="ASSIGN___ "+CHR$(34)+REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])+CHR$(34)+"," IF LEN(SPLIT$(ARGS$[I%],"="))==2 THEN BLINE$=BLINE$+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[1])) ELSE BLINE$=BLINE$+"0" PUSH STRFUNCTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]) PUSH TOREPL$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])+"()" PUSH OBJECTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]) ELSE PUSH STRFUNCTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]) PUSH TOREPL$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]) PUSH OBJECTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]) BLINE$="LAMBDA___ "+CHR$(34)+REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])+"("+P_DEFPAREN$(BETWPAREN$(DEBUGLN$),"")+")"+CHR$(34)+"," BLINE$=BLINE$+CHR$(34)+FIXLAM$(P_LINE(SPLIT$(DEBUGLN$,"->")[1],I%,"")) VAR LINUM% FOR LINUM%=LINNUM%+1 TO PRGSIZE(0) PRGEDIT 0,LINUM% VAR LTMP$=PRGGET$() LTMP$=LEFT$(LTMP$,LEN(LTMP$)-1) IF REMSPACES$(REMENDSPACES$(LTMP$))=="end lambda" THEN BREAK BLINE$=BLINE$+":"+FIXLAM$(P_LINE(REMSPACES$(LTMP$),LINUM%,"")) NEXT BLINE$=BLINE$+CHR$(34) SKPNUM%=LINUM%-LINNUM% ENDIF ENDIF IF LINE$[0]=="object"&&LEN(SPLIT$(DEBUGLN$,"<-"))!=1 THEN BLINE$="ASSIGN___ "+CHR$(34)+REMENDSPACES$(SPLIT$(ARGS$[I%],"<-")[0])+CHR$(34)+"," IF LEN(SPLIT$(DEBUGLN$,"="))>1 THEN BLINE$=BLINE$+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"=")[1]) ELSE BLINE$=BLINE$+"0" PUSH STRFUNCTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"<-")[0]) PUSH TOREPL$,REMENDSPACES$(SPLIT$(ARGS$[I%],"<-")[0])+"()" PUSH OBJECTS$,REMENDSPACES$(SPLIT$(ARGS$[I%],"<-")[0]) INIT_OBJ REMENDSPACES$(REMSPACES$(SPLIT$(SPLIT$(DEBUGLN$,"<-")[1],"=")[0])),REMENDSPACES$(SPLIT$(ARGS$[I%],"<-")[0]) ENDIF IF LINE$[0]=="string[]" THEN BLINE$=BLINE$+"$["+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[1])) PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"$" ENDIF IF LINE$[0]=="int[]" THEN BLINE$=BLINE$+"%["+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[1])) PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"%" ENDIF IF LINE$[0]=="float[]" THEN BLINE$=BLINE$+"#["+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[1])) PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"#" ENDIF IF LINE$[0]!="object"&&LINE$[0]!="lazy" THEN BLINE$=BLINE$+STRAIGHTPARSE$(RIGHT$(ARGS$[I%],LEN(ARGS$[I%])-LEN(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])))) IF I%!=LEN(ARGS$)-1 THEN BLINE$=BLINE$+"," ENDIF NEXT ELSEIF RIGHT$(REMENDSPACES$(DEBUGLN$),2)=="++" && LEN(SPLIT$(DEBUGLN$,"->"))==1 THEN IF INARRAY(LEFT$(DEBUGLN$,LEN(DEBUGLN$)-2),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+LEFT$(DEBUGLN$,LEN(DEBUGLN$)-2)+CHR$(34)+","+LEFT$(DEBUGLN$,LEN(DEBUGLN$)-2)+"()+1" ELSE BLINE$="INC "+STRAIGHTPARSE$(LEFT$(DEBUGLN$,LEN(REMENDSPACES$(DEBUGLN$))-2)) ENDIF ELSEIF RIGHT$(REMENDSPACES$(DEBUGLN$),2)=="--" && LEN(SPLIT$(DEBUGLN$,"->"))==1 THEN IF INARRAY(LEFT$(DEBUGLN$,LEN(DEBUGLN$)-2),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+LEFT$(DEBUGLN$,LEN(DEBUGLN$)-2)+CHR$(34)+","+LEFT$(DEBUGLN$,LEN(DEBUGLN$)-2)+"()-1" ELSE BLINE$="DEC "+STRAIGHTPARSE$(LEFT$(DEBUGLN$,LEN(REMENDSPACES$(DEBUGLN$))-2)) ENDIF ELSEIF LEN(SPLIT$(DEBUGLN$,"+="))==2 && LEFT$(LINE$[0],3)!="for" THEN IF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,"+=")[0]),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"+=")[0])+CHR$(34)+","+REMENDSPACES$(SPLIT$(DEBUGLN$,"+=")[0])+"()+"+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"+=")[1]) ELSE BLINE$=STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"+=")[0])+"="+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"+=")[0])+"+("+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"+=")[1])+")" ENDIF ELSEIF LEN(SPLIT$(DEBUGLN$,"-="))==2 && LEFT$(LINE$[0],3)!="for" THEN IF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,"-=")[0]),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"-=")[0])+CHR$(34)+","+REMENDSPACES$(SPLIT$(DEBUGLN$,"-=")[0])+"()-"+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"-=")[1]) ELSE BLINE$=STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"-=")[0])+"="+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"-=")[0])+"-("+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"-=")[1])+")" ENDIF ELSEIF LEN(SPLIT$(DEBUGLN$,"*="))==2 && LEFT$(LINE$[0],3)!="for" THEN IF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,"*=")[0]),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"*=")[0])+CHR$(34)+","+REMENDSPACES$(SPLIT$(DEBUGLN$,"*=")[0])+"()*"+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"*=")[1]) ELSE BLINE$=STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"*=")[0])+"="+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"*=")[0])+"*("+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"*=")[1])+")" ENDIF ELSEIF LEN(SPLIT$(DEBUGLN$,"/="))==2 && LEFT$(LINE$[0],3)!="for" THEN IF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,"/=")[0]),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"/=")[0])+CHR$(34)+","+REMENDSPACES$(SPLIT$(DEBUGLN$,"/=")[0])+"()/"+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"/=")[1]) ELSE BLINE$=STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"/=")[0])+"="+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"/=")[0])+"/("+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"/=")[1])+")" ENDIF ELSEIF LEN(SPLIT$(DEBUGLN$,"%="))==2 && LEFT$(LINE$[0],3)!="for" THEN IF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,"%=")[0]),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"%=")[0])+CHR$(34)+","+REMENDSPACES$(SPLIT$(DEBUGLN$,"%=")[0])+"() MOD "+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"%=")[1]) ELSE BLINE$=STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"%=")[0])+"="+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"%=")[0])+" MOD ("+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"%=")[1])+")" ENDIF ELSEIF LEN(SPLIT$(DEBUGLN$,"<<="))==2 && LEFT$(LINE$[0],3)!="for" THEN IF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,"<<=")[0]),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"<<=")[0])+CHR$(34)+","+REMENDSPACES$(SPLIT$(DEBUGLN$,"<<=")[0])+"()<<"+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"<<=")[1]) ELSE BLINE$=STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"<<=")[0])+"="+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"<<=")[0])+"<<("+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,"<<=")[1])+")" ENDIF ELSEIF LEN(SPLIT$(DEBUGLN$,">>="))==2 && LEFT$(LINE$[0],3)!="for" THEN IF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,">>=")[0]),OBJECTS$) THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,">>=")[0])+CHR$(34)+","+REMENDSPACES$(SPLIT$(DEBUGLN$,">>=")[0])+"()>>"+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,">>=")[1]) ELSE BLINE$=STRAIGHTPARSE$(SPLIT$(DEBUGLN$,">>=")[0])+"="+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,">>=")[0])+">>("+STRAIGHTPARSE$(SPLIT$(DEBUGLN$,">>=")[1])+")" ENDIF ELSEIF LEFT$(LINE$[0],2)=="if" THEN BLINE$="IF "+STRAIGHTPARSE$(BETWPAREN$(DEBUGLN$))+" THEN" PUSH END$,"ENDIF" ELSEIF LEFT$(LINE$[0],4)=="elif" THEN BLINE$="ELSEIF "+STRAIGHTPARSE$(BETWPAREN$(DEBUGLN$))+" THEN" ELSEIF LEFT$(LINE$[0],7)=="foreach" THEN PRGEDIT 1,-1 PRGINS "FOR I__%=0 TO LEN("+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(BETWPAREN$(DEBUGLN$)," in ")[1]))+")-1" PRGINS P_LINE(SPLIT$(BETWPAREN$(DEBUGLN$)," in ")[0],I%,BLINE$)+"="+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(BETWPAREN$(DEBUGLN$)," in ")[1]))+"[I__%]" PUSH END$,"NEXT" ELSEIF LEFT$(LINE$[0],3)=="for" THEN PRGEDIT 1,-1 PRGINS P_LINE(SPLIT$(BETWPAREN$(DEBUGLN$),";")[0],I%,BLINE$) PRGINS "WHILE "+STRAIGHTPARSE$(SPLIT$(BETWPAREN$(DEBUGLN$),";")[1]) PUSH END$,P_LINE(SPLIT$(BETWPAREN$(DEBUGLN$),";")[2],I%,BLINE$)+CHR$(10)+"WEND" ELSEIF LEFT$(LINE$[0],5)=="while" THEN BLINE$="WHILE "+STRAIGHTPARSE$(BETWPAREN$(DEBUGLN$)) PUSH END$,"WEND" ELSEIF LEFT$(LINE$[0],7)=="dowhile" THEN BLINE$="REPEAT" PUSH END$,"UNTIL !("+STRAIGHTPARSE$(BETWPAREN$(DEBUGLN$))+")" ELSEIF LEFT$(LINE$[0],6)=="switch" THEN BLINE$="SWITCH "+STRAIGHTPARSE$(BETWPAREN$(DEBUGLN$))+":IF 0 THEN" PUSH END$,"ENDIF:ENDSW" ELSEIF LINE$[0]=="case" THEN BLINE$="ELSEIF CASE("+STRAIGHTPARSE$(RIGHT$(DEBUGLN$,LEN(DEBUGLN$)-5))+") THEN" ELSEIF LINE$[0]=="default" THEN BLINE$="ELSE" ELSEIF INARRAY(REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0]),OBJECTS$) THEN IF LEN(SPLIT$(DEBUGLN$,"->"))==1 THEN BLINE$="ASSIGN__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0])+CHR$(34)+","+STRAIGHTPARSE$(REMENDSPACES$(RIGHT$(DEBUGLN$,LEN(DEBUGLN$)-LEN(SPLIT$(DEBUGLN$,"=")[0])-1))) TOREPL$[INARR(STRFUNCTS$,REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0]))]=TOREPL$[INARR(STRFUNCTS$,REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0]))]+("()"*(LEN(SPLIT$(TOREPL$[INARR(STRFUNCTS$,REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0]))],"("))==1)) ELSE BLINE$="LAMBDA__ "+CHR$(34)+REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0])+"("+P_DEFPAREN$(BETWPAREN$(DEBUGLN$),"")+")"+CHR$(34)+"," BLINE$=BLINE$+CHR$(34)+FIXLAM$(P_LINE(SPLIT$(DEBUGLN$,"->")[1],I%,"")) VAR TTMP$=TOREPL$[INARR(STRFUNCTS$,REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0]))] TOREPL$[INARR(STRFUNCTS$,REMENDSPACES$(SPLIT$(DEBUGLN$,"=")[0]))]=SPLIT$(TTMP$,"(")[0] FOR LINUM%=LINNUM%+1 TO PRGSIZE(0) PRGEDIT 0,LINUM% LTMP$=PRGGET$() LTMP$=LEFT$(LTMP$,LEN(LTMP$)-1) IF REMSPACES$(REMENDSPACES$(LTMP$))=="end lambda" THEN BREAK BLINE$=BLINE$+":"+FIXLAM$(P_LINE(REMSPACES$(LTMP$),LINUM%,"")) NEXT BLINE$=BLINE$+CHR$(34) SKPNUM%=LINUM%-LINNUM% ENDIF ELSE BLINE$=STRAIGHTPARSE$(DEBUGLN$) ENDIF RETURN BLINE$ END DEF STRAIGHTPARSE$(STRING$) STRING$=" "+STRING$ VAR I%,J%,RES$,PASSED%=FALSE,INSTR%=FALSE,K%,L% FOR I%=0 TO LEN(STRING$)-1 IF STRING$[I%]==CHR$(34) THEN INSTR%=!INSTR% IF !INSTR% && (STRING$[I%]=="'" || MID$(STRING$,I%,2)=="//") THEN RETURN RES$ FOR J%=LEN(STRFUNCTS$)-1 TO 0 STEP -1 IF (!INSTR%) && MID$(STRING$,I%,LEN(STRFUNCTS$[J%]))==STRFUNCTS$[J%] && !ISALPHANUM%(MID$(STRING$,I%+LEN(STRFUNCTS$[J%]),1)) && !ISALPHANUM%(MID$(STRING$,I%-1,1)) THEN RES$=RES$+TOREPL$[J%] INC I%,LEN(STRFUNCTS$[J%])-1 J%=0 PASSED%=TRUE ENDIF IF J%==0 && PASSED%==FALSE THEN FOR K%=LEN(GLOBALS$)-1 TO 0 STEP -1 IF (!INSTR%) && MID$(STRING$,I%,LEN(GLOBALS$[K%]))==GLOBALS$[K%] && !ISALPHANUM%(MID$(STRING$,I%+LEN(GLOBALS$[K%]),1)) && !ISALPHANUM%(MID$(STRING$,I%-1,1)) THEN RES$=RES$+GTOREPL$[K%] INC I%,LEN(GLOBALS$[K%])-1 K%=0 PASSED%=TRUE ENDIF IF PASSED%==FALSE THEN FOR L%=LEN(OPS$)-1 TO 0 STEP -1 IF (!INSTR%) && MID$(STRING$,I%,LEN(OPS$[L%]))==OPS$[L%] THEN RES$=RES$+OTOREPL$[L%] INC I%,LEN(OPS$[L%])-1 L%=0 PASSED%=TRUE ENDIF NEXT IF L%==0 && PASSED%==FALSE THEN RES$=RES$+MID$(STRING$,I%,1) ENDIF ENDIF IF K%==0 && PASSED%==FALSE THEN RES$=RES$+MID$(STRING$,I%,1) ENDIF NEXT IF LEN(GLOBALS$)==0 THEN FOR L%=LEN(OPS$)-1 TO 0 STEP -1 IF (!INSTR%) && MID$(STRING$,I%,LEN(OPS$[L%]))==OPS$[L%] THEN RES$=RES$+OTOREPL$[L%] INC I%,LEN(OPS$[L%])-1 L%=0 PASSED%=TRUE ENDIF NEXT IF L%<=0 && PASSED%==FALSE THEN RES$=RES$+MID$(STRING$,I%,1) ENDIF ENDIF ELSEIF J%==0 && PASSED%==FALSE THEN RES$=RES$+MID$(STRING$,I%,1) ENDIF PASSED%=FALSE NEXT NEXT RETURN RES$ END DEF P_DEF DEBUGLN$,LINE$,I% OUT INFUNCT%,BLINE$ BLINE$="" INFUNCT%=FALSE IF LINE$[0]=="use" THEN RETURN IF (INCLASS%||INOCLASS%)&&(LINE$[1]=="string"||LINE$[1]=="int"||LINE$[1]=="float"||LINE$[1]=="int[]"||LINE$[1]=="string[]"||LINE$[1]=="float[]"||LINE$[1]=="const") THEN DIM ARGS$[20] ARGS$=SEPELEM$(RIGHT$(DEBUGLN$,LEN(DEBUGLN$)-LEN(LINE$[1])-LEN(LINE$[0])-2)) BLINE$="VAR " IF LINE$[0]!="public"&&LINE$[0]!="private" THEN PRINT "Syntax error line "+STR$(I%)+": "+DEBUGLN$ PRINT "Expected "+CHR$(34)+"public"+CHR$(34)+" or "+CHR$(34)+"private,"+CHR$(34)+" received "+CHR$(34)+LINE$[0]+CHR$(34) STOP ENDIF FOR I%=0 TO LEN(ARGS$)-1 IF LINE$[0]=="private" THEN BLINE$=BLINE$+CNAME$+"_"+PRIVNAME$+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) ARGS$[I%]=" "+PRIVNAME$+REMSPACES$(ARGS$[I%]) ELSE BLINE$=BLINE$+CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) ENDIF IF LINE$[1]=="string" THEN BLINE$=BLINE$+"$" PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"$" PUSH GLOBALS$,"this."+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"$" ENDIF IF LINE$[1]=="int" THEN BLINE$=BLINE$+"%" PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"%" PUSH GLOBALS$,"this."+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"%" ENDIF IF LINE$[1]=="float" THEN BLINE$=BLINE$+"#" PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"#" PUSH GLOBALS$,"this."+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"#" ENDIF IF LINE$[1]=="string[]" THEN BLINE$=BLINE$+"$["+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[1])) PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"$" PUSH GLOBALS$,"this."+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"$" ENDIF IF LINE$[1]=="int[]" THEN BLINE$=BLINE$+"%["+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[1])) PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"%" PUSH GLOBALS$,"this."+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"%" ENDIF IF LINE$[1]=="float[]" THEN BLINE$=BLINE$+"#["+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[1])) PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"#" PUSH GLOBALS$,"this."+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(SPLIT$(ARGS$[I%],"=")[0],"[")[0]))+"#" ELSEIF LINE$[1]=="const" THEN BLINE$="DEF "+RIGHT$(BLINE$,LEN(BLINE$)-4)+"()"+CHR$(10)+"RETURN "+STRAIGHTPARSE$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[1]))+CHR$(10)+"END" PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"()" PUSH GLOBALS$,"this."+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])) PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0]))+"()" ENDIF IF LINE$[0]=="private" THEN GLOBALS$[LEN(GLOBALS$)-2]=RIGHT$(GLOBALS$[LEN(GLOBALS$)-2],LEN(GLOBALS$[LEN(GLOBALS$)-2])-10) GLOBALS$[LEN(GLOBALS$)-1]="this."+RIGHT$(GLOBALS$[LEN(GLOBALS$)-1],LEN(GLOBALS$[LEN(GLOBALS$)-1])-15) ENDIF IF LINE$[1]!="const" THEN BLINE$=BLINE$+STRAIGHTPARSE$(RIGHT$(ARGS$[I%],LEN(ARGS$[I%])-LEN(REMENDSPACES$(SPLIT$(ARGS$[I%],"=")[0])))) IF I%!=LEN(ARGS$)-1 THEN BLINE$=BLINE$+"," ENDIF NEXT RETURN ELSEIF LINE$[0]!="def" THEN PRINT "Syntax error line "+STR$(I%)+": "+DEBUGLN$ STOP ELSE INFUNCT%=TRUE IF LINE$[1]=="private" THEN IF CNAME$!="" THEN LINE$[3]=PRIVNAME$+LINE$[3] ENDIF ELSEIF LINE$[1]=="public" THEN ELSE PRINT "Syntax error line "+STR$(I%)+": "+DEBUGLN$ PRINT "Expected "+CHR$(34)+"public"+CHR$(34)+" or "+CHR$(34)+"private,"+CHR$(34)+" received "+CHR$(34)+LINE$[1]+CHR$(34) STOP ENDIF BLINE$=BLINE$+"DEF "+CNAME$+"_"+SPLIT$(LINE$[3],"(")[0] IF (INCLASS% || INOCLASS%) && LINE$[1]=="private" THEN PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(RIGHT$(SPLIT$(LINE$[3],"(")[0],LEN(SPLIT$(LINE$[3],"(")[0])-10))) ELSEIF INCLASS% THEN PUSH GLOBALS$,REMSPACES$(REMENDSPACES$(SPLIT$(LINE$[3],"(")[0])) ENDIF IF LINE$[2]=="string" THEN BLINE$=BLINE$+"$(" IF INCLASS% THEN PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(LINE$[3],"(")[0]))+"$" ELSEIF LINE$[2]=="int" THEN BLINE$=BLINE$+"%(" IF INCLASS% THEN PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(LINE$[3],"(")[0]))+"%" ELSEIF LINE$[2]=="float" THEN BLINE$=BLINE$+"#(" IF INCLASS% THEN PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(LINE$[3],"(")[0]))+"#" ELSEIF LINE$[2]=="void" THEN BLINE$=BLINE$+"_ " IF INCLASS% THEN PUSH GTOREPL$,CNAME$+"_"+REMSPACES$(REMENDSPACES$(SPLIT$(LINE$[3],"(")[0]))+"_" ELSE PRINT "Syntax error line "+STR$(I%)+": "+DEBUGLN$ STOP ENDIF IF LEN(GLOBALS$)>0 THEN IF GLOBALS$[LEN(GLOBALS$)-1][0]=="." THEN GLOBALS$[LEN(GLOBALS$)-1]=RIGHT$(GLOBALS$[LEN(GLOBALS$)-1],LEN(GLOBALS$[LEN(GLOBALS$)-1])-1) IF BETWPAREN$(DEBUGLN$)=="" && LINE$[2]!="void" THEN BLINE$=BLINE$+")" ELSEIF LINE$[2]!="void" THEN BLINE$=BLINE$+P_DEFPAREN$(BETWPAREN$(DEBUGLN$),LINE$[2])+")" ELSEIF BETWPAREN$(DEBUGLN$)!="" && LINE$[2]=="void" THEN BLINE$=BLINE$+P_DEFPAREN$(BETWPAREN$(DEBUGLN$),LINE$[2]) ENDIF ENDIF IF INOCLASS% && LINE$[1]=="public" THEN PUSH FUNCTS$,SPLIT$(BLINE$,"DEF ")[1] ENDIF IF LEN(SPLIT$(DEBUGLN$, "~>"))==2 THEN BLINE$=BLINE$+" OUT "+P_DEFPAREN$(SPLIT$(DEBUGLN$,"~>")[1],0) ENDIF END DEF INS_FUNCS PRGEDIT 1,2 PRGINS "DEF CLEAROBJ ONAM$ PRGINS "VAR I% PRGINS "ONAM$=REMENDSPACES$(ONAM$):ONAM$=SPLIT_$(ONAM$,"+CHR$(34)+"("+CHR$(34)+")[0]" PRGINS "PRGEDIT 3 PRGINS "FOR I%=1 TO PRGSIZE(3) PRGINS "IF LEFT$(PRGGET$(),10+LEN(ONAM$))=="+CHR$(34)+"COMMON DEF"+CHR$(34)+"+ONAM$ THEN PRGINS "PRGEDIT 3,I% PRGINS "PRGDEL 3 PRGINS "ENDIF PRGINS "NEXT PRGINS "EXEC 3 PRGINS "END PRGINS "DEF REMSPACES$(STRING$) PRGINS "IF LEN(STRING$)==0 THEN RETURN "+CHR$(34)+CHR$(34) PRGINS "WHILE STRING$[0]=="+CHR$(34)+" "+CHR$(34) PRGINS "STRING$=MID$(STRING$,1,LEN(STRING$)-1) PRGINS "IF LEN(STRING$)==0 THEN RETURN "+CHR$(34)+CHR$(34) PRGINS "WEND PRGINS "RETURN STRING$ PRGINS "END PRGINS "DEF REMENDSPACES$(STRING$) PRGINS "IF LEN(STRING$)==0 THEN RETURN "+CHR$(34)+CHR$(34) PRGINS "WHILE STRING$[LEN(STRING$)-1]=="+CHR$(34)+" "+CHR$(34) PRGINS "STRING$=MID$(STRING$,0,LEN(STRING$)-1) PRGINS "IF LEN(STRING$)==0 THEN RETURN "+CHR$(34)+CHR$(34) PRGINS "WEND PRGINS "RETURN STRING$ PRGINS "END PRGINS "VAR TOSWITCH$,TRIGGERED% PRGINS "COMMON DEF split_$(STRING$,TEST$) PRGINS "DIM TEMPARRAY$[0] PRGINS "VAR TEMPSTR$,I% PRGINS "FOR I%=0 TO LEN(STRING$)-1 PRGINS "IF MID$(STRING$,I%,LEN(TEST$))==TEST$ THEN PRGINS "PUSH TEMPARRAY$,TEMPSTR$ PRGINS "TEMPSTR$="+CHR$(34)+CHR$(34) PRGINS "INC I%,LEN(TEST$)-1 PRGINS "ELSE PRGINS "TEMPSTR$=TEMPSTR$+MID$(STRING$,I%,1) PRGINS "ENDIF PRGINS "NEXT PRGINS "PUSH TEMPARRAY$,TEMPSTR$+MID$(STRING$,I%+1,1) PRGINS "RETURN TEMPARRAY$ PRGINS "END PRGINS "COMMON DEF isstring(X) PRGINS "IF X*0 && X*0==X*0 THEN RETURN TRUE PRGINS "RETURN FALSE PRGINS "END PRGINS "COMMON DEF isint(X) PRGINS "IF X*0 && X*0==X*0 THEN RETURN FALSE PRGINS "IF (X*0-&H80000000<0)==1 THEN RETURN TRUE PRGINS "RETURN FALSE PRGINS "END PRGINS "COMMON DEF isfloat(X) PRGINS "IF X*0 && X*0==X*0 THEN RETURN FALSE PRGINS "IF (X*0-&H80000000<0)==0 THEN RETURN TRUE PRGINS "RETURN FALSE PRGINS "END PRGINS "COMMON DEF typeof(X) PRGINS "IF isstring(X) THEN RETURN "+CHR$(34)+"string"+CHR$(34) PRGINS "IF isint(X) THEN RETURN "+CHR$(34)+"int"+CHR$(34) PRGINS "RETURN "+CHR$(34)+"float"+CHR$(34) PRGINS "END PRGINS "COMMON DEF range(A%,B%) PRGINS "VAR I%,C%[B%-A%] PRGINS "FOR I%=A% TO B%-1 PRGINS "C%[I%-A%]=I% PRGINS "NEXT PRGINS "RETURN C% PRGINS "END PRGINS "COMMON DEF str(X) PRGINS "IF isstring(X) THEN RETURN X PRGINS "RETURN STR$(X) PRGINS "END PRGINS "COMMON DEF val_(X) PRGINS "IF !isstring(X) THEN RETURN X PRGINS "RETURN VAL(X) PRGINS "END PRGINS "COMMON DEF SWITCH TS% PRGINS "TOSWITCH$=STR(TS%) PRGINS "TRIGGERED%=TRUE PRGINS "END PRGINS "COMMON DEF CASE(CN) PRGINS "IF !TRIGGERED% THEN PRGINS "PRINT "+CHR$(34)+"CASE without SWITCH" PRGINS "STOP PRGINS "ENDIF PRGINS "IF STR(CN)==TOSWITCH$ THEN PRGINS "RETURN TRUE PRGINS "ELSE PRGINS "RETURN FALSE PRGINS "ENDIF PRGINS "END PRGINS "COMMON DEF ENDSW PRGINS "TRIGGERED%=FALSE PRGINS "END PRGINS "DEF ASSIGN VAR$,X PRGINS "VAR I% PRGINS "VAR$=REMENDSPACES$(VAR$) PRGINS "PRGEDIT 3 PRGINS "FOR I%=0 TO PRGSIZE(3) PRGINS "IF LEFT$(PRGGET$(),11+LEN(VAR$))=="+CHR$(34)+"COMMON DEF "+CHR$(34)+"+VAR$ THEN PRGINS "PRGDEL 3 PRGINS "PRGEDIT 3,-1 PRGINS "PRGINS "+CHR$(34)+"COMMON DEF "+CHR$(34)+"+VAR$+"+CHR$(34)+"()"+CHR$(34) PRGINS "VAR A$,B$ PRGINS "IF CHKCALL(VAR$+"+CHR$(34)+"_get$"+CHR$(34)+") THEN A$=VAR$+"+CHR$(34)+"_get$("+CHR$(34)+":B$="+CHR$(34)+") PRGINS "IF CHKCALL(VAR$+"+CHR$(34)+"_get%"+CHR$(34)+") THEN A$=VAR$+"+CHR$(34)+"_get%("+CHR$(34)+":B$="+CHR$(34)+") PRGINS "IF CHKCALL(VAR$+"+CHR$(34)+"_get#"+CHR$(34)+") THEN A$=VAR$+"+CHR$(34)+"_get#("+CHR$(34)+":B$="+CHR$(34)+") PRGINS "IF !ISSTRING(X) THEN PRGINS "PRGINS "+CHR$(34)+"RETURN "+CHR$(34)+"+A$+STR$(X)+B$ PRGINS "ELSE PRGINS "IF LEFT$(X,10)!="+CHR$(34)+PRIVNAME$+CHR$(34)+" THEN PRGINS "+CHR$(34)+"RETURN "+CHR$(34)+"+A$+CHR$(34)+X+CHR$(34)+B$ ELSE PRGINS "+CHR$(34)+"RETURN "+CHR$(34)+"+A$+"+CHR$(34)+"SPLIT_$(RIGHT$("+CHR$(34)+"+CHR$(34)+X+CHR$(34)+"+CHR$(34)+",LEN("+CHR$(34)+"+CHR$(34)+X+CHR$(34)+"+CHR$(34)+")-10),"+CHR$(34)+"+CHR$(34)+"+CHR$(34)+PRIVNAME$+CHR$(34)+"+CHR$(34)+"+CHR$(34)+")"+CHR$(34)+"+B$ PRGINS "ENDIF PRGINS "PRGINS "+CHR$(34)+"END"+CHR$(34) PRGINS "USE 3 PRGINS "RETURN PRGINS "ENDIF PRGINS "NEXT PRGINS "END PRGINS "COMMON DEF ARRAYL__(LIST$) PRGINS "DIM ELEMENTS$[0],NEW%[LEN(SPLIT_$(LIST$,"+CHR$(34)+","+CHR$(34)+"))] PRGINS "VAR I% PRGINS "ELEMENTS$=SPLIT_$(LIST$,"+CHR$(34)+","+CHR$(34)+") PRGINS "FOR I%=0 TO LEN(ELEMENTS$)-1 PRGINS "NEW%[I%]=VAL(REMSPACES$(REMENDSPACES$(ELEMENTS$[I%]))) PRGINS "NEXT PRGINS "RETURN NEW% PRGINS "END PRGINS "DEF ASSIGN__ VAR$,X PRGINS "IF CHKCALL(VAR$+"+CHR$(34)+"_set_"+CHR$(34)+") THEN CALL VAR$+"+CHR$(34)+"_set_"+CHR$(34)+",X,VAR$ ELSE ASSIGN VAR$,X PRGINS "END PRGINS "DEF ASSIGN___ VAR$,X PRGINS "PRGEDIT 3,-1 PRGINS "PRGINS "+CHR$(34)+"COMMON DEF "+CHR$(34)+"+VAR$+"+CHR$(34)+"()"+CHR$(34) PRGINS "IF !ISSTRING(X) THEN PRGINS "PRGINS "+CHR$(34)+"RETURN "+CHR$(34)+"+STR$(X) PRGINS "ELSE PRGINS "IF LEFT$(X,10)!="+CHR$(34)+PRIVNAME$+CHR$(34)+" THEN PRGINS "+CHR$(34)+"RETURN "+CHR$(34)+"+CHR$(34)+X+CHR$(34) ELSE PRGINS "+CHR$(34)+"RETURN SPLIT_$(RIGHT$("+CHR$(34)+"+CHR$(34)+X+CHR$(34)+"+CHR$(34)+",LEN("+CHR$(34)+"+CHR$(34)+X+CHR$(34)+"+CHR$(34)+")-10),"+CHR$(34)+"+CHR$(34)+"+CHR$(34)+";"+CHR$(34)+"+CHR$(34)+"+CHR$(34)+")" PRGINS "ENDIF PRGINS "PRGINS "+CHR$(34)+"END"+CHR$(34) PRGINS "USE 3 PRGINS "IF CHKCALL(VAR$+"+CHR$(34)+"_init_"+CHR$(34)+") THEN CALL VAR$+"+CHR$(34)+"_init_"+CHR$(34)+",VAR$ PRGINS "END PRGINS "DEF LAMBDA___ VAR$,X$ PRGINS "PRGEDIT 3,-1 PRGINS "PRGINS "+CHR$(34)+"COMMON DEF "+CHR$(34)+"+VAR$+"+CHR$(34) PRGINS "PRGINS X$ PRGINS "PRGINS "+CHR$(34)+"END"+CHR$(34) PRGINS "USE 3 PRGINS "END PRGINS "DEF LAMBDA__ VAR$,X$ PRGINS "VAR I% PRGINS "VAR$=REMENDSPACES$(VAR$) PRGINS "PRGEDIT 3 PRGINS "FOR I%=0 TO PRGSIZE(3) PRGINS "IF LEFT$(PRGGET$(),11+LEN(SPLIT_$(VAR$,"+CHR$(34)+"("+CHR$(34)+")[0]))=="+CHR$(34)+"COMMON DEF "+CHR$(34)+"+SPLIT_$(VAR$,"+CHR$(34)+"("+CHR$(34)+")[0] THEN PRGINS "PRGDEL 3 PRGINS "BREAK PRGINS "ENDIF PRGINS "NEXT PRGINS "PRGEDIT 3,-1 PRGINS "PRGINS "+CHR$(34)+"COMMON DEF "+CHR$(34)+"+VAR$" PRGINS "PRGINS X$ PRGINS "PRGINS "+CHR$(34)+"END"+CHR$(34) PRGINS "USE 3 PRGINS "END PRGINS "DEF IGNORE X PRGINS "END PRGINS "DEF eval(s$) PRGINS "lambda___ "+CHR$(34)+"xev__()"+CHR$(34)+","+CHR$(34)+"return "+CHR$(34)+"+s$ PRGINS "VAR ret% = xev__() PRGINS "clearobj "+CHR$(34)+" xev__() PRGINS "return ret% PRGINS "END END END DEF P_DEFPAREN$(PAREN$,TYPE$) DIM ARGS$[100] ARGS$=SPLIT$(PAREN$,",") VAR I%,TEMP$ FOR I%=0 TO LEN(ARGS$)-1 ARGS$[I%]=REMSPACES$(ARGS$[I%]) IF SPLIT$(ARGS$[I%]," ")[0]=="string" THEN TEMP$=TEMP$+SPLIT$(ARGS$[I%]," ")[1]+"$," PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1]))+"$" ELSEIF SPLIT$(ARGS$[I%]," ")[0]=="int" THEN TEMP$=TEMP$+SPLIT$(ARGS$[I%]," ")[1]+"%," PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1]))+"%" ELSEIF SPLIT$(ARGS$[I%]," ")[0]=="float" THEN TEMP$=TEMP$+SPLIT$(ARGS$[I%]," ")[1]+"#," PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1])) PUSH TOREPL$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1]))+"#" ELSEIF SPLIT$(ARGS$[I%]," ")[0]=="object" THEN TEMP$=TEMP$+SPLIT$(ARGS$[I%]," ")[1]+"," PUSH STRFUNCTS$,REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1])) PUSH TOREPL$,"SPLIT_$("+REMSPACES$(REMENDSPACES$(SPLIT$(ARGS$[I%]," ")[1]))+","+CHR$(34)+"("+CHR$(34)+")[0]" ENDIF NEXT IF TEMP$=="" THEN RETURN "" RETURN LEFT$(TEMP$,LEN(TEMP$)-1) END DEF FIXLAM$(S$) VAR I%,O$ FOR I%=0 TO LEN(S$)-1 IF S$[I%]==CHR$(34) THEN O$=O$+CHR$(34)+"+CHR$(34)+"+CHR$(34) ELSE O$=O$+S$[I%] NEXT RETURN O$ END DEF INIT_OBJ CNAM$,ONAM$ VAR I%,FNAM$ PRGEDIT 1,2 FOR I%=0 TO LEN(FUNCTS$)-1 IF SPLIT$(FUNCTS$[I%],"_")[0]==CNAM$ THEN IF LEN(SPLIT$(FUNCTS$[I%],"("))!=1 THEN FNAM$=ONAM$+RIGHT$(FUNCTS$[I%],LEN(FUNCTS$[I%])-LEN(SPLIT$(FUNCTS$[I%],"_")[0])) FNAM$=LEFT$(FNAM$,LEN(FNAM$)-LEN(POP(SPLIT$(BETWPAREN$(FNAM$),",")))-2) IF LEN(SPLIT$(FNAM$,"("))==1 THEN FNAM$=FNAM$+"("+("X"*(LEFT$(SPLIT$(SPLIT$(FUNCTS$[I%],"_")[1],"(")[0],LEN(SPLIT$(SPLIT$(FUNCTS$[I%],"_")[1],"(")[0])-1)=="get"))+")" ELSE FNAM$=FNAM$+")" ELSE FNAM$=ONAM$+RIGHT$(FUNCTS$[I%],LEN(FUNCTS$[I%])-LEN(SPLIT$(FUNCTS$[I%],"_")[0])) FNAM$=LEFT$(FNAM$,LEN(FNAM$)-LEN(POP(SPLIT$(SPLIT$(FNAM$," ")[1],",")))-1) ENDIF PRGINS "COMMON DEF "+FNAM$ IF LEN(SPLIT$(FUNCTS$[I%],"("))==1 THEN PRGINS LEFT$(FUNCTS$[I%],LEN(FUNCTS$[I%])-LEN(POP(SPLIT$(SPLIT$(FUNCTS$[I%]," ")[1],","))))+ONAM$+"()" ELSEIF LEFT$(SPLIT$(SPLIT$(FUNCTS$[I%],"_")[1],"(")[0],LEN(SPLIT$(SPLIT$(FUNCTS$[I%],"_")[1],"(")[0])-1)=="get" THEN PRGINS "RETURN "+LEFT$(FUNCTS$[I%],LEN(FUNCTS$[I%])-1-LEN(POP(SPLIT$(BETWPAREN$(FUNCTS$[I%]),","))))+"X)" ELSE PRGINS "RETURN "+LEFT$(FUNCTS$[I%],LEN(FUNCTS$[I%])-1-LEN(POP(SPLIT$(BETWPAREN$(FUNCTS$[I%]),","))))+ONAM$+"())" ENDIF PRGINS "END" PUSH STRFUNCTS$,ONAM$+"."+MID$(LEFT$(SPLIT$(SPLIT$(FUNCTS$[I%],"(")[0]," ")[0],LEN(SPLIT$(SPLIT$(FUNCTS$[I%],"(")[0]," ")[0])-1),LEN(CNAM$)+1,LEN(LEFT$(SPLIT$(SPLIT$(FUNCTS$[I%],"(")[0]," ")[0],LEN(SPLIT$(SPLIT$(FUNCTS$[I%],"(")[0]," ")[0])-1))-LEN(CNAM$)) PUSH TOREPL$,ONAM$+"_"+MID$(SPLIT$(SPLIT$(FUNCTS$[I%],"(")[0]," ")[0],LEN(CNAM$)+1,LEN(LEFT$(SPLIT$(SPLIT$(FUNCTS$[I%],"(")[0]," ")[0],LEN(SPLIT$(SPLIT$(FUNCTS$[I%],"(")[0]," ")[0])-1))-LEN(CNAM$)) ENDIF NEXT END DEF CLEARVARS VAR TRASH$ WHILE LEN(STRFUNCTS$)>ORIG_LEN TRASH$=POP(STRFUNCTS$) TRASH$=POP(TOREPL$) WEND END DEF REMSPACES$(STRING$) IF LEN(STRING$)==0 THEN RETURN "" WHILE STRING$[0]==" " STRING$=MID$(STRING$,1,LEN(STRING$)-1) IF LEN(STRING$)==0 THEN RETURN "" WEND RETURN STRING$ END DEF REMENDSPACES$(STRING$) IF LEN(STRING$)==0 THEN RETURN "" WHILE STRING$[LEN(STRING$)-1]==" " STRING$=MID$(STRING$,0,LEN(STRING$)-1) IF LEN(STRING$)==0 THEN RETURN "" WEND RETURN STRING$ END DEF ISALPHANUM%(STRING$) VAR I% IF LEN(STRING$)==0 THEN RETURN FALSE FOR I%=0 TO LEN(STRING$)-1 IF !((ASC(STRING$[I%])>=65 && ASC(STRING$[I%])<=90) || (ASC(STRING$[I%])>=97 && ASC(STRING$[I%])<=122) || (ASC(STRING$[I%])>=48 && ASC(STRING$[I%])<=57) || ASC(STRING$[I%])==95) THEN RETURN FALSE ENDIF NEXT RETURN TRUE END DEF BETWPAREN$(STRING$) VAR IN%=FALSE,I%,RES$ FOR I%=0 TO LEN(STRING$)-1 IF STRING$[I%]==")" THEN DEC IN% IF IN% THEN RES$=RES$+STRING$[I%] IF RES$!="" && !IN% THEN RETURN RES$ IF STRING$[I%]=="(" THEN INC IN% NEXT RETURN RES$ END DEF BETWQUOTES$(STRING$) VAR IN%=FALSE,I%,RES$ FOR I%=0 TO LEN(STRING$)-1 IF STRING$[I%]==CHR$(34) THEN IN%=FALSE IF IN% THEN RES$=RES$+STRING$[I%] IF STRING$[I%]==CHR$(34) THEN IN%=TRUE NEXT RETURN RES$ END DEF ISBLANK(STRING$) VAR I% FOR I%=0 TO LEN(STRING$)-1 IF STRING$[I%]!="" THEN RETURN FALSE ENDIF NEXT RETURN TRUE END DEF INARRAY(TEST,ARRAY) VAR I% FOR I%=0 TO LEN(ARRAY)-1 IF TEST==ARRAY[I%] THEN RETURN TRUE NEXT RETURN FALSE END DEF INARR(ARRAY,TEST) VAR I% FOR I%=0 TO LEN(ARRAY)-1 IF TEST==ARRAY[I%] THEN RETURN I% NEXT RETURN -1 END DEF SEPELEM$(S$) VAR I%,IN%,TEMP$,Q% DIM OUT$[0] FOR I%=0 TO LEN(S$)-1 IF (S$[I%]=="(" || S$[I%]=="[") && !Q% THEN INC IN% TEMP$=TEMP$+S$[I%] CONTINUE ENDIF IF S$[I%]==CHR$(34) THEN Q%=!Q% TEMP$=TEMP$+S$[I%] CONTINUE ENDIF IF (S$[I%]==")" || S$[I%]=="]") && !Q% THEN DEC IN% TEMP$=TEMP$+S$[I%] CONTINUE ENDIF IF !IN% && !Q% && S$[I%]=="," THEN PUSH OUT$,TEMP$ TEMP$="" CONTINUE ENDIF TEMP$=TEMP$+S$[I%] NEXT PUSH OUT$,TEMP$ RETURN OUT$ END DEF split$(STRING$,TEST$) DIM TEMPARRAY$[0] VAR TEMPSTR$,I% FOR I%=0 TO LEN(STRING$)-1 IF MID$(STRING$,I%,LEN(TEST$))==TEST$ THEN PUSH TEMPARRAY$,TEMPSTR$ TEMPSTR$="" INC I%,LEN(TEST$)-1 ELSE TEMPSTR$=TEMPSTR$+MID$(STRING$,I%,1) ENDIF NEXT PUSH TEMPARRAY$,TEMPSTR$+MID$(STRING$,I%+1,1) RETURN TEMPARRAY$ END DEF empty() DIM A[0] RETURN A END DEF empty$() DIM A$[0] RETURN A$ END @REPLACE DATA "val","split","date","chr","format","hex" DATA "left","mid","right","mpname","subst" DATA "time","delete","_","read","isref","bin" @TOREPL DATA "VAL_","SPLIT_$","DATE$","CHR$","FORMAT$" DATA "HEX$","LEFT$","MID$","RIGHT$","MPNAME$" DATA "SUBST$","TIME$","CLEAROBJ ","TRUE||TRUE" DATA "CALL","CHKCALL","BIN$" @OPS DATA "~>","[|","|]","%","@","{","}",";","[[" DATA "]]" @OTOREPL DATA " OUT ","ARRAYL__(",")"," MOD ","_" DATA "",")","","",""