home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-10 | 39.9 KB | 1,541 lines |
-
- Rem MultiTimer
- Rem ╕1995 Erik Johansen, ej@it.dtu.dk
-
- REM TODO: Power off if not already on (How?) / Option to Wait ?
-
- APP MultiTim
- TYPE $1003 rem Change to $5003 to disallow shutdown from system screen/backup
- EXT "mt"
- ICON "\OPD\MultiTim.pic"
- ENDA
-
- PROC Start:
- global curfile$(128),needsav%
- global def$(255,64)
- global flags%(50),op$(50,8),par&(50),par$(50,64),val$(50,64)
- global maxproc%,first%,last%,curact%
- global nexttim&,msgtim&
- global inpon%,inpval$(64),prompt$(30)
- global timon%,tim%,timstat%
- global almon%,alm%,almstat%
- global sndon%,snd%,sndstat%,sndsta2%,vol%
- global cnton%,cntmsg&
- global sigi%,sigt%,sigs%,siga%
- global bigfnt%,gcx%(3),gcy%(3),gcw%(3),off%(3),gg%(3),fld%
- global cur%,con%
- global lasttim&,fnt%,fnth%
- global sah&,sad&,say&
- global bop$(8),bpar&,bpar$(64),bflags%,bval$(64),bdef$(64)
- global next$(64),errmsg$(64)
- global s%
- maxproc%=50
- sigi%=1 :sigt%=2 :sigs%=4 :siga%=8
- first%=1 :last%=0
- gcx%(1)= 8 :gcy%(1)= 1 :gcw%(1)=245 :off%(1)=1 :gg%(1)=1
- gcx%(2)= 5 :gcy%(2)=63 :gcw%(2)=190 :off%(2)=%a :gg%(2)=2
- gcx%(3)=203 :gcy%(3)= 0 :gcw%(3)=207 :off%(3)=1 :gg%(3)=2
- fld%=2 :cur%=off%(fld%)
- vol%=1
- lasttim&=999999999 :nexttim&=lasttim&
- sah&=3600 :sad&=86400 :say&=31536000
- defaultwin 1
- statuswin on,2
- gsetwin 0,0,415,160
- giprint "MultiTimer is Shareware",0 :diaminit 1,"unre-","gistered","version"
- call($138b) REM Unmark as active
- bigfnt%=gloadfont("rom::sa37snd")
- setname "-none-"
- SysReq:(cmd$(3),cmd$(2)) rem open file
- Handler:
- ENDP
-
- PROC SysReq:(act$,file$) REM For system requests
- if act$="X" :if last%>first% :needsav%=2 :endif :Exit: REM Close and Exit
- elseif act$="C" :MkFile:(file$) REM Create new file
- elseif act$="O" :OpenFile:(file$,0) REM Open file
- else :giprint "Sysreq: '"+act$+"' '"+file$+"'"
- endif
- ENDP
-
- PROC Handler:
- global a%(6),keyfun$(8)
- local wrap%
- while 1
- if testevent or last%<first%
- WaitIn::
- onerr Error1
- curact%=0 Rem Indicates Interactive (no process)
- getevent a%()
- if a%(1)<256
- if inpon% and fld%=1
- if a%(1)=8 REM Delete
- if inpval$<>""
- inpval$=left$(inpval$,len(inpval$)-1)
- print chr$(8);" ";chr$(8);
- endif
- elseif a%(1)=13 REM Enter
- par$(inpon%)=inpval$
- flags%(inpon%)=0 REM Set as ready to run
- PntP:(inpon%)
- else
- print chr$(a%(1));
- inpval$=inpval$+chr$(a%(1))
- endif
- continue
- elseif def$(a%(1))<>""
- NewProc:("Parse", def$(a%(1)))
- continue
- endif
- endif
- keyfun$="x"+hex$(a%(1))
- @(keyfun$):
- continue
- Error1::
- if err=-99 :errmsg$="No function defined" :else :errmsg$=err$(err) :endif
- giprint errmsg$+"; '"+chr$(a%(1))+"' ("+keyfun$+")"
- else
- onerr Error2
- wrap%=0
- NextProc::
- curact%=curact%+1
- if curact%>last%
- curact%=first%-1
- wrap%=wrap%+1 :if wrap%>2 :goto WaitIn :endif
- goto NextProc
- elseif flags%(curact%)
- goto NextProc
- endif
- @(op$(curact%)):
- continue
- Error2::
- if err=-99 :errmsg$="No function defined" :else :errmsg$=err$(err) :endif
- if left$(op$(curact%),1)="x" :a%(1)=eval("$"+mid$(op$(curact%),2,len(op$(curact%))-1)) :else :a%(1)=256 :endif
- if a%(1)>255 :elseif def$(a%(1))<>"" :SetProc:("Parse",&0,"",left$(def$(a%(1))+val$(curact%),64)) :continue :endif
- if a%(1)>255
- giprint errmsg$+" ("+op$(curact%)+")"
- else
- giprint errmsg$+" '"+chr$(a%(1))+"' ("+op$(curact%)+")"
- endif
- Parse:
- endif
- endwh
- ENDP
-
- PROC Exit:
- if needsav% :SaveFile:(curfile$) :endif
- if sndon% :Sdone: :endif
- if timon% :Tdone: :endif
- if almon% :Adone: :endif
- gunloadfont bigfnt%
- STOP
- ENDP
-
- PROC UseProc:
- if curact%=0 :NewProc:("Parse","") :endif
- ENDP
-
- PROC NewProc:(op$,val$)
- curact%=0
- SetProc:(op$,&0,"",val$)
- ENDP
-
- PROC SetProc:(op$,par&,par$,val$)
- if curact%=0
- curact%=first%
- while curact%<=last% and flags%(curact%)<>$dead
- curact%=curact%+1
- endwh
- if curact%>last%
- if last%+1>=maxproc%
- giprint "Too many simultaneous jobs"
- curact%=0
- return
- endif
- last%=last%+1
- endif
- endif
- op$(curact%)=op$
- flags%(curact%)=0
- par&(curact%)=par&
- par$(curact%)=par$
- val$(curact%)=val$
- PntP:(curact%)
- ENDP
-
- PROC End:(id%)
- local a%
- if id%<first% or id%>last% :giprint "["+num$(id%,3)+"] No such process to End" :return :endif
- if flags%(id%)=$dead :giprint "Double End:("+num$(id%,3)+")" :return :endif
- if id%=timon% :Tdone: :endif
- if id%=almon% :Adone: :endif
- if id%=sndon% :Sdone: :endif
- if id%=inpon% :Idone: :endif
- if id%=cnton% :Cdone: :endif
- flags%(id%)=$dead :par$(id%)="" :val$(id%)=""
- if id%=last%
- while last%>first% and flags%(last%)=$dead :last%=last%-1 :endwh
- if flags%(last%)=$dead :last%=last%-1 :endif
- endif
- PntP:(id%)
- ENDP
-
- PROC Tstart:
- local stat%
- if timon% :Tdone: :endif
- if almon% :Adone: :endif
- rem queue io timerequest
- timon%=curact% :nexttim&=par&(curact%)
- stat%=ioopen(tim%, "TIM:", 0) :if stat% :ShowErr:("ioopen TIM:",stat%) :endif
- ioc(tim%, 2, timstat%, nexttim&, nexttim&)
- Next:("Waiting until: "+par$(curact%))
- ENDP
-
- PROC Astart:
- local tims&(2),msg$(64),stat%
- if timon% :Tdone: :endif
- if almon% :Adone: :endif
- rem queue io timerequest
- almon%=curact% :nexttim&=par&(curact%)
- stat%=ioopen(alm%, "ALM:", 0) :if stat% :ShowErr:("ioopen ALM:",stat%) :endif
- msg$=par$(curact%)+chr$(0)
- tims&(1)=nexttim& :tims&(2)=nexttim&
- ioc(alm%, 2, almstat%, tims&(), #uadd(addr(msg$),1))
- Next:("Next alarm: "+par$(curact%))
- ENDP
-
- PROC Tdone:
- timon%=0 :Next:("") :msgtim&=0 :nexttim&=lasttim&
- iocancel(tim%) :iowaitstat timstat%
- ioclose(tim%)
- Sig:(sigt%)
- ENDP
-
- PROC Adone:
- almon%=0 :Next:("") :msgtim&=0 :nexttim&=lasttim&
- iocancel(alm%) :iowaitstat almstat%
- ioclose(alm%)
- Sig:(siga%)
- ENDP
-
- PROC Sdone:
- local stat%
- call($2086)
- if snd% :stat% = ioclose(snd%) :snd%=0 :if stat% :giprint "ioclose SND: "+err$(stat%) :endif :endif
- Sig:(sigs%)
- op$(sndon%)="Parse"
- sndon%=0
- ENDP
-
- PROC Idone:
- inpon%=0
- Cursor:(1,0)
- gat 8,29 :ggrey 2 :gfill 245,10,1 :if fld%=1 :con%=0 :endif
- Sig:(sigi%)
- ENDP
-
- PROC Cdone:
- cnton%=0
- ENDP
-
- PROC Kill:(job%)
- local ch$(1)
- if job%=0 REM nothing active - return without killing
- elseif job%<first% or job%>last%
- giprint "Nothing to kill"
- else
- End:(job%)
- giprint "Job "+num$(job%,3)+" killed"
- endif
- ENDP
-
- PROC Parse:
- local f%
- if curact%
- if val$(curact%)=""
- End:(curact%)
- else
- SetProc:("x"+hex$(asc(val$(curact%))),&0,"",mid$(val$(curact%),2,len(val$(curact%))-1))
- endif
- endif
- ENDP
-
- PROC MkFile:(reqfile$)
- local file$(128),o%(6)
- o%(1)=1 :o%(2)=6 :o%(3)=8 :o%(4)=8 :o%(5)=10 :o%(6)=0
- file$=parse$(reqfile$,"LOC::M:\*.MT",o%())
- if needsav% :SaveFile:(curfile$) :endif
- trap create file$,A,func%,def$
- if err
- giprint "Cannot create '"+file$+"': "+err$(err)
- return
- endif
- trap close
- setname file$ :curfile$=file$
- Defaults:
- Repaint:
- ENDP
-
- PROC Defaults:
- fnt%=5 :fnth%=8
- ENDP
-
- PROC OpenFile:(file$,merge%)
- local n%,rec$(255),v&
- if needsav%<>0 and not merge% :SaveFile:(curfile$) :endif
- trap open file$,A,func%,def$
- if err :giprint "Cannot open '"+file$+"': "+err$(err) :return :endif
- if merge%=0
- setname file$ :curfile$=file$
- n%=255 :while n% :def$(n%)="" :n%=n%-1 :endwh
- endif
- busy "Opening file"
- Defaults:
- first
- while not eof
- if a.func%>255
- if merge%=0
- rec$=a.def$
- rem pokew addr(v&),peekw(uadd(addr(rec$),1)) rem 4 byte-copy value
- Rem Unpack, start process
- Rem NewProc:()
- giprint num$(count,5)
- erase :continue REM Erase process entry, now
- endif
- elseif def$(a.func%)<>a.def$
- def$(a.func%)=a.def$ :needsav%=1
- endif
- next
- endwh
- busy off
- trap close
- Repaint:
- ENDP
-
- PROC ShowErr:(txt$, stat%)
- dinit
- dtext "",txt$,$400
- dtext "",err$(stat%),$600
- dtext ""," "
- dbuttons "Exit program",%x,"Continue",-13
- lock on
- if dialog:=%x :Exit: :endif
- lock off
- if curact% :Kill:(curact%) :endif
- ENDP
-
- PROC ondisk:(ptr%)
- if exist(peek$(ptr%)) :return -1 :endif
- pokeb uadd(ptr%,1),%a : if exist(peek$(ptr%)) :return -1 :endif
- pokeb uadd(ptr%,1),%b : if exist(peek$(ptr%)) :return -1 :endif
- ENDP
-
- PROC Repaint:
- gupdate off
- ggrey 2 :gcls :gborder $203 :con%=0
- gfont 7 :gat 3,14 :gprint "MultiTimer ╕1995 Erik Johansen"
- gat 3,40 :glineto 410,40 :gat 3,60 :glineto 410,60 :
- gat 200,40 :glineto 200,155
- gfont fnt%
- gat 3,55 :gprintb "Function definitions",195,3
- gat 203,55 :gprintb "Active jobs",200,3
- Rem code for PntInp:
- if inpon% :at 2,4 :print prompt$;inpval$; :endif
- if fld%=1 :Cursor:(0,0) :endif
- ZeroTim:
- gat 8,18+fnth% :gprintb next$,250,2
- PntDef:
- PntPro:
- gupdate on
- ENDP
-
- PROC ZeroTim:
- Big:("00:00:00")
- ENDP
-
- PROC Big:(msg$)
- gfont bigfnt% :gat 250,38 :gtmode 0 :gprintb msg$,150,1 :gfont fnt%
- ENDP
-
- PROC PntDef:
- local n%
- n%=off%(2)
- gupdate off :while PntD:(n%) :n%=n%+1 :endwh :gupdate off
- ENDP
-
- PROC PntD:(n%)
- local y%
- if n%<off%(2) :return 1 :endif
- y%=63+fnth%*(n%-off%(2)+1)-1
- if y%>=155 :return 0 :endif
- if fld%=2 and n%=cur% and con% :Cursor:(0,0) :endif Rem Unpaint
- gat 5,y% :gprintb num$(n%,3),20,1
- gat 25,y% :gprintb chr$(n%),20,3
- gat 45,y%
- if n%>255
- gprintb "-",150,2
- elseif def$(n%)=""
- gprintb "-",150,2
- else
- gprintb def$(n%),150,2
- endif
- if fld%=2 and n%=cur% :Cursor:(0,0) :endif Rem Paint again
- return 1
- ENDP
-
- PROC PntPro:
- local n%
- n%=off%(3)
- gupdate off :while PntP:(n%) :n%=n%+1 :endwh :gupdate on
- ENDP
-
- PROC PntP:(n%)
- local y%,blank%
- if n%<off%(3) :return 1 :endif
- y%=63+fnth%*(n%-off%(3)+1)-1
- if y%>=155 :return 0 :endif
- if n%>last% :blank%=1 :elseif flags%(n%)=$dead :blank%=1 :endif
- if fld%=3 and n%=cur% and con% :Cursor:(0,0) :endif
- gat 201,y% :gprintb num$(n%,2),15,1
- if blank%
- gat 217,y% :gprintb "-",110,3
- gat 327,y% :gprintb "-",33,3,0,0,5
- gat 360,y% :gprintb "-",50,2,0,0,5
- else
- gat 217,y%
- if par$(n%)<>"":gprintb op$(n%)+" "+par$(n%),110,1
- elseif op$(n%)<>"" :gprintb op$(n%),110,2
- else :gprintb "-",110,3 :endif
-
- gat 327,y% :gprintb sig$:(flags%(n%)),33,3,0,0,5
-
- gat 360,y%
- if val$(n%)<>"" :gprintb val$(n%),50,2,0,0,5
- else :gprintb "-",50,2,0,0,5 :endif
- endif
- if fld%=3 and n%=cur% :Cursor:(0,0) :endif
- return 1
- ENDP
-
- PROC Cursor:(udx%,udy%)
- local dx%,dy%,ofld%,ox%,oy%,ow%,ooff%,og%
- if fld%=1 and udy%<>0 :dx%=udy% :dy%=udx%
- elseif fld%=1 and udx%<>0 and inpon%<>0 REM Add text edit cursor movement here
- else :dx%=udx% :dy%=udy%
- endif
- ofld%=fld%
- ox%=gcx%(fld%) :oy%=gcy%(fld%) :ow%=gcw%(fld%) :ooff%=off%(fld%) :og%=gg%(fld%)
- fld%=fld%+dx% :if fld%<1 :fld%=1 :elseif fld%>3 :fld%=3 :endif
- cur%=cur%-ooff%+off%(fld%)+dy% :if cur%<1 :cur%=1 :elseif cur%>255 :cur%=255 :endif
- if fld%=3 and cur%>30 :cur%=30 :endif
- if fld%=1 :gcy%(fld%)=39-fnth%
- else :gcy%(fld%)=oy%+dy%*fnth% :endif
- if con% and (dx%<>0 or dy%<>0) :gat ox%,oy% :ggrey og% :ginvert ow%,fnth% :con%=1-con% :endif
- if fld%>1 and (gcy%(fld%)<63 or gcy%(fld%)>155-fnth%)
- if gcy%(fld%)<63 :gcy%(fld%)=63 :off%(fld%)=cur% :else :gcy%(fld%)=63+10*fnth% :off%(fld%)=cur%-10 :endif
- if fld%=2 :PntDef: :else :PntPro: :endif
- return
- endif
- gat gcx%(fld%),gcy%(fld%) :ggrey gg%(fld%) :ginvert gcw%(fld%),fnth% :con%=1-con%
- ggrey 2
- ENDP
-
- PROC RelTime$:(t&)
- local res$(30),yr%,mo%,da%,ho%,mi%,se%,yrd%
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- ho%=abs(t&)/sah&
- if ho%>23 :da%=int(ho%/24) :ho%=ho%-24*da% :res$=res$+num$(da%,5)+chr$(31) :endif
- if ho%<10 :res$=res$+"0" :endif
- res$=res$+num$(ho%,2)+":"
- if mi%<10 :res$=res$+"0" :endif
- res$=res$+num$(mi%,2)+":"
- if se%<10 :res$=res$+"0" :endif
- res$=res$+num$(se%,2)
- return res$
- ENDP
-
- PROC AbsTime$:(t&)
- local res$(30),yr%,mo%,da%,ho%,mi%,se%,yrd%
- secstodate abs(t&),yr%,mo%,da%,ho%,mi%,se%,yrd%
- if da%<10 :res$=res$+" " :endif
- res$=res$+num$(da%,2)+"/"+month$(mo%)+"/"+num$(yr%,4)+" "
- if ho%<10 :res$=res$+"0" :endif
- res$=res$+num$(ho%,2)+":"
- if mi%<10 :res$=res$+"0" :endif
- res$=res$+num$(mi%,2)+":"
- if se%<10 :res$=res$+"0" :endif
- res$=res$+num$(se%,2)
- return res$
- ENDP
-
- PROC RecED:
- if cur%<1000 :EDDef:(cur%)
- else EDPro:(cur%)
- endif
- ENDP
-
- PROC EDDef:(n%)
- dinit "Definition for '"+chr$(n%)+"' ("+hex$(n%)+")"
- dedit def$(n%),"",64
- lock on
- if dialog :PntD:(n%) :needsav%=1 :endif
- lock off
- ENDP
-
- PROC EDPro:(n%)
- dinit "Process "+num$(n%,3)
- dedit op$(n%),"Operation",64
- dedit par$(n%),"Parameter",64
- dtext num$(par&(n%),15),"Value",1
- dedit val$(n%),"Next",64
- lock on
- if dialog :PntP:(n%) :endif
- lock off
- ENDP
-
-
- PROC SaveFile:(file$)
- local c%,fdef$(255,64)
- if file$="" :return :endif
- trap open file$,A,func%,def$
- if err :trap create file$,A,func%,def$ :endif
- if err
- giprint "Cannot open '"+file$+"': "+err$(err)
- return
- endif
- busy "Saving"
- Rem Load current contents of file
- first
- while not eof
- if a.func%>255 :erase :continue :endif REM Erase process entries
- fdef$(a.func%)=a.def$
- if a.def$<>def$(a.func%)
- if def$(a.func%)=""
- erase
- else
- a.def$=def$(a.func%) :fdef$(a.func%)=def$(a.func%)
- update :first
- endif
- else
- next
- endif
- endwh
-
- c%=255
- while c%
- if fdef$(c%)="" and def$(c%)<>""
- a.func%=c%
- a.def$=def$(c%)
- append
- endif
- c%=c%-1
- endwh
- if needsav%=2
- busy "Saving (procs)"
- c%=first%
- while c%<=last%
- a.func%=c%+256
- rem flags%(50),op$(50,8),par&(50),par$(50,64),val$(50,64)
- rem flags%() auto-regenerates and can be ignored
- a.def$=" "+op$(c%)+chr$(0)+par$(c%)+chr$(0)+val$(c%)
- rem 0-3 par&()
- rem op$(),par$(),val$() separated by chr$(0)
- append
- c%=c%+1
- endwh
- endif
- trap close :if err<>0 and err<>-102 :giprint "Error closing file '"+file$+"': "+err$(err) :endif
- busy off
- giprint "Saved"
- needsav%=0
- ENDP
-
-
- PROC Now&:
- return datetosecs(year,month,day,hour,minute,second)
- ENDP
-
- PROC Early&:(tim&)
- return int(tim&/sad&)*sad&
- ENDP
-
- PROC CopyBuf:(cut%)
- rem Copy to paste buffer
- if fld%=2
- if def$(cur%)=""
- if cut% :giprint "Nothing to remove" :else :giprint "Nothing to copy" :endif
- else
- bdef$=def$(cur%)
- if cut% :giprint "Removed" :def$(cur%)="" :needsav%=1 :PntD:(cur%) :else :giprint "Copied" :endif
- endif
- elseif fld%=3
- if cur%<first% or cur%>last%
- if cut% :giprint "Nothing to remove" :else :giprint "Nothing to copy" :endif
- else
- bop$=op$(cur%)
- bpar$=par$(cur%)
- bpar&=par&(cur%)
- bflags%=flags%(cur%)
- bval$=val$(cur%)
- if cut% :Kill:(cur%) :else :giprint "Copied" :endif
- endif
- endif
- ENDP
-
- PROC Jump:
- if inpon%=0
- UseProc: :op$(curact%)="Jump" :PntP:(curact%)
- Cursor:(-2,0)
- inpon%=curact% :inpval$=""
- at 2,4 :print "Press key to jump to: ";
- elseif inpon%=curact%
- if inpval$<>""
- Idone:
- Cursor:(0,asc(inpval$)-cur%)
- Parse:
- else
- pause -5
- endif
- else
- SigWait:(sigi%)
- endif
- ENDP
-
-
-
- PROC GetCh$:
- if curact%<first% or curact%>last% :return "" :endif
- if val$(curact%)="" :return "" :endif
- return left$(val$(curact%),1)
- ENDP
-
- PROC ChopCh$:
- local len%
- if curact%<first% or curact%>last% :return "" :endif
- len%=len(val$(curact%))
- if len% <= 1
- val$(curact%)=""
- return ""
- else
- val$(curact%)=mid$(val$(curact%),2,len%-1)
- if val$(curact%)="" :return "" :endif
- return left$(val$(curact%),1)
- endif
- ENDP
-
- PROC GetPara$:(func$,text$)
- local param$(64),ch$(1),level%
- if curact%<first% or curact%>last%
- curact%=0 :if func$<>"" :SetProc:("Input", &0, text$, func$) :Input: :return chr$(0) :else :return "" :endif
- endif
- if inpon%=curact% :IDone: :return inpval$ :endif
- ch$=GetCh$:
- if ch$<>"(" and (ch$<"0" or ch$>"9")
- if func$<>"" :SetProc:("Input", &0, text$, func$+val$(curact%)) :Input: :return chr$(0) :else :return "" :endif
- endif
- if ch$="(" :level%=level%+1 :ch$=ChopCh$: :endif
- while ch$<>"" and (level%>0 or (ch$>="0" and ch$<="9"))
- if ch$="("
- level%=level%+1
- elseif ch$=")"
- level%=level%-1
- if level%=0 :ch$=ChopCh$: :continue :endif
- endif
- param$=param$+ch$
- ch$=ChopCh$:
- endwh
- return param$
- ENDP
-
- Proc Sig$:(sig%)
- local flags$(5)
- if sig%=$dead :return "-" :endif
- if sig% and sigi% :flags$=flags$+"I" :endif rem I
- if sig% and sigt% :flags$=flags$+"T" :endif rem T
- if sig% and sigs% :flags$=flags$+"S" :endif rem S
- if sig% and siga% :flags$=flags$+"A" :endif rem T
- return flags$
- ENDP
-
- Proc Sig:(sig%)
- local i%
- if sig%=0 :return :endif
- i%=first%
- while i%<=last%
- if flags%(i%) and sig%
- flags%(i%)=0 :PntP:(i%)
- endif
- i%=i%+1
- endwh
- ENDP
-
- PROC SigWait:(sig%)
- flags%(curact%)=sig%
- PntP:(curact%)
- ENDP
-
- PROC Input: rem Wait until input is free
- UseProc:
- if inpon%=0
- gat 8,29 :ggrey 2 :gfill 245,10,1 :if fld%=1 :con%=0 :endif
- prompt$=Par$(curact%)
- at 2,4 :print prompt$;
- Cursor:(-2,0)
- inpon%=curact%
- inpval$=""
- Parse:
- endif
- SigWait:(sigi%)
- ENDP
-
- PROC Wait:
- local now&, dummy%
- local yr%,mo%,da%,ho%,mi%,se%,yrd%,wd%
- now& = Now&:
- if Now& >= par&(curact%)
- if timon%=curact% :ZeroTim: :Tdone: :endif
- Parse:
- elseif timon%=curact%
- if now&=msgtim&
- REM Determine number of 1/20 sec until next second
- pause -5 Rem *1/20 sec pause - continue if keypress
- now& = Now&:
- endif
- Big:(RelTime$:(par&(curact%)-Now&))
- msgtim&=now&
- elseif par&(curact%)<nexttim&
- REM my alarm comes first, reset, and set to my time
- Tstart:
- else
- SigWait:(sigt%+siga%) REM Make process wait until counter is free
- endif
- ENDP
-
- PROC Alarm:
- local now&, dummy%
- local yr%,mo%,da%,ho%,mi%,se%,yrd%,wd%
- now& = Now&:
- if Now& >= par&(curact%) and almon%=curact%
- ioyield :ZeroTim:
- if Now& > par&(curact%) REM Wait 2 sec
- Adone:
- Parse:
- endif
- elseif almon%=curact%
- if now&=msgtim&
- REM Determine number of 1/20 sec until next second
- pause -5 Rem *1/20 sec pause - continue if keypress
- now& = Now&:
- endif
- Big:(RelTime$:(par&(curact%)-Now&))
- msgtim&=now&
- elseif par&(curact%)<nexttim&
- Astart: REM my alarm comes first, reset, and set to my time
- else
- SigWait:(sigt%+siga%) REM Make process wait until counter is free
- endif
- ENDP
-
- PROC Next:(msg$)
- next$=msg$
- gat 8,18+fnth% :gprintb next$,250,2
- ENDP
-
- PROC Timer:
- local now&,event%
- if cnton%<>curact%
- REM Another timer or request to stop timer
- if left$(next$,5)="Timer" :Next:("") :endif
- Parse:
- elseif timon%<>0
- SigWait:(sigt%)
- elseif almon%<>0
- SigWait:(siga%)
- else
- if left$(next$,5)<>"Timer" :Next:("Timer (started"+par$(curact%)+")") :endif
- now& = Now&:
- if now&=cntmsg&
- rem event%=256 :ioc(-2,14,event%,0) :return
- REM Determine number of 1/20 sec until next second
- pause -5 Rem *1/20 sec pause - continue if keypress
- now& = Now&:
- endif
- Big:(RelTime$:(Now&-par&(curact%)))
- cntmsg&=now&
- endif
- ENDP
-
- PROC x8: rem Delete
- if fld%=1 and inpon%<>0 and curact%=0
- if inpval$<>""
- inpval$=left$(inpval$,len(inpval$)-1)
- print chr$(8);" ";chr$(8);
- endif
- elseif fld%>1
- CopyBuf:(1)
- endif
- ENDP
-
- PROC x9: rem TAB = Jump to position
- Jump:
- ENDP
-
- PROC xd: rem ENTER = Edit current field (End input if inpon)
- if inpon%
- par$(inpon%)=inpval$
- flags%(inpon%)=0 REM Set as ready to run
- PntP:(inpon%)
- else
- RecED:
- endif
- ENDP
-
- PROC x1b: rem ESC = Cancel sound or background
- if sndon%
- Sdone:
- giprint "Sound canceled"
- else
- call($198d,100,0) Rem background
- endif
- Parse:
- ENDP
-
- PROC x20: rem Space = No function (space in input)
- if inpon%<>0 and curact%=0
- print " ";
- inpval$=inpval$+" "
- else
- Parse:
- endif
- ENDP
-
- PROC x22: rem " = text
- local text$(64),ch$(1)
- ch$=getch$:
- while ch$<>"" and ch$<>"""" :text$=text$+ch$ :ch$=chopch$: :endwh
- if ch$="""" :chopch$: :endif
- giprint text$
- Parse:
- ENDP
-
- PROC x26: rem & = New process (fork&exec look alike)
- local proc$(64)
- proc$=getpara$:("&", "Commands: ") :if proc$=chr$(0) :return :endif
- Parse:
- if proc$<>"" :NewProc:("Parse", proc$) :Parse: :endif
- ENDP
-
- PROC x41: rem A = Alarm
- local param$(64),time$(64),mess$(64),t&,p%
- param$ = GetPara$:("A","Alarm time,message: ") :if param$=chr$(0) :return :endif
- UseProc:
- if param$<>""
- p%=loc(param$,",")
- if p% :time$=left$(param$,p%-1) :mess$=right$(param$,len(param$)-p%) :else :time$=param$ :endif
- t&=ParsTim&:(time$) :if t&=0 :End:(curact%) :return :endif
- SetProc:("Alarm",t&,mess$,val$(curact%)) :Alarm:
- endif
- ENDP
-
- PROC x42: rem B = Beep (3-tone sound)
- beep 1,300 :beep 1,200 :beep 1,300
- Parse:
- ENDP
-
- PROC x43: rem C = Countdown
- local param$(64),stat%,pblk%(3)
- param$=GetPara$:("C","Time,Delay,Cmd:")
- if param$=chr$(0) :return
- elseif param$<>"" :SetProc:("Cdown",&0,param$,val$(curact%)) :Cdown:
- else
- Parse:
- endif
- ENDP
-
- Proc CDown:
- ENDP
-
- PROC x44: rem D = Dial phone number
- local phon$(64),stat%,pblk%(3)
- phon$=GetPara$:("D","Phone number:") :if phon$=chr$(0) :return :endif
- if phon$<>""
- stat% = ioopen(snd%, "SND:", 0) :if stat% :ShowErr:("ioopen SND:",stat%) :endif
- pblk%(1)=5*256+4 rem Tone length *256 + delay length
- pblk%(2)=32 rem Pause length
- phon$=phon$+chr$(0)
- stat% = iow(snd%, 10, #uadd(addr(phon$),1), pblk%()) :if stat% :ShowErr:("iow SND:",stat%) :endif
- stat% = ioclose(snd%) :snd%=0 :if stat% :ShowErr:("ioclose SND:",stat%) :endif
- endif
- Parse:
- ENDP
-
- PROC x4c: rem L - Listen for sounds
- giprint "Listen (not impl.)"
- Parse:
- ENDP
-
- PROC x4d: rem M = Macro call (Tom Dolbilin)
- local macro$(64),macsys$(20)
- macro$=GetPara$:("M", "Macro:") :if macro$=chr$(0) or macro$="" :return :endif
- macsys$="m:\app\macro.opa"
- if not ondisk:(addr(macsys$)) :giprint macsys$+": Macro system not found." :return :endif
- trap loadm macsys$ :if err :giprint macsys$+": "+err$(err) :return :endif
- busy "Running macro '"+macro$+"'"
- runmacro:(macro$, "macro")
- busy off
- unloadm macsys$
- Parse:
- ENDP
-
- PROC x4e: rem N = Note (play)
- local notes$(64)
- notes$=lower$(GetPara$:("N", "Notes to play:"))
- if notes$=chr$(0)
- elseif notes$<>""
- SetProc:("Note",&0,notes$,val$(curact%)) :Note:
- else
- Parse:
- endif
- ENDP
-
- PROC Note:
- local c$(1),tim%,tp%,n%,stat%,notes$(64),no%(130)
- if sndon%=curact%
- if sndstat%=-46
- pause -5
- else
- if sndstat% :giprint err$(sndstat%) :endif
- if sndsta2% :giprint err$(sndsta2%) :endif
- Sdone:
- Parse:
- endif
- elseif sndon%
- SigWait:(sigs%) Rem Wait till sound device is free
- else
- sndon%=curact%
- notes$=par$(curact%)
- tim%=1 :tp%=0
- while notes$<>""
- c$=left$(notes$,1) :notes$=right$(notes$,len(notes$)-1)
- if c$>="0" and c$<="9"
- tim%=asc(c$)-48 :c$=left$(notes$,1)
- while c$>="0" and c$<="9" :tim%=tim%*10+asc(c$)-48 :notes$=right$(notes$,len(notes$)-1) :c$=left$(notes$,1) :endwh
- elseif c$>="a" and c$<="z"
- n%=asc(c$)-96
- if n%>3 :n%=n%+1 :endif
- if n%>5 :n%=n%+1 :endif
- if n%>8 :n%=n%+1 :endif
- if n%>10 :n%=n%+1 :endif
- if n%>=12 :n%=n%+1 :endif
- rem n%=1..16 delay=512000/(freq=440*2**(n%/12.0))-1.0 & 440 Hz = middle A
- if tp%>=128 :giprint "Too many notes" :break :endif
- tp%=tp%+1 :no%(tp%)=440*2**(n%/12.0)
- tp%=tp%+1 :no%(tp%)=tim%
- elseif c$=" "
- if tp%>=128 :giprint "Too many notes" :break :endif
- tp%=tp%+1 :no%(tp%)=0
- tp%=tp%+1 :no%(tp%)=tim%
- elseif def$(asc(c$))<>""
- notes$=left$(def$(asc(c$))+notes$,64)
- elseif c$<>"(" and c$<>")"
- giprint "N("+c$+") No such note"
- endif
- endwh
- tp%=tp%/2
- stat% = ioopen(snd%, "SND:", -1) :if stat% :giprint "ioopen SND: "+err$(stat%) :return :endif
- ioc(snd%, 1, sndstat%, no%(), tp%)
- ioc(snd%, 2, sndsta2%, no%(), tp%)
- endif
- ENDP
-
- PROC x4f: rem O = One-time sequence
- x26: Rem Same functionality as & (fork/spawn)
- ENDP
-
- PROC x50: rem P = Power off
- Parse:
- off
- ENDP
-
- PROC x52: rem R = Repeat
- local n%,rep$(64)
- rep$=GetPara$:("","") :if rep$="" :giprint "No repeat count specified" :Parse: :return :endif
- n%=val(rep$)-1
- rep$=GetPara$:("","") :if rep$="" :giprint "No repeat operation specified" :Parse: :return :endif
- if n%>=0
- val$(curact%)=left$(rep$+"R"+num$(n%,5)+"("+rep$+")"+val$(curact%),64)
- PntP:(curact%)
- endif
- Parse:
- ENDP
-
- PROC x53: rem S = Sound file
- local file$(64),oldin%,ticks&,p%
- oldin%=inpon%
- file$=GetPara$:("S", "File to play:") :if file$=chr$(0) :return :endif
- if file$=""
- Parse: Rem No input supplied
- else
- p%=loc(file$,",")
- if p% :ticks&=val(right$(file$,len(file$)-p%)) :file$=left$(file$,p%-1) :else :ticks&=500 :endif
- SetProc:("Sound",ticks&,file$,val$(curact%)) :Sound:
- endif
- ENDP
-
- PROC Sound:
- local name$(128),ticks%
- if sndon%=curact%
- if sndstat%<>-46
- Sdone: :Parse:
- else
- pause -5 REM Hang around until sound finishes
- endif
- elseif sndon%
- SigWait:(sigs%) Rem Wait till sound device is free
- else
- sndon%=curact%
- giprint "Playing sound file '"+par$(curact%)+"'"
- name$=par$(curact%)
- if name$>="1" and name$<="9" :name$="SYS$AL0"+name$ :endif
- if mid$(name$,3,1)<>":" :name$="*"+name$ :endif
- name$=name$+chr$(0)
- ticks%=par&(curact%)
- call($1E86,UADD(ADDR(name$),1),ticks%,vol%,0,addr(sndstat%))
- endif
- ENDP
-
- PROC x54: rem T = Timer (Count up)
- if cnton%
- Cdone:
- Parse:
- else
- UseProc:
- cnton%=curact%
- SetProc:("Timer",Now&:," "+right$(AbsTime$:(Now&:),8),val$(curact%)) :Timer:
- endif
- ENDP
-
- PROC x56: rem V = Volume
- local param$(64),c$(1),stat%,v%
- param$ = GetPara$:("V", "Volume control:") :if param$=chr$(0) :return :endif
- while param$<>""
- c$=left$(param$,1) :param$=right$(param$,len(param$)-1)
- if c$>="0" and c$<="4"
- stat% = ioopen(snd%, "SND:", 0) :if stat% :giprint err$(stat%) :endif
- stat% = iow(snd%, 8, v%, v%) :if stat% :giprint err$(stat%) :endif
- vol%=53-asc(c$) :v%=(v% and $FF00) or vol%
- stat% = iow(snd%, 7, v%, v%) :if stat% :giprint err$(stat%) :endif
- stat% = ioclose(snd%) :snd%=0 :if stat% :giprint err$(stat%) :endif
- elseif c$="s" :call($108B,call($0f8b) or $8000)
- elseif c$="S" :call($108B,call($0f8b)and $7FFF)
- elseif c$="k" :call($108B,call($0f8b)and $FFFE)
- elseif c$="K" :call($108B,(call($0f8b)and $7FFF)or $1)
- elseif c$="b" :call($108B,call($0f8b)and $FFFD)
- elseif c$="B" :call($108B,(call($0f8b)and $7FFF)or $2)
- elseif c$="a" :call($108B,call($0f8b)and $FFFB)
- elseif c$="A" :call($108B,(call($0f8b)and $7FFF)or $4)
- elseif c$="c" :call($108B,call($0f8b)and $FFF7)
- elseif c$="C" :call($108B,(call($0f8b)and $7FFF)or $8)
- elseif c$="n" :call($108B,call($0f8b)and $FFEF)
- elseif c$="N" :call($108B,(call($0f8b)and $7FFF)or $10)
- else
- giprint "V("+c$+") No such option"
- endif
- endwh
- Parse:
- ENDP
-
- PROC x57: rem W = Wait
- local param$(64),t&,v$(64),oldin%
- oldin%=inpon%
- UseProc:
- if val$(curact%)=""
- param$ = GetPara$:("WB","Wait time: ")
- else
- param$ = GetPara$:("W","Wait time: ")
- endif
- if param$=chr$(0)
- elseif param$=""
- Parse:
- else
- t&=ParsTim&:(param$)
- if t&=0 :End:(curact%) :return :endif
- SetProc:("Wait",t&,AbsTime$:(t&),val$(curact%)) :Wait:
- endif
- ENDP
-
- PROC ParsTim&:(txt$)
- local t$(64),t&,f$(1),rt&
- local ws%,w%(8),ds%,d%(32),ys%,y%,n&,d%
- local yrspec%,mospec%, daspec%, wdspec%, hospec%, mispec%, sespec%
- local mook%(12),daok%(33),wdok%(7),hook%(25),miok%(61),seok%(61)
- local yr%,mo%,da%,ho%,mi%,se%,yrd%,wd%
- t$=lower$(txt$) :f$=left$(t$,1)
- n&=0 :d%=0 :while f$>="0" and f$<="9" and t$<>"" :d%=d%+1 :n&=n&*10+asc(f$)-asc("0") :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- if d% and (f$="d" or f$="h" or f$="m" or f$="s" or f$="")
- while f$="d" or f$="h" or f$="m" or f$="s"
- if f$="d" :t&=t&+n&*60*60*24 :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1)
- elseif f$="h" :t&=t&+n&*60*60 :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1)
- elseif f$="m" :t&=t&+n&*60 :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1)
- elseif f$="s" :t&=t&+n& :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1)
- endif
- while f$=" " :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- n&=0 :d%=0 :while f$>="0" and f$<="9" and t$<>"" :d%=d%+1 :n&=n&*10+asc(f$)-asc("0") :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- endwh
- t&=t&+n&+Now&:
- else
- t&=Now&:
- rem mon-sun,jan-dec,dd/mm/yy,hh:mm:ss
- while t$<>""
- if f$="/"
- t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1)
- if n&>33 :print "Invalid Day" :return 0 :elseif d% :daspec%=1 :daok%(n&)=1 :endif
- n&=0 :d%=0 :while f$>="0" and f$<="9" and t$<>"" :d%=d%+1 :n&=n&*10+asc(f$)-asc("0") :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- if d%=0 and len(t$)>=3 :n&=Month:(left$(t$,3)) :if n& :t$=mid$(t$,4,len(t$)-3) :f$=left$(t$,1) :d%=1 :endif :endif
- if n&>12 :print "Invalid Month" :return 0
- elseif d% :mospec%=1 :mook%(n&)=1
- endif
- if f$="/" :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endif
- n&=0 :d%=0 :while f$>="0" and f$<="9" and t$<>"" :d%=d%+1 :n&=n&*10+asc(f$)-asc("0") :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- if d%
- if n&<200 :n&=n&+1900 :endif
- if n&<1970 or n&>2035 :print "Invalid Year "+num$(n&,4) :return 0
- else :yrspec%=n&
- endif
- endif
- n&=0 :d%=0
- elseif f$=":"
- t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1)
- if n&>24 :print "Invalid Hour" :return 0
- elseif d% :hospec%=1 :hook%(n&+1)=1
- endif
- n&=0 :d%=0 :while f$>="0" and f$<="9" and t$<>"" :d%=d%+1 :n&=n&*10+asc(f$)-asc("0") :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- if n&>60 :print "Invalid Minute" :return 0
- elseif d% :mispec%=1 :miok%(n&+1)=1
- endif
- if f$=":" :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endif
- n&=0 :d%=0 :while f$>="0" and f$<="9" and t$<>"" :d%=d%+1 :n&=n&*10+asc(f$)-asc("0") :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- if n&>60 :print "Invalid Second" :return 0
- elseif d% :sespec%=1 :seok%(n&+1)=1
- endif
- elseif ((f$>="a" and f$<="z") or (f$>="A" and f$<="Z")) and len(t$)>=3
- if Month:(left$(t$,3))
- if n&>0 and n&<=31 :daspec%=1 :daok%(n&)=1 :endif
- mospec%=1 :mook%(Month:(left$(t$,3)))=1
- t$=mid$(t$,4,len(t$)-3) :f$=left$(t$,1)
- elseif WDay:(left$(t$,3))
- wdspec%=1 :wdok%(WDay:(left$(t$,3)))=1
- t$=mid$(t$,4,len(t$)-3) :f$=left$(t$,1)
- elseif left$(t$,3)="tom"
- if len(t$)>=8 :t$=mid$(t$,9,len(t$)-8) :else :t$=mid$(t$,4,len(t$)-3) :endif
- f$=left$(t$,1)
- secstodate t&+sad&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- yrspec%=yr%
- mospec%=1 :mook%(mo%)=1
- daspec%=1 :daok%(da%)=1
- else
- giprint "'"+t$+"' not understood" :return 0
- endif
- elseif f$=" "
- t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1)
- else
- giprint "'"+t$+"' not understood" :return 0
- endif
- n&=0 :d%=0 :while f$>="0" and f$<="9" and t$<>"" :d%=d%+1 :n&=n&*10+asc(f$)-asc("0") :t$=mid$(t$,2,len(t$)-1) :f$=left$(t$,1) :endwh
- endwh
- wd%=1
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- while 1
- if wdspec% :wd%=dow(da%,mo%,yr%) :endif
- if yrspec%<>0 and yrspec%<yr%
- giprint "Time cannot be matched" :return now&:
- elseif yrspec%>yr%
- t&=t&-se%-60*mi%-sah&*ho%-sad&*(yrd%-1)+say&*(yrspec%-yr%)+sad&*int((yrspec%-yr%)/4)
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- while yr%<yrspec% REM in case of 366 days/year
- t&=t&+sad&
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- endwh
- elseif mospec%<>0 and mook%(mo%)=0
- t&=t&-se%-60*mi%-sah&*ho%-sad&*(da%-1)+sad&*33
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- t&=t&-sad&*(da%-1)
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- elseif (daspec%<>0 and daok%(da%)=0) or (wdspec%<>0 and wdok%(wd%)=0)
- t&=t&-se%-60*mi%-sah&*ho%+sad&
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- elseif (hospec%<>0 and hook%(ho%+1)=0)
- t&=t&-se%-60*mi%+sah&
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- elseif (mispec%<>0 and miok%(mi%+1)=0)
- t&=t&-se%+60
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- elseif (sespec%<>0 and seok%(se%+1)=0)
- t&=t&+1
- secstodate t&,yr%,mo%,da%,ho%,mi%,se%,yrd%
- else
- break
- endif
- endwh
- endif
- return t&
- ENDP
-
- PROC Month:(mnth$)
- local m$(3)
- m$=mnth$
- if m$="jan" :return 1
- elseif m$="feb" :return 2
- elseif m$="mar" :return 3
- elseif m$="apr" :return 4
- elseif m$="may" :return 5
- elseif m$="jun" :return 6
- elseif m$="jul" :return 7
- elseif m$="aug" :return 8
- elseif m$="sep" :return 9
- elseif m$="oct" :return 10
- elseif m$="nov" :return 11
- elseif m$="dec" :return 12
- else return 0
- endif
- ENDP
-
- PROC Wday:(weekday$)
- local day$(3)
- day$=weekday$
- if day$="mon" :return 1
- elseif day$="tue" :return 2
- elseif day$="wed" :return 3
- elseif day$="thu" :return 4
- elseif day$="fri" :return 5
- elseif day$="sat" :return 6
- elseif day$="sun" :return 7
- else return 0
- endif
- ENDP
-
- PROC x100: rem up
- if a%(2) and 2 rem Shift
- Cursor:(0,-2)
- elseif a%(2) and 4 rem Control
- Cursor:(0,-4)
- else
- Cursor:(0,-1)
- endif
- ENDP
-
- PROC x101: rem down
- if a%(2) and 2 rem Shift
- Cursor:(0,2)
- elseif a%(2) and 4 rem Control
- Cursor:(0,4)
- else
- Cursor:(0,1)
- endif
- ENDP
-
- PROC x102: rem right
- if a%(2) and 6 rem Shift or control
- Cursor:(2,0)
- else
- Cursor:(1,0)
- endif
- ENDP
-
- PROC x103: rem left
- if a%(2) and 6 rem Shift or control
- Cursor:(-2,0)
- else
- Cursor:(-1,0)
- endif
- ENDP
-
- PROC x104: rem Page up
- Cursor:(0,-20)
- ENDP
-
- PROC x105: rem Page down
- Cursor:(0,20)
- ENDP
-
- PROC x106: rem Home / Page left
- Cursor:(0,-255)
- ENDP
-
- PROC x107: rem End / Page right
- Cursor:(0,255)
- ENDP
-
- PROC x122: rem Menu
- local menu%
- onerr Error
- minit
- mcard "File","Open file",%o,"Merge file",%m,"New file",%n,"Save",%s,"Save as",%a,"Who did this?",%w,"Exit",%x
- mcard "Edit","Insert",%i,"Copy",%c,"Delete",%d,"Edit",%e
- mcard "Screen","Repaint",%r,"Jump to",%j
- lock on :menu% = MENU :lock off
- if menu%
- @("x"+hex$(menu%+$200)):
- endif
- return
- Error::
- giprint "Menu function "+hex$(menu%+$200)+": "+err$(err)
- ENDP
-
- PROC x123: rem Help
- while 1
- onerr Missing
- dinit "Help"
- dtext "","Functions",$400
- dtext "","Parameters",$400
- lock on :s%=dialog :lock off
- if s% :@("Help"+num$(s%-1,1)): :else :return :endif
- continue
- Missing::
- giprint "Help missing ("+err$(err)+")"
- endwh
- ENDP
-
- PROC help1:
- while 1
- dinit "Functions 1/3"
- dtext "A(Time,Message)","Alarm (normal)"
- dtext "B","Beep (3 tone bleep)"
- rem dtext "C(Time,Sec,Delta)","Countdown"
- rem to Time,beep every Delta sec, Sec seconds before time
- dtext "D(Phonenumber)","Dial phone number"
- rem E - Every xx, for yy sec do zz
- dtext "M(Macro)","Call Tom Dolbilin's Macro system"
- dtext "N(Notes)","Play notes"
- dtext "O(Commands)","One-time sequence"
- lock on :s%=dialog :lock off :if s%=0 :return :endif
- dinit "Functions 2/3"
- dtext "P","Power off"
- dtext "Rn(Commands)","Repeat n times"
- dtext "S(Soundfile[,Ticks])","Play soundfile"
- dtext "V(Volume control)","Volume control"
- dtext "W(Time)","Wait for/until time"
- dtext "<function>","Call function definition"
- lock on :s%=dialog :lock off :if s%=0 :return :endif
- dinit "Functions 3/3"
- dtext """<text>""","Print text"
- dtext "&(Commands)","Create paralell process"
- dtext "<space>","Ignored"
- lock on :s%=dialog :lock off :if s%=0 :return :endif
- endwh
- ENDP
- PROC help2:
- while 1
- dinit "Parameters"
- dtext "","Time format",$400
- dtext "","Note parameters",$400
- dtext "","Volume parameters",$400
- lock on :s%=dialog :lock off
- if s% :@("Help2"+num$(s%-1,1)): :else :return :endif
- endwh
- ENDP
- PROC Help21:
- while 1
- dinit "Time format"
- dtext "","Absolute time",$400
- dtext "","Relative time",$400
- dtext "","Absolute and Relative times cannot be mixed"
- lock on :s%=dialog :lock off
- if s% :@("Help21"+num$(s%-1,1)): :else :return :endif
- endwh
- ENDP
- PROC Help211:
- dinit "Absolute Time"
- dtext "Any combination of"," "
- dtext "12:30:00","Time"
- dtext "1/jan/1995","Date"
- dtext "mon-sun, jan-dec","Weekdays, Months"
- dtext "Tomorrow","Tomorrow at 00:00:00"
- dtext "","Values in Date and Time can be left out to indicate"
- dtext "","only the wanted values. ie. 3/ is 3rd day of the month"
- dtext "","//1998 specifies only the year"
- lock on :dialog :lock off
- ENDP
- PROC Help212:
- dinit "Relative Time"
- dtext "","Relative times are specified as values plus optional multipliers"
- dtext "s","Seconds (default if no multiplier)"
- dtext "m","Minutes"
- dtext "h","Hours"
- dtext "d","Days"
- dtext ""," "
- dtext "Examples:","3h5m 2d5m 500 2h 5m 1h30m12s"
- lock on :dialog :lock off
- ENDP
- PROC Help22:
- dinit "Note parameters"
- dtext "<number>","Specifies note length in 1/20 seconds"
- dtext "a-z","Plays a note (based on 440hz middle tone)"
- dtext "<space>","Pause in note"
- dtext ""," "
- dtext "Example:","N(5a20z z z5a)"
- lock on :dialog :lock off
- ENDP
- PROC Help23:
- dinit "Volume parameters"
- dtext "1-5","Volume level"
- dtext "s/S","Sound system (all) on/off"
- dtext "K/B/A","Keyboard/Beep/Alarm sound on"
- dtext "k/b/a","Keyboard/Beep/Alarm sound off"
- dtext "c/C","Low/High Click (keyboard)"
- dtext "n/N","Low/High Notes (beep)"
- dtext ""," "
- dtext "Example:","V5 V(1k"
- lock on :dialog :lock off
- ENDP
-
- PROC x124: rem Star/diamond
- x277:
- ENDP
-
- PROC x263: rem psion-c = Copy
- CopyBuf:(0)
- ENDP
-
- PROC x264: rem psion-d = Delete Project/Entry
- x8: rem Delete
- ENDP
-
- PROC x265: rem psion-e = Edit
- RecED:
- ENDP
-
- PROC x269: rem psion-i = Insert
- local c%
- if fld%=2
- if bdef$=""
- giprint "Nothing to insert"
- else
- def$(cur%)=bdef$ :PntD:(cur%) :needsav%=1
- endif
- elseif fld%=3
- if bop$=""
- giprint "Nothing to insert"
- else
- c%=cur%
- if cur%<first% or cur%>last% :last%=last%+1 :c%=last% :endif
- op$(c%)=bop$
- par$(c%)=bpar$
- flags%(c%)=0 rem bflags%
- par&(c%)=bpar&
- val$(c%)=bval$
- PntP:(c%)
- endif
- endif
- ENDP
-
- PROC x26a: rem psion-j = Jump to
- Jump:
- ENDP
-
- PROC x261: rem Save As
- local reqfile$(128),file$(128),ret%,o%(6)
- o%(1)=1 :o%(2)=6 :o%(3)=8 :o%(4)=8 :o%(5)=10 :o%(6)=0
- dinit "Save as"
- dfile reqfile$,"",$9
- lock on :ret%=dialog :lock off
- if ret%
- curfile$=parse$(reqfile$,"LOC::M:\*.MT",o%())
- SaveFile:(curfile$)
- setname curfile$
- endif
- ENDP
-
- PROC x26d: rem psion-m = Merge
- local file$(128),ret%
- dinit "Merge file"
- dfile file$,"",$10
- lock on :if dialog :OpenFile:(file$,1) :endif :lock off
- ENDP
-
- PROC x26E: rem psion-n = New file
- local file$(128),ret%
- dinit "Make new file"
- dfile file$,"",$9
- lock on :ret% = dialog :lock off
- if ret% :MkFile:(file$) :endif
- ENDP
-
- PROC x26f: rem psion-o = Open/Load
- local file$(128),ret%
- dinit "Open file"
- dfile file$,"",$10
- lock on :if dialog :OpenFile:(file$,0) :endif :lock off
- ENDP
-
- PROC x272: rem psion-r - Repaint
- Repaint:
- ENDP
-
- PROC x273: Rem Save
- SaveFile:(curfile$)
- ENDP
-
- PROC x277: rem psion-w = Who created this ? (whoinfo)
- dinit "MultiTimer"
- dtext "","Version 1.00",2
- dtext "","Created Sep 1995 - Dec 1995",2
- dtext "","by",2
- dtext "","Erik Johansen",$102
- dtext "","ej@it.dtu.dk",$102
- lock on :dialog :lock off
- dinit "MultiTimer is Shareware"
- dtext "","If you have decided to keep and use Multitimer",2
- dtext "","please send me $10 as shareware fee.",2
- dtext ""," "
- dtext "","Please include your name and E-mail address.",2
- dtext "","I will add you to my mailing list and send you",2
- dtext "","the newest registered version of MultiTimer.",2
- lock on :dialog :lock off
- dinit "So where do I send the money?"
- dtext "","Send $10 in your local currency to:"
- dtext "","(No coins, please)",2
- dtext ""," "
- dtext "","Erik Johansen",$102
- dtext "","Department of Information Technology",$102
- dtext "","DTU, building 344/345",$102
- dtext "","2800 Lyngby",$102
- dtext "","Denmark",$102
- lock on :dialog :lock off
- ENDP
-
- PROC x278: rem psion-x = Exit
- Exit:
- ENDP
-
- PROC x401: rem Foreground
- giprint "Press Psion-W for info",0
- ENDP
-
- PROC x402: rem Background
- ENDP
-
- PROC x403: rem Powerup
- Rem To enable wakeup (power on) signals
- Rem add the following call at start of
- Rem the program: call($6c8d)
- Rem How come the signal comes in anyway ?
- x401:
- ENDP
-
- PROC x404: rem sys request
- local c$(129)
- c$ = getcmd$
- SysReq:(left$(c$,1),mid$(c$,2,128))
- ENDP
-
- PROC x405: rem Date change
- ENDP
-
- PROC x2000: rem + contrast
- ENDP
-
- PROC x2001: rem - contrast
- ENDP
-
-