Commit 8d44da6d authored by kollo's avatar kollo

fixed bug with missing examples directory (2016-07-24 Rick Richardson)

also updated the c-usage examples
The configure script should now run again without errors
make dist should be able to create the source tar ball...
parent 859c9835
# Example how to link X11-Basic Object codes (produced by xbc)
# with your c-Program
# Example how to use the x11basic-Library
# with your c-Program (c) Markus Hoffmann
# Example how to link X11-Basic object codes (produced by xbc) with your C program
# and
# Example how to use the x11basic-Library from within your C program
# (c) Markus Hoffmann 2004
# demo1 simply uses some of the X11-basic commands provided by libx11basic
# demo2 links with library.bas and calls X11-Basic procedures and function and uses the X11-Basic Variables
# from within the c sourcecode. You can also make a shared library from library.o and dynamically link
# demo2 links with library.bas and calls X11-Basic procedures and function
# and uses the X11-Basic variables from within the c sourcecode.
# You can also make a shared library from library.o and dynamically link
# against it.
......@@ -15,10 +15,10 @@ all: demo1 demo2
demo1: c-demo.c
gcc -fomit-frame-pointer -o $@ -lx11basic -ldl -lm -lreadline -lncurses -lasound -lX11 c-demo.c
gcc -fomit-frame-pointer -o $@ $< -lx11basic -ldl -lm -lreadline -lasound -lX11
demo2: library.o c-demo2.c
gcc -fomit-frame-pointer -o $@ -lx11basic -ldl -lm -lreadline -lncurses -lasound -lX11 c-demo2.c library.o
gcc -fomit-frame-pointer -o $@ $^ -lx11basic -ldl -lm -lreadline -lasound -lX11
%.b: %.bas
xbbc -o $@ $<
......
......@@ -10,7 +10,7 @@
x11basic shared library. Also ohers are required as follos:
gcc -fomit-frame-pointer -o testme -L/usr/X11R6/lib -lx11basic -ldl -lm
-lreadline -lncurses -lasound -lX11 testme.c library.o
-lreadline -lasound -lX11 testme.c library.o
*/
......@@ -26,11 +26,10 @@ char ifilename[]="dummy"; /* Program name. Put some useful information her
char *programbuffer=NULL;
const char version[]="dummy"; /* Version Number. Put some useful information here */
const char vdate[]="dummy"; /* Creation date. Put some useful information here */
char *program[]={"Hallo"}; /* Other comments. Put some useful information here */
int prglen=sizeof(program)/sizeof(char *);
char **program=NULL;
int prglen=0;
int verbose=0;
/* Here your c program starts */
main(int anzahl, char *argumente[]) {
......@@ -54,9 +53,9 @@ main(int anzahl, char *argumente[]) {
kommando("SHOWPAGE");
kommando("KEYEVENT");
/* ... */
/* If you know the internals of libx11basic, you can also use the c-versions of the functions:*/
/* If you know the internals of libx11basic, you can also use the c-versions of the functions:*/
graphics();
i=form_alert(1,strdup("[1][Hi I am X11-Basic.][ OK ]"));
printf("You pressed button %d\n",i);
}
......@@ -13,7 +13,7 @@ xbc -l -virtualm library.bas
gcc -DNOMAIN -c library.c
gcc -fomit-frame-pointer -o testme -L/usr/X11R6/lib -lx11basic -ldl -lm
-lreadline -lncurses -lasound -lX11 c-demo2.c library.o
-lreadline -lasound -lX11 c-demo2.c library.o
*/
......@@ -48,7 +48,6 @@ int main(int anzahl, char *argumente[]) {
STRING str;
int i;
MAIN_INIT;
printf("Hallo\n");
/* Initialize Variables used by the main program */
double VARf_MX;
......@@ -61,8 +60,8 @@ printf("Hallo\n");
/* Initialize Variables used by the main program */
add_variable_adr("MX",FLOATTYP,(char *)&VARf_MX);
add_variable_adr("MY",FLOATTYP,(char *)&VARf_MY);
add_variable("MX",FLOATTYP,0,V_STATIC,(char *)&VARf_MX);
add_variable("MY",FLOATTYP,0,V_STATIC,(char *)&VARf_MY);
......
' This is an example, how to produce .o linkabel object files and
' shared object files (.so) under linux with X11-Basic:
' library.bas -- demonstration for X11-Basic (c) Markus Hoffmann
'
'
' This is an example how to produce .o linkabel object files and
' shared object files (.so) under linux (UNIX or MAC-OSX) with X11-Basic:
'
' Do a
' xbc -l -c library.bas
......@@ -11,23 +14,21 @@
'
' You can link multiple .o files together with normal (C) .o files.
procedure pa
print "This is procedure a"
alert 1,"Hello, this is a message|from your X11-Basic program library.bas",1," Wow! ",dummy
return
procedure b
print "This is procedure b"
return
procedure c(x,y)
print "This is procedure c with parameters: x=";x,"y=";y
return
function d(x,y)
print "This is function d with parameters: x=";x,"y=";y
return x+y
endfunction
function greeting$(n%)
print "This is function greeting with parameter: n%=";n%
return date$+" "+time$+" Hello!!!! "+str$(n%)
endfunction
PROCEDURE pa
PRINT "This is procedure a"
ALERT 1,"Hello, this is a message|from your X11-Basic program library.bas",1," Wow! ",dummy
RETURN
PROCEDURE b
PRINT "This is procedure b"
RETURN
PROCEDURE c(x,y)
PRINT "This is procedure c with parameters: x=";x,"y=";y
RETURN
FUNCTION d(x,y)
PRINT "This is function d with parameters: x=";x,"y=";y
RETURN x+y
ENDFUNCTION
FUNCTION greeting$(n%)
PRINT "This is function greeting with parameter: n%=";n%
RETURN DATE$+" "+TIME$+" Hello!!!! "+STR$(n%)
ENDFUNCTION
......@@ -4,20 +4,19 @@
'
'
ziff%()=[0x7b,0x42,0x37,0x67,0x4e,0x6d,0x7d,0x43,0x7f,0x6f]
' classical red design
rot=COLOR_RGB(0.9,0,0) ! color for segment on
grau=COLOR_RGB(0.237,0,0) ! color for segment off
schwarz=COLOR_RGB(0,0,0) ! color for background
grau=COLOR_RGB(0.237,0,0) ! color for segment off
schwarz=COLOR_RGB(0,0,0) ! color for background
' LCD design
rot=COLOR_RGB(0.1,0.1,0.1) ! color for segment on
rot=COLOR_RGB(0.1,0.1,0.1) ! color for segment on
grau=COLOR_RGB(0.8,0.6,0.7) ! color for segment off
schwarz=COLOR_RGB(0.6,0.7,0.6) ! color for background
t$=""
scale=0.5
scale=0.7
' italic=-0.2 ! for slight italic
......@@ -32,9 +31,9 @@ DO
groesse=scale
@puts7(0,0,t$)
groesse=0.5*scale
t$=@conv$(time$+" "+date$)
t$=@conv$(TIME$+" "+DATE$)
@puts7(0,100*scale,t$)
t$=@conv$(str$(timer))
t$=@conv$(STR$(TIMER))
@puts7(400*scale,100*scale,t$)
groesse=2*scale
t$=@conv$(STR$(acu,10,7))
......@@ -44,44 +43,44 @@ DO
@puts7(0,320*scale,t$)
SHOWPAGE
if EVENT?(1)
keyevent a,b,c$
if left$(c$)>="0" and left$(c$)<="9"
if clearacu
IF EVENT?(1)
KEYEVENT a,b,c$
IF left$(c$)>="0" and left$(c$)<="9"
IF clearacu
acu=0
clearacu=0
endif
ENDIF
acu=acu*10+(asc(left$(c$))-asc("0"))
else if instr("+-/^*",left$(c$))
ELSE if instr("+-/^*",left$(c$))
x=acu
clearacu=true
mod$=left$(c$)
else if left$(c$)="~"
ELSE if left$(c$)="~"
acu=-acu
else if left$(c$)="p"
ELSE if left$(c$)="p"
acu=pi
clearacu=true
else if left$(c$)="m"
ELSE if left$(c$)="m"
mem=acu
else if left$(c$)="="
if mod$="+"
ELSE if left$(c$)="="
IF mod$="+"
acu=acu+x
else if mod$="-"
ELSE if mod$="-"
acu=x-acu
else if mod$="*"
ELSE if mod$="*"
acu=x*acu
else if mod$="/"
if acu<>0
ELSE if mod$="/"
IF acu<>0
acu=x/acu
else
ELSE
acu=nan
endif
else if mod$="^"
ENDIF
ELSE if mod$="^"
acu=x^acu
endif
ENDIF
clearacu=true
else
print at(1,1);a,hex$(b),c$," "
ELSE
PRINT at(1,1);a,hex$(b),c$," "
ENDIF
ELSE
PAUSE 0.1
......@@ -89,62 +88,64 @@ DO
LOOP
END
procedure puts7(x,y,c$)
local i
for i=0 to len(c$)-1
PROCEDURE puts7(x,y,c$)
LOCAL i
FOR i=0 to len(c$)-1
@put7(x,y,groesse,peek(varptr(c$)+i))
add x,32*groesse
if x>640*scale
ADD x,32*groesse
IF x>640*scale
x=0
add y,64*groesse
endif
next i
return
procedure put7(x,y,s,c)
local i,p1,p2,p3,p4
ADD y,64*groesse
ENDIF
NEXT i
RETURN
PROCEDURE put7(x,y,s,c)
LOCAL i,p1,p2,p3,p4
' color schwarz
' pbox x,y,x+s*32,y+s*64
d%()=[3,3,29,3;29,3,29,29;3,32,29,32;3,3,3,29;3,32,3,61;3,61,29,61;29,61,29,32;34,64,35,64]
for i=0 to 7
if btst(c,i)
color rot
else
color grau
endif
defline ,4*s,2
FOR i=0 to 7
IF btst(c,i)
COLOR rot
ELSE
COLOR grau
ENDIF
DEFLINE ,4*s,2
p1=d%(i,0)*s*0.8
p2=d%(i,1)*s*0.6
p3=d%(i,2)*s*0.8
p4=d%(i,3)*s*0.6
line x+p1+p2*italic,y+p2,x+p3+p4*italic,y+p4
next i
return
LINE x+p1+p2*italic,y+p2,x+p3+p4*italic,y+p4
NEXT i
RETURN
function conv$(t$)
local i,a$
FUNCTION conv$(t$)
LOCAL i,a$
a$=""
for i=0 to len(t$)-1
if peek(varptr(t$)+i)=asc(".")
if len(a$)
poke varptr(a$)+len(a$)-1,peek(varptr(a$)+len(a$)-1) or 0x80
else
a$=chr$(ziff%(0) or 0x80)
endif
else if peek(varptr(t$)+i)=asc(" ")
FOR i=0 TO LEN(t$)-1
IF PEEK(VARPTR(t$)+i)=ASC(".")
IF LEN(a$)
POKE VARPTR(a$)+LEN(a$)-1,PEEK(VARPTR(a$)+LEN(a$)-1) OR 0x80
ELSE
a$=CHR$(ziff%(0) OR 0x80)
ENDIF
ELSE IF PEEK(VARPTR(t$)+i)=ASC(" ")
a$=a$+chr$(0)
else if peek(varptr(t$)+i)=asc("-")
a$=a$+chr$(4)
else if peek(varptr(t$)+i)=asc("e")
a$=a$+chr$(0x3d)
else if peek(varptr(t$)+i)=asc("E")
a$=a$+chr$(0x3d)
else if peek(varptr(t$)+i)=asc("f")
a$=a$+chr$(0x1d)
else if peek(varptr(t$)+i)=asc("a")
a$=a$+chr$(0x5f)
else
a$=a$+chr$(ziff%(peek(varptr(t$)+i)-asc("0")))
endif
next i
return a$
endfunction
ELSE if peek(varptr(t$)+i)=ASC("-")
a$=a$+CHR$(4)
ELSE if PEEK(varptr(t$)+i)=ASC("e")
a$=a$+CHR$(0x3d)
ELSE if PEEK(varptr(t$)+i)=ASC("E")
a$=a$+CHR$(0x3d)
ELSE if PEEK(varptr(t$)+i)=ASC("f")
a$=a$+CHR$(0x1d)
ELSE if PEEK(varptr(t$)+i)=ASC("a")
a$=a$+CHR$(0x5f)
ELSE if PEEK(VARPTR(t$)+i)=ASC(":")
a$=a$+CHR$(0x04)
ELSE
a$=a$+CHR$(ziff%(PEEK(VARPTR(t$)+i)-ASC("0")))
ENDIF
NEXT i
RETURN a$
ENDFUNCTION
......@@ -3,10 +3,11 @@
'
a#=3+4i
b#=conj#(a#)
c#=SQRT#(b#)
b#=CONJ(a#)
c#=SQRT(b#)
print a#,b#,c#
PRINT a#,b#,c#
t$=STR$(b#)
PRINT ENCLOSE$(t$)
quit
QUIT
......@@ -5,13 +5,14 @@
'
if WIN32?
a$=FSFIRST$("C:\","*.dat")
else
PRINT "looks for *.dat files in C:\"
ELSE
a$=FSFIRST$("/tmp","*.dat")
endif
WHILE len(a$)
print a$
name$=word$(a$,2)
PRINT "looks for *.dat files in /tmp/"
ENDIF
WHILE LEN(a$)
PRINT a$
name$=WORD$(a$,2) ! This is the filename only
a$=FSNEXT$()
WEND
END
' A short demonstration of the GPS functionallity in
' X11-Basic for Android (c) Markus Hoffmann 08/2013
'
' Check is the operating system supports GPS (location service)
cls
if GPS?=0
print "This computer has no GPS support."
print "You should run this example on a device with location service (GPS)"
print "maybe an Android phone or tablet."
endif
' Before you used GPS ON or GET_LOCATION the system variables
' GPS_LAT,GPS_LON,GPS_ALT will have empty values
' GPS_LAT and GPS_LON usually have -1
'
PRINT "initial (empty) values: "
PRINT GPS_LAT,GPS_LON,GPS_ALT
PAUSE 1
' Now you can ask for a location, which already has been measured before.
' This is either a location the device has accomplished by the network or
' cell phone triangulation or -- if the GPS was allowed by the user --
' the last measured position by GPS device.
'
' It can happen, that you get a valid location when GPS was disabled by the user
' but you wont, when GPS is enabled. This happens when no GPS fix could be
' acheived so far.
' Ask for last known location. This maybe an old value. Check the time!
GET_LOCATION lat,lon,alt,bearing,accuracy,s,t,p$
PRINT "last known location:"
PRINT lat,lon,alt,bearing,accuracy
PRINT "speed=";s
PRINT "time=";t
PRINT "provider=";p$
if timer-t>300
print "last known location values are older than 5 Minutes. ";int((timer-t)/60); "Min."
endif
pause 5
cls
' Usually you want to get more recent positions and therefor you need to switch
' on the location measurement in the device.
' GPS ON turns on the location updates either by network provider (if GPS was
' disabled by the user or uis the device has no GPS chip) or by GPS device
' (as soon as it gets a satellite fix). In the latter case also the GPS icon
' will appear in the status line (press the home button to see it).
'
PRINT
PRINT "now get updates..."
' get location updates in the background
GPS ON
DO
PRINT AT(1,1);"Position by ";p$;" ";
PRINT AT(2,1);"Latitude: ";@breite$(GPS_LAT);" ";
PRINT AT(3,1);"Longitude: ";@laenge$(GPS_LON);" ";
PRINT AT(4,1);"Altitude: ";GPS_ALT;" m "
' you can of course also use GET_LOCATION here to get more
' information
GET_LOCATION lat,lon,alt,bearing,accuracy,s,t,p$
PRINT "acuracy: ";accuracy;" m "
PRINT "speed: ";s;" m/s "
PRINT "baering: ";bearing;" deg"
PRINT "timestamp: ";t
' The timestamp is useful to find out if the measurement is really new
PRINT "time of measurement:";UNIXDATE$(t);" ";UNIXTIME$(t)
PAUSE 0.5
LOOP
' switch off gps position measurement (and save battery)
GPS OFF
END
' Here some useful functions for handling GPS data:
FUNCTION breite$(x)
LOCAL posx$
IF x>0
posx$="N"
ELSE
posx$="S"
ENDIF
x=ABS(x)
posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+":"
x=x-INT(x)
x=x*60
posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+":"
x=x-INT(x)
x=x*60
posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+"."
x=x-INT(x)
x=x*10
posx$=posx$+str$(INT(x))
RETURN posx$
ENDFUNC
FUNCTION laenge$(x)
LOCAL posx$
IF x>0
posx$="E"
ELSE
posx$="W"
ENDIF
x=ABS(x)
posx$=posx$+RIGHT$("000"+str$(INT(x)),3)+":"
x=x-INT(x)
x=x*60
posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+":"
x=x-INT(x)
x=x*60
posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+"."
x=x-INT(x)
x=x*10
posx$=posx$+str$(INT(x))
RETURN posx$
ENDFUNC
' calculate the distance in meters between two locations a nd b
' given by lat,lon each.
function distance(lona,lata,lonb,latb)
local DEG2RAD,l0,l1,b0,b1
DEG2RAD=(3.14159265358979323846/180.0)
l0=lona*DEG2RAD
l1=lonb*DEG2RAD
b0=lata*DEG2RAD
b1=latb*DEG2RAD
return 6371*2*asin(sqrt(cos(b1)*cos(b0)*sin(0.5*(l1-l0))*sin(0.5*(l1-l0))+sin(0.5*(b1-b0))*sin(0.5*(b1 - b0))))
endfunc
function qthlocator$(breite,laenge)
t$=chr$(int(laenge/20)+asc("J"))
t$=t$+chr$(asc("J")+int(breite/10))
laenge=laenge-int(laenge/20)*20
laenge=laenge/2
t$=t$+str$(int(laenge))
breite=breite-int(breite/10)*10
t$=t$+str$(int(breite))
breite=breite-int(breite)
laenge=laenge-int(laenge)
t$=t$+chr$(asc("A")+24*laenge)
t$=t$+chr$(asc("A")+24*breite)
return t$
endfunc
<TITLE>Directory listing of examples/tests</TITLE>
<H1>Directory listing of examples/tests</H1><pre>
152 Feb 15 2003 <a href="../">..</a>
2416 Jan 1 2004 <a href="7seg.bas">7seg.bas</a>
504 Jan 1 2003 <a href="alertinput.bas">alertinput.bas</a>
2399 Mar 23 2001 <a href="alerts.1-0">alerts.1-0</a>
2955 Mar 23 2001 <a href="alerts.1-4">alerts.1-4</a>
378 Jan 1 2003 <a href="alerttest.bas">alerttest.bas</a>
290 Jan 1 2003 <a href="ansicolor.bas">ansicolor.bas</a>
271 Aug 3 2003 <a href="arraytest.bas">arraytest.bas</a>
996 May 2 2002 <a href="benchmark.bas">benchmark.bas</a>
50374 Jan 4 2003 <a href="bitmaptest.bas">bitmaptest.bas</a>
661 Jan 1 2003 <a href="colors.bas">colors.bas</a>
677 Apr 1 2001 <a href="copyareatest.bas">copyareatest.bas</a>
617 Jun 22 2003 <a href="deffilltest.bas">deffilltest.bas</a>
373 Jun 22 2003 <a href="defmousetest.bas">defmousetest.bas</a>
221 Oct 12 14:32 <a href="dragbox.bas">dragbox.bas</a>
1586 Jan 1 2003 <a href="edit.bas">edit.bas</a>
725 Oct 12 2004 <a href="filltest.bas">filltest.bas</a>
16049 Apr 2 2001 <a href="fish_24.xwd">fish_24.xwd</a>
281 Jan 1 2003 <a href="font.bas">font.bas</a>
531 Sep 14 00:04 <a href="forktest.bas">forktest.bas</a>
531 Sep 14 00:04 <a href="forktest2.bas">forktest2.bas</a>
1134 Jan 1 2003 <a href="fouriertest.bas">fouriertest.bas</a>
2492 Oct 20 2002 <a href="gettest.bas">gettest.bas</a>
4045 Jan 28 2002 <a href="index.html">index.html</a>
325 Apr 23 2002 <a href="inlinetest.bas">inlinetest.bas</a>
349 Sep 14 00:08 <a href="keyeventtest.bas">keyeventtest.bas</a>
325 Jan 1 2003 <a href="linktest.bas">linktest.bas</a>
867 Jan 1 2005 <a href="mattest.bas">mattest.bas</a>
1300 Jan 1 2003 <a href="menutest.bas">menutest.bas</a>
435 Jun 1 2004 <a href="onerror-test.bas">onerror-test.bas</a>
342 Jan 1 2003 <a href="ontest.bas">ontest.bas</a>
506 Jan 1 2003 <a href="polytest.bas">polytest.bas</a>
1024 Aug 27 2001 <a href="shmtest.bas">shmtest.bas</a>
203 May 4 2002 <a href="singlebench.bas">singlebench.bas</a>
617 Aug 30 2003 <a href="soundtest.bas">soundtest.bas</a>
618 Jan 03 2013 <a href="sqldemo.bas">sqldemo.bas</a>
</pre>
weiss=color_rgb(1,1,1)
grau=color_rgb(0.3,0.3,0.3)
rot=color_rgb(1,0,0)
schwarz=color_rgb(0,0,0)
gelb=color_rgb(1,1,0)
weiss=COLOR_RGB(1,1,1)
grau=COLOR_RGB(0.3,0.3,0.3)
rot=COLOR_RGB(1,0,0)
schwarz=COLOR_RGB(0,0,0)
gelb=COLOR_RGB(1,1,0)
bx=16
by=32
chw=16
chh=24
clearw 1
color gelb,schwarz
text 8,20,"LTEXT scaling demonstration"
color rot
defline ,3
ltext 250,00,"ABCDEFGHI"
ltext 250,60,"JKLMNOPQR"
ltext 250,120,"STUVWXYZ{"
ltext 250,180,"abcdefghi"
ltext 250,240,"jklmnopqr"
ltext 250,300,"stuvwxyz€"
CLEARW 1
COLOR gelb,schwarz
TEXT 8,20,"LTEXT scaling demonstration"
COLOR rot
DEFLINE ,3
LTEXT 250,00,"ABCDEFGHI"
LTEXT 250,60,"JKLMNOPQR"
LTEXT 250,120,"STUVWXYZ{"
LTEXT 250,180,"abcdefghi"
LTEXT 250,240,"jklmnopqr"
LTEXT 250,300,"stuvwxyz€"
@showchar(0)
color gelb
text 28,200,"press any key"
SHOWPAGE
do
keyevent ,a
COLOR gelb
TEXT 28,200,"press any key"
SHOWPAGE
DO
KEYEVENT ,a
@showchar(a)
SHOWPAGE
LOOP
END
loop
end
procedure showchar(c)
defline ,1
color schwarz
pbox bx,by,bx+chw*10,by+chh*13
color grau
for i=0 to 10 step 0.1
line bx,by+chh*i,bx+chw*10,by+chh*i
next i
for i=0 to 10 step 0.1
line bx+chw*i,by,bx+chw*i,by+chh*10
next i
color weiss
for i=0 to 13
line bx,by+chh*i,bx+chw*10,by+chh*i
text bx+chw*10+5,by+chh*i+4,str$(i*10)
next i
for i=0 to 10
line bx+chw*i,by,bx+chw*i,by+chh*10
next i
color rot
defline ,5
deftext ,chw/10,chh/10
ltext bx,by,chr$(c)
return
PROCEDURE showchar(c)
DEFLINE ,1
COLOR schwarz
PBOX bx,by,bx+chw*10,by+chh*13
COLOR grau
FOR i=0 TO 10 STEP 0.1
LINE bx,by+chh*i,bx+chw*10,by+chh*i
NEXT i
FOR i=0 TO 10 STEP 0.1
LINE bx+chw*i,by,bx+chw*i,by+chh*10
NEXT i
COLOR weiss
FOR i=0 TO 13
LINE bx,by+chh*i,bx+chw*10,by+chh*i
TEXT bx+chw*10+5,by+chh*i+4,STR$(i*10)
NEXT i
FOR i=0 TO 10
LINE bx+chw*i,by,bx+chw*i,by+chh*10
NEXT i
COLOR rot
DEFLINE ,5
DEFTEXT ,chw/10,chh/10
LTEXT bx,by,CHR$(c)
RETURN
' How to use the on error and on break statements.
' TODO: This is not yet working with bytecode
every 10,ddd
on error gosub e
on break gosub a
do
print time$;chr$(13);
flush
if random(10000)=100
error 22
print 1/0
endif
loop
quit
EVERY 10,ddd
ON ERROR GOSUB e
ON BREAK GOSUB a
DO
PRINT TIME$;CHR$(13);
FLUSH
IF RANDOM(10000)=100
ERROR 22
PRINT 1/0 ! This should cause an error
PAUSE 1
ENDIF
LOOP
QUIT
exiot:
print "break and exit with ";err
quit
procedure a
print "no break !!!!"
on break goto exiot
return
procedure e
print "Error ";err;" occured."
print "continue ...."
on error gosub e
return
procedure ddd
print "timeout"
PRINT "break and exit with ";ERR
QUIT
return
PROCEDURE a
PRINT "no break !!!! Try again."
ON BREAK GOTO exiot
RETURN
PROCEDURE e
PRINT "Error #";ERR;" occured."
PRINT "continue ...."
ON ERROR GOSUB e