Documentation Comments
Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.
Reality V15.0 ()
DataBasic Real-time Run Program Example (DataBasic) (m618705+run_program.htm)
This program allows you to enter simple DataBasic programs directly and run them without having to type file, compile and run commands.
Programs can be as simple as a one-line PRINT statement or can be of multiple lines. The program is useful for doing various math routines and for trying out certain DataBasic statements and sequences.
BC ****************************************************************** ***** DataBasic REAL-TIME RUN PROGRAM ***** ****************************************************************** ***** FILE 'BIN' MUST BE CREATED BEFORE RUNNING ***** ****************************************************************** DIM ATTR(100) PROMPT CHAR(216) EQU NILL TO "" NEW="" ****************************************************************** ***** PROMPT FOR INPUT, LOOP UNTIL NO INPUT ***** ****************************************************************** OPEN 'BIN' TO FILE ELSE PRINT "NO 'BIN' FILE" STOP END START: MAT ATTR=NILL L=1 IF NEW#"" THEN WHAT=NEW; GO LUUP2 LUUP: INPUT WHAT LUUP2: BEGIN CASE CASE WHAT=NILL; GO ONWD ;* End Program CASE WHAT[1,1]="," ;* Transpose ,stmnt * to PRINT stmnt IF WHAT[2,1]=" " THEN ;* Transpose , stmnt * to PRINT stmnt ATTR(L)="PRINT":WHAT[2,-1] END ELSE ATTR(L)="PRINT ":WHAT[2,-1] GO SKIP CASE WHAT[1,1]="'" ;* Transpose 'stmnt * to PRINT "stmnt" ATTR(L)='PRINT "':WHAT[2,-1]:'"' GO SKIP END CASE ATTR(L)=WHAT ;* Input is verbatim SKIP: L=L+1 ;* Incr to next attr. GO LUUP ;* Loop back ****************************************************************** ***** FILE LISTING, COMPILE, RUN & DELETE IT ***** ****************************************************************** * ONWD: ATTR(L)="END" IF L=1 THEN STOP MATWRITE ATTR ON FILE,'ITEM' ;* File source code * Compile it PERFORM "BASIC BIN ITEM" CAPTURING ERRM ITEM="$ITEM" READV EMTX FROM FILE,ITEM,1 ELSE GO NONE GO RNIT NONE: PRINT NILL; PRINT ERRM PRINT NILL; L=1; GO LUUP RNIT: PRINT @(-10):@(-4) PRINT @(-4); PRINT NILL PERFORM "RUN BIN ITEM" ;* RUN program CLEARFILE FILE ;* Burn the evidence INPUT NEW IF NUM(NEW) THEN IF NEW>1 THEN L=NEW; NEW=""; GO LUUP END ELSE IF NEW="" THEN STOP ELSE GO START END ELSE GO START END END