summaryrefslogtreecommitdiff
path: root/app/schulis-mathematiksystem/1.0/src/PAC formula editor-anpassung
blob: dae28a7f89eb7d2eed65247524aad815adbadaa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
PACKETformulaeditorDEFINESresetformulaeditor,outformula,showformula,editformula,defformeditwindow,getformeditwindow,defformeditoffset,getformeditoffset,defformeditshift,getformeditshift,defformeditcursor,getformeditcursor,defformeditpointer,getformeditpointer,moveformeditpointer,defformeditexitkeys,getformeditexitkeys,formeditexitkey,defformeditbuffer,getformeditbuffer,formeditbuffer,defformeditarith,getformeditarith,formeditarith,defformediterror,getformediterror,formediterror,defformeditbeep,getformeditbeep,formeditbeep,defformeditrubin,getformeditrubin,formeditrubin,defformeditlearn,getformeditlearn,formeditlearn,defformeditkeys,getformeditkeys,formeditkeys,defformeditmark,getformeditmark,formeditmark,displayformeditbuffer,clearformeditbuffer,displayformeditarith,clearformeditarith,displayformediterror,clearformediterror,displayformeditrubin,clearformeditrubin,displayformeditlearn,clearformeditlearn,:LETnilidx=0;TEXT VARnilari;LETatomidx=1;TEXT VARatomari,atomscr;LETtimesidx=2;TEXT VARtimesari,timesscr;LETapplyidx=3;TEXT VARapplyari,applyscr;LETifidx=4;TEXT VARifari;LETfiidx=5;TEXT VARfiari;LETthenidx=6;TEXT VARthenari;LETelif1idx=7;TEXT VARelif1ari;LETelif2idx=8;TEXT VARelif2ari;LETelif3idx=9;TEXT VARelif3ari;LETmonadidx=10;INT VARprefixlbp,postfixrbp;LETlforceidx=11;TEXT VARlforceari;LETrforceidx=12;TEXT VARrforceari;LETbegdifidx=13;TEXT VARbegdifari;LETenddifidx=14;TEXT VARenddifari;LETlparidx=15;INT VARlparlbp,lparrbp;TEXT VARlparari;LETrparidx=16;INT VARrparlbp,rparrbp;TEXT VARrparari;INT VARpointermode;INT VARnodc,adrc;INT VARnod1,nod2,nodx,adr1,adr2;INT VARlnod,rnod,pnod,inod,snod;INT VARidx;TEXT VARltrm,rtrm;TEXT VARtrm;INT VARtpos,tlen;INT VARapos,abeg,aend;INT VARpbeg,pend;INT VARxobj,yobj,xbeg,ybeg,xend,yend;INT VARxpoi,ypoi,xmin,ymin,xmax,ymax;INT VARxoff,yoff;INT VARxcur,ycur,xlow,ylow,xhig,yhig;INT VARxrel,yrel;INT VARdummy;BOOL VARbufferon;BOOL VARarithon;BOOL VARerroron;BOOL VARbeepon;BOOL VARrubinon;BOOL VARlearnon;BOOL VARkeyson;BOOL VARmarkon;INT VARxbuffer,ybuffer,lbuffer;INT VARxarith,yarith,larith;INT VARxerror,yerror,lerror;INT VARxrubin,yrubin;INT VARxlearn,ylearn;INT VARxkeys,ykeys;INT VARdspxmin,dspymin,dspxmax,dspymax;INT VARdspxbeg,dspybeg,dspxend,dspyend;TEXT VARdspbuffer,clrbuffer;TEXT VARdsparith,clrarith;TEXT VARdsperror,clrerror;TEXT VARdsprubin,clrrubin;TEXT VARdsplearn,clrlearn;TEXT VARdspkeys,clrkeys;TEXT VARdspmark,clrmark;resetformulaeditor;TEXT VARbuffer:="";BOOL VARwriteenabled;BOOL VARquiteditor;BOOL VARnewdisplay,regenerate;BOOL VARlearnmode:=FALSE;BOOL VARrubinmode:=FALSE;INT VARheadpos;TEXT VARlearnedkeys:="";TEXT VARrec;TEXT VARexitkey:="";BOOL VARwashop,wasesc;TEXT VARstdkeys:="",hopkeys:="",esckeys:="";LETkeys="�����
��
�� bpdg()[]{}|<>=^_/*�BPIWDA;!";LEThopkey=1;LETrightkey=2;LETupkey=3;LETleftkey=4;LETtabkey=5;LETdownkey=6;LETrubinkey=7;LETruboutkey=8;LETreturnkey=9;LETesckey=11;LETbkey=13;LETpkey=14;LETdkey=15;LETgkey=16;LETlparkey=17;LETrparkey=18;LETlbrakey=19;LETrbrakey=20;LETlcmtkey=21;LETrcmtkey=22;LETabskey=23;LETlesskey=24;LETgreaterkey=25;LETequalskey=26;LETcircumflexkey=27;LETunderlinekey=28;LETslashkey=29;LETstarkey=30;LETrootkey=31;LETcapbkey=32;LETcappkey=33;LETcapikey=34;LETcapwkey=35;LETcapdkey=36;LETcapakey=37;LETsemicolonkey=38;LETexclamationkey=39;PROCgetfixedops:nilari:=oparithsymbol(nilidx);atomari:=oparithsymbol(atomidx);atomscr:=opscreensymbol(atomidx);timesari:=oparithsymbol(timesidx);timesscr:=opscreensymbol(timesidx);applyari:=oparithsymbol(applyidx);applyscr:=opscreensymbol(applyidx);ifari:=oparithsymbol(ifidx);fiari:=oparithsymbol(fiidx);thenari:=oparithsymbol(thenidx);elif1ari:=oparithsymbol(elif1idx);elif2ari:=oparithsymbol(elif2idx);elif3ari:=oparithsymbol(elif3idx);getoppower(monadidx,prefixlbp,postfixrbp);lforceari:=oparithsymbol(lforceidx);rforceari:=oparithsymbol(rforceidx);begdifari:=oparithsymbol(begdifidx);enddifari:=oparithsymbol(enddifidx);lparari:=oparithsymbol(lparidx);getoppower(lparidx,lparlbp,lparrbp);rparari:=oparithsymbol(rparidx)
;getoppower(rparidx,rparlbp,rparrbp);END PROCgetfixedops;PROCshowformula:editformula(FALSE);END PROCshowformula;PROCeditformula:editformula(TRUE);END PROCeditformula;PROCeditformula(BOOL CONSTwriteaccess):enablestop;dspxmin:=xlow-xoff;dspymin:=ylow-yoff;dspxmax:=xhig-xoff;dspymax:=yhig-yoff;getformulalength(xmin,ymin,xmax,ymax);xminDECR1;xmaxINCR1;IFesckeys=""THENclearformula;outformula;LEAVEeditformula;FI;writeenabled:=writeaccess;quiteditor:=esckeys="";newdisplay:=TRUE;pointermode:=pointermodeMAX2;xrel:=0;yrel:=0;getfixedops;REPcomputepointers;displayformeditarith;IFnewdisplayTHENnewdisplay:=FALSE;clearformula;outformula;headpos:=xkeys;displayformeditbuffer;IFrubinmodeTHENdisplayformeditrubinFI;IFlearnmodeTHENdisplayformeditlearnFI;FI;processstdkey;IFregenerateTHENregenerate:=FALSE;out("�");regenerateformula(nodc,adrc);getformulalength(xmin,ymin,xmax,ymax);xminDECR1;xmaxINCR1;nod1:=nodc;adr1:=adrc;FI;UNTILquiteditorPER;out("�");.computepointers:REP SELECTpointermodeOF CASE4:computenodcfromadrc;CASE3:computepoifromnodc;CASE2:computenod1frompoi;CASE1:computetrefromnod1;OTHERWISE LEAVEcomputepointers;END SELECT;PER;.computenodcfromadrc:FORnodcFROMformulacomplexityDOWNTO1REP UNTILformulaaddress(nodc)=adrcPER;pointermode:=3;.computepoifromnodc:nod1:=nodc;adr1:=adrc;IFnod1>0THENgetformulaobject(nod1,xobj,yobj);xobjINCRxrel;xrel:=0;yobjINCRyrel;yrel:=0;ELIFadr1>0THENxobj:=xmax;yobj:=ymax;ELSExobj:=xmin;yobj:=ymin;FI;defformeditpointer(xobj,yobj);pointermode:=2;.computenod1frompoi:nod1:=formulanode(xpoi,ypoi);pointermode:=1;.computetrefromnod1:getformulaaddress(nod1,nod2,nodx,adr1,adr2);getformulatree(nod1,lnod,rnod,pnod,inod);getformulaobject(nod1,xobj,yobj);getformulapos(adr1,abeg,aend,idx,dummy);getformulaterm(adr1,trm);tlen:=LENGTHtrm;tpos:=0MAXxpoi-xobj+1MINtlen+1;SELECTnodxOF CASE1:getformulabox(nod1,xbeg,ybeg,xend,yend);aend:=formulaend(adr2);apos:=abegMAXabeg+xpoi-xobjMINaend+1;CASE2:getformulabox(nod2,xbeg,ybeg,xend,yend);abeg:=formulabeg(adr2);apos:=abegMAXaend+xpoi-xobjMINaend+1;OTHERWISExbeg:=0;ybeg:=0;xend:=0;yend:=0;abeg:=0;aend:=0;apos:=0;END SELECT;pbeg:=abeg;pend:=aend;getformulatree(nod1,lnod,rnod,pnod,inod);nodc:=nod1;adrc:=adr1;pointermode:=0;.END PROCeditformula;PROCclearformula:clearformula(dspxminMAXxlow-xoff,dspyminMAXylow-yoff,dspxmaxMINxhig-xoff,dspymaxMINyhig-yoff,xoff,yoff);dspxmin:=xhig-xoff;dspymin:=yhig-yoff;dspxmax:=xlow-xoff;dspymax:=ylow-yoff;END PROCclearformula;PROCoutformula:outformula(xminMAXxlow-xoff,yminMAXylow-yoff,xmaxMINxhig-xoff,ymaxMINyhig-yoff,xoff,yoff);dspxmin:=xmin;dspymin:=ymin;dspxmax:=xmax;dspymax:=ymax;dspxbeg:=0;END PROCoutformula;PROCoutformula(INT CONSTxbeg,ybeg,xend,yend,TEXT CONSTframe):outformula(xbegMAXxlow-xoff,ybegMAXylow-yoff,xendMINxhig-xoff,yendMINyhig-yoff,xoff,yoff,frame);END PROCoutformula;PROCgetkey:IFxbeg<>dspxbegORybeg<>dspybegORxend<>dspxendORyend<>dspyendTHEN IFmarkonANDdspxbeg>0THENoutformula(dspxbeg-1,dspybeg,dspxend,dspyend,clrmark);FI;IFmarkonTHENoutformula(xbeg-1,ybeg,xend,yend,dspmark);FI;cursor(80,1);out("");dspxbeg:=xbeg;dspybeg:=ybeg;dspxend:=xend;dspyend:=yend;FI;cursor(xcur,ycur);getchar(exitkey);IFlearnmodeTHENlearnedkeysCATexitkeyFI;END PROCgetkey;PROCprocessstdkey:getkey;displaykey(exitkey);processkey;clearkey(exitkey);.processkey:IFpos(stdkeys,exitkey)>0THENquiteditor:=TRUE;LEAVEprocesskeyFI;SELECTpos(keys,exitkey)OF CASEhopkey:processhopkey;CASEleftkey:processleft;CASErightkey:processright;CASEupkey:processup;CASEdownkey:processdown;CASEtabkey:processtab;CASErubinkey:processrubin;CASEruboutkey:processrubout;CASEesckey:processesckey;OTHERWISE:processother;END SELECT;.processleft:xmove(-1);.processright:xmove(+1);.processup:ymove(-1);.processdown:ymove(+1);.processtab:adrc:=adr1;REPadrcINCR1;idx:=formulaindex(adrc);trm:=formulaterm(adrc);IFidx=nilidxTHENbeep;LEAVEprocesskeyFI;UNTILidx<>lforceidxANDidx<>rforceidxANDidx<>begdifidxANDidx<>enddifidxANDtrm<>nilariPER;pointermode:=4;.processrubin:IFrubinonTHENrubinmode:=NOTrubinmode;IFrubinmodeTHEN
displayformeditrubinELSEclearformeditrubinFI;FI;.processrubout:deletechar;.processother:IFexitkey<" "THEN IF NOTlearnonORpos(keys,exitkey)>0THENbeep;LEAVEprocesskeyFI;IFtasteenthaeltkommando(exitkey)THENdisablestop;out("�");do(kommandoauftaste(exitkey));displayformediterror;clearerror;ELSEpush(lernsequenzauftaste(exitkey));FI;ELSEinsertchar(exitkey);FI;.END PROCprocessstdkey;PROCprocesshopkey:washop:=TRUE;displaykey("HOP");getkey;displaykey(exitkey);processkey;clearkey(exitkey);clearkey("HOP");exitkey:="�"+exitkey;washop:=FALSE;.processkey:IFpos(hopkeys,exitkey)>0THENquiteditor:=TRUE;LEAVEprocesskeyFI;SELECTpos(keys,exitkey)OF CASEhopkey:processhophop;CASEleftkey:processhopleft;CASErightkey:processhopright;CASEupkey:processhopup;CASEdownkey:processhopdown;CASEruboutkey:processhoprubout;CASEtabkey:CASEreturnkey:CASEesckey:processhopesc;CASElparkey:processhoplpar;CASErparkey:processhoprpar;CASElbrakey:processhoplbra;CASErbrakey:processhoprbra;CASElcmtkey:CASErcmtkey:CASEabskey:CASEcapakey:processhopcapa;CASEcapdkey:processhopcapd;OTHERWISE:processhopother;END SELECT;.processhophop:IFxcur>xlowORycur>ylowTHENxmove(xlow-xcur);ymove(ylow-ycur);ELSExmove(xlow-xhig-1);ymove(ylow-yhig-1);FI;.processhopleft:IFxcur>xlowTHENxmove(xlow-xcur)ELSExmove(xlow-xhig-1)FI;.processhopright:IFxcur<xhigTHENxmove(xhig-xcur)ELSExmove(xhig-xlow+1)FI;.processhopup:IFycur>ylowTHENymove(ylow-ycur)ELSEymove(ylow-yhig-1)FI;.processhopdown:IFycur<yhigTHENymove(yhig-ycur)ELSEymove(yhig-ylow+1)FI;.processhoprubout:IF NOTwriteenabledORnod1<1ORidx>atomidxTHENbeep;LEAVEprocesskeyFI;trm:=subtext(trm,1,tpos-1MINtlen);defformulaterm(adr1,trm);pointermode:=2;regenerate:=TRUE;newdisplay:=TRUE;.processhopesc:processesckey;push("�");.processhoplpar:insertpars("(",")",opindex("("),opindex(")"));.processhoprpar:deletepars("(",")");.processhoplbra:insertpars("[","]",opindex("["),opindex("]"));.processhoprbra:deletepars("[","]");.processhopcapa:insertpars(ifari,fiari,ifidx,fiidx);.processhopcapd:insertpars(begdifari,enddifari,begdifidx,enddifidx);.processhopother:IFexitkey<" "THEN IF NOTlearnonORpos(keys,exitkey)>0THENbeep;LEAVEprocesskeyFI;IFtasteenthaeltkommando(exitkey)THENdisablestop;out("�");do(kommandoauftaste(exitkey));displayformediterror;clearerror;ELSEpush(lernsequenzauftaste(exitkey));FI;ELSEinsertchar(exitkey);FI;.END PROCprocesshopkey;PROCprocessesckey:wasesc:=TRUE;displaykey("ESC");getkey;displaykey(exitkey);processkey;clearkey(exitkey);clearkey("ESC");exitkey:="�"+exitkey;wasesc:=FALSE;.processkey:IFpos(esckeys,exitkey)>0THENquiteditor:=TRUE;LEAVEprocesskeyFI;SELECTpos(keys,exitkey)OF CASEhopkey:processeschop;CASEleftkey:processescleft;CASErightkey:processescright;CASErubinkey:processescrubin;CASEruboutkey:processescrubout;CASEbkey:CASEpkey:processescp;CASEdkey:processescd;CASEgkey:processescg;CASElparkey:processesclpar;CASErparkey:processescrpar;CASElesskey:CASEequalskey:processescequals;CASEgreaterkey:CASEexclamationkey:CASEupkey:processescup;CASEdownkey:CASEcircumflexkey:CASEunderlinekey:CASEslashkey:CASEstarkey:CASErootkey:CASEcapbkey:CASEcappkey:CASEcapikey:CASEcapwkey:CASEcapdkey:processesccapd;CASEcapakey:processesccapa;CASEsemicolonkey:processescsemicolon;OTHERWISE:processescother;END SELECT;.processeschop:IF NOTlearnonTHENbeep;LEAVEprocesskeyFI;learnmode:=NOTlearnmode;IFlearnmodeTHENdisplayformeditlearn;learnedkeys:="";ELSEregenerate:=TRUE;newdisplay:=TRUE;learnedkeys:=subtext(learnedkeys,1,LENGTHlearnedkeys-2);REPgetkey;IFexitkey="�"ORpos(learnedkeys,exitkey)=0OR(exitkey>=" "ANDpos(learnedkeys,"�"+exitkey)=0)THENlernsequenzauftastelegen(exitkey,learnedkeys);clearformeditlearn;LEAVEprocesseschop;FI;out("�");PER;FI;.processescleft:adrc:=adr1;REPadrcDECR1;idx:=formulaindex(adrc);trm:=formulaterm(adrc);IFidx=nilidxTHENbeep;LEAVEprocesskeyFI;UNTILidx<>lforceidxANDidx<>rforceidxANDidx<>begdifidxANDidx<>enddifidxANDtrm<>nilariPER;pointermode:=4;.processescright:adrc:=adr1;REPadrcINCR1;idx:=formulaindex(adrc);trm:=formulaterm(adrc);IFidx=nilidxTHENbeep;
LEAVEprocesskeyFI;UNTILidx<>lforceidxANDidx<>rforceidxANDidx<>begdifidxANDidx<>enddifidxANDtrm<>nilariPER;pointermode:=4;.processescup:processesccapp;.processescrubin:processescg;.processescrubout:processescp;.processescp:IF NOTwriteenabledORnod1<1THENbeep;LEAVEprocesskeyFI;IFnodx=2THENnod1EXCnod2;adr1EXCadr2;getformulatree(nod1,lnod,rnod,pnod,inod)FI;buffer:=arithnotation(nod1);displayformeditbuffer;defformulaaddress(nod1,nod1,1,adr1,adr1);defformulatree(nod1,0,0,pnod,inod);defformulaterm(adr1,nilari);nodc:=pnod;pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;.processescd:IFnod1<1THENbeep;LEAVEprocesskeyFI;IFnodx=2THENnod1EXCnod2;adr1EXCadr2;getformulatree(nod1,lnod,rnod,pnod,inod);buffer:=arithnotation(nod1);nod1EXCnod2;adr1EXCadr2;getformulatree(nod1,lnod,rnod,pnod,inod);ELSEbuffer:=arithnotation(nod1);FI;displayformeditbuffer;.processescg:IF NOTwriteenabledORnod1<1ORidx>atomidxTHENbeep;LEAVEprocesskeyFI;IFtrm=atomariTHENtrm:=nilari;tpos:=1;tlen:=0FI;change(trm,tpos,tpos-1,delimiter+buffer+delimiter);trm:=lforceari+delimiter+trm+delimiter+rforceari;defformulaterm(adr1,trm);nodc:=nod1;pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;.processesclpar:push("[");.processescrpar:push("]");.processescequals:insertchar("->");.processesccapp:push("^");.processesccapd:createformulaobj("D",atomidx,lnod);nodc:=lnod;createformulaobj("D",atomidx,rnod);adjoinformulaobj("/",opindex("/"),lnod,rnod,snod);insertformulapars(begdifari,enddifari,begdifidx,enddifidx,snod,pnod,inod,nod1,nod2);pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;.processesccapa:createformulaobj(atomari,atomidx,lnod);nodc:=lnod;createformulaobj(atomari,atomidx,rnod);adjoinformulaobj(thenari,thenidx,lnod,rnod,snod);insertformulapars(ifari,fiari,ifidx,fiidx,snod,pnod,inod,nod1,nod2);pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;.processescsemicolon:INT VARanod,bnod,tnod;IF NOTwriteenabledORnod1<1THENbeep;LEAVEprocesskeyFI;IFidx=ifidxTHEN IFtpos<=1THENbeep;LEAVEprocesskeyFI;xobj:=xpoi;yobj:=ypoi;snod:=nod1;REPxobjINCR1;nod1:=formulanode(xobj,yobj);getformulaaddress(nod1,nod2,nodx,adr1,adr2);getformulaterm(adr1,trm);UNTILnod1<>snodANDtrm<>""PER;getformulatree(nod1,lnod,rnod,pnod,inod);getformulaaddress(nod1,nod2,nodx,adr1,adr2);idx:=formulaindex(adr1);WHILEpnod>0ANDidx<>elif2idxANDidx<>elif3idxREPnod1:=pnod;getformulatree(nod1,lnod,rnod,pnod,inod);getformulaaddress(nod1,nod2,nodx,adr1,adr2);idx:=formulaindex(adr1);PER;insertelifbeforeelif;ELIFidx=fiidxTHEN IFtpos>1THENbeep;LEAVEprocesskeyFI;xobj:=xpoi;yobj:=ypoi;snod:=nod1;REPxobjDECR1;nod1:=formulanode(xobj,yobj);getformulaaddress(nod1,nod2,nodx,adr1,adr2);getformulaterm(adr1,trm);UNTILsnod<>nod1ANDtrm<>""PER;getformulatree(nod1,lnod,rnod,pnod,inod);getformulaaddress(nod1,nod2,nodx,adr1,adr2);idx:=formulaindex(adr1);WHILEpnod>0ANDidx<>elif2idxANDidx<>elif3idxREPnod1:=pnod;getformulatree(nod1,lnod,rnod,pnod,inod);getformulaaddress(nod1,nod2,nodx,adr1,adr2);idx:=formulaindex(adr1);PER;insertelifbehindelif;ELSEbeep;LEAVEprocesskey;FI;nodc:=anod;pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;.insertelifbeforeelif:createformulaobj(atomari,atomidx,anod);createformulaobj(atomari,atomidx,bnod);adjoinformulaobj(thenari,thenidx,anod,bnod,tnod);adjoinformulaobj(elif1ari,elif1idx,tnod,0,snod);insertformulaobj(elif2ari,elif2idx,snod,nod1,pnod,inod,tnod);.insertelifbehindelif:createformulaobj(atomari,atomidx,anod);createformulaobj(atomari,atomidx,bnod);adjoinformulaobj(thenari,thenidx,anod,bnod,tnod);SELECTidxOF CASEelif2idx:adjoinformulaobj(elif1ari,elif1idx,tnod,0,snod);insertformulaobj(elif2ari,elif2idx,snod,rnod,nod1,2,tnod);CASEelif3idx:defformulaterm(adr1,elif2ari,elif2idx);insertformulaobj(elif1ari,elif1idx,lnod,0,nod1,1,snod);insertformulaobj(elif3ari,elif3idx,tnod,0,nod1,2,snod);END SELECT;.processescother:IFtasteenthaeltkommando(exitkey)THEN IF NOTlearnonTHENbeep;LEAVEprocesskeyFI;disablestop;out("�");do(kommandoauftaste(exitkey));displayformediterror;clearerror;ELSEpush(lernsequenzauftaste(exitkey));FI;.END PROC
processesckey;PROCdeletechar:IF NOTwriteenabledORnod1<1ORypoi<>yobjTHENbeep;LEAVEdeletecharFI;IFtpos<1THENbeep;LEAVEdeletecharFI;out("�");IFidx=applyidxORidx=timesidxTHENdeletenilop;ELIFtpos<=tlenTHENdeletecharinobject;ELSEdeletespacebehindobject;FI;regenerate:=TRUE;newdisplay:=TRUE;.deletenilop:adr1:=formulaaddress(lnod);idx:=formulaindex(adr1);WHILEidx=lforceidxORidx=rforceidxREPadr1DECR1;idx:=formulaindex(adr1);PER;adr2:=formulaaddress(rnod);idx:=formulaindex(adr2);WHILEidx=lforceidxORidx=rforceidxREPadr2INCR1;idx:=formulaindex(adr2);PER;trm:=formulaterm(adr1);trmCATformulaterm(adr2);defformulaterm(adr1,trm,atomidxMAXopindex(trm));defformulaterm(adr2,"",atomidx);nodc:=lnod;pointermode:=3;.deletecharinobject:change(trm,tpos,tpos,"");tlen:=LENGTHtrm;IFtlen>0THENdefformulaterm(adr1,trm,atomidxMAXopindex(trm));pointermode:=1;ELIFidx<=atomidxTHENdeleteatom;defformulaterm(adr1,trm,atomidx);pointermode:=3;ELSEdeletenilparams;deleteop;defformulaterm(adr1,trm,atomidx);pointermode:=3;FI;.deleteatom:nodc:=pnod;.deletenilparams:getformulatree(nod1,lnod,rnod,pnod,inod);IFlnod>0ANDformulaterm(formulaaddress(lnod))=atomariTHENlnod:=0;FI;IFrnod>0ANDformulaterm(formulaaddress(rnod))=atomariTHENrnod:=0;FI;defformulatree(nod1,lnod,rnod,pnod,inod);.deleteop:removeformulaobj(nod1);IFrnod>0THENnodc:=rnodELIFlnod>0THENnodc:=lnodELSEnodc:=pnodFI;.deletespacebehindobject:adr2:=adr1;idx:=formulaindex(adr2);IFoppforce(idx)>0THENbeep;LEAVEdeletecharFI;REPadr2INCR1;idx:=formulaindex(adr2);UNTILidx<>lforceidxANDidx<>rforceidxPER;IFoppforce(idx)>0THENbeep;LEAVEdeletecharFI;trmCATformulaterm(adr2);defformulaterm(adr1,trm,atomidxMAXopindex(trm));defformulaterm(adr2,"",atomidx);pointermode:=1;.END PROCdeletechar;PROCinsertchar(TEXT CONSTsym):INT VARsidx:=opindex(sym)MAXatomidx;INT VARslbp:=oplbp(sidx);INT VARsrbp:=oprbp(sidx);INT VARpidx;IF NOT(writeenabledANDnod1>0AND(washopORypoi=yobj))THENbeep;LEAVEinsertcharFI;out("�");IFidx=timesidxTHENtrm:=timesscr;tlen:=LENGTHtrm;tpos:=0MAXxpoi-xobj+1MINtlen+1;ELIFidx=applyidxTHENtrm:=applyscr;tlen:=LENGTHtrm;tpos:=0MAXxpoi-xobj+1MINtlen+1;FI;IFidx=atomidxANDtrm=atomariTHENltrm:=nilari;rtrm:=nilari;ELIFrubinmodeOR(idx>atomidxXORsidx>atomidx)THENltrm:=subtext(trm,1,tpos-1);rtrm:=subtext(trm,tpos);ELSEltrm:=subtext(trm,1,tpos-1);rtrm:=subtext(trm,tpos+1);FI;trm:=ltrm;trmCATsym;trmCATrtrm;IF NOTwashopANDidx>atomidxANDtpos>=1ANDtpos<=tlen+1THENreplaceop;FI;IFltrm=nilariTHENinsertbeforeobject;ELIFrtrm=nilariTHENinsertbehindobject;ELSEinsertintoobject;FI;pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;.replaceop:IFrubinmodeORtpos=tlen+1THENreplaceopbytrm;ELIFtpos=1THENreplaceopbysym;FI;.replaceopbytrm:IFtrm=lforceariORtrm=rforceariTHEN LEAVEreplaceopbytrmFI;IFopindex(trm,lnod>0,rnod>0)<=atomidxTHEN LEAVEreplaceopbytrmFI;pidx:=formulaindex(formulaaddress(pnod));IFinod=1ANDoplforce(pidx)<>0ORinod=2ANDoprforce(pidx)<>0THENdefformulaterm(adr1,trm,opindex(trm,lnod>0,rnod>0));ELSEdefformulaterm(adr1,trm,idx);FI;nodc:=nod1;xrel:=xpoi-xobj+1;pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;LEAVEinsertchar;.replaceopbysym:IFopindex(sym,lnod>0,rnod>0)<=atomidxTHEN LEAVEreplaceopbysymFI;pidx:=formulaindex(formulaaddress(pnod));IFinod=1ANDoplforce(pidx)<>0ORinod=2ANDoprforce(pidx)<>0THENdefformulaterm(adr1,sym,opindex(sym,lnod>0,rnod>0));ELSEdefformulaterm(adr1,sym,idx);FI;nodc:=nod1;xrel:=+1;pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;LEAVEinsertchar;.insertbeforeobject:IF NOTwashopANDxpoi>xbegTHENbeep;LEAVEinsertcharFI;pidx:=formulaindex(formulaaddress(pnod));WHILEpidx=enddifidxORpidx=begdifidxORoprforce(sidx)=0ANDinod=1ANDsrbp<oplbp(pidx)ANDoplforce(pidx)=0REPnod1:=pnod;idx:=pidx;getformulaaddress(nod1,nod2,nodx,adr1,adr2);getformulatree(nod1,lnod,rnod,pnod,inod);getformulaobject(nod1,xobj,yobj);pidx:=formulaindex(formulaaddress(pnod));PER;rnod:=nod1;IFrtrm=nilariTHENrtrm:=atomariFI;IFidx<=atomidxTHENinsertbeforeatom;ELIFnodx=2THENinsertbeforerpar;ELIFnod1<>nod2ANDidx<>begdifidxTHENinsertbeforelpar;ELSEinsertbeforeop;FI;.
insertbeforeatom:IFsidx<=atomidxTHENdefformulaterm(adr1,trm);nodc:=nod1;xrel:=+1;ELIFslbp=prefixlbpTHENcreateformulaobj(rtrm,atomidx,rnod);insertformulaobj(sym,sidx,0,rnod,pnod,inod,nod1);nodc:=rnod;ELIFslbp=lparlbpTHENcreateformulaobj(rtrm,atomidx,rnod);insertformulaobj(sym,sidx,0,rnod,pnod,inod,nod1);nodc:=rnod;ELIFsrbp=postfixrbpTHENcreateformulaobj(atomari,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);createformulaobj(rtrm,atomidx,rnod);insertformulaobj(timesari,timesidx,snod,rnod,pnod,inod,nod1);nodc:=lnod;ELIFsrbp=rparrbpTHENcreateformulaobj(atomari,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);createformulaobj(rtrm,atomidx,rnod);insertformulaobj(timesari,timesidx,snod,rnod,pnod,inod,nod1);nodc:=lnod;ELSEcreateformulaobj(atomari,atomidx,lnod);createformulaobj(rtrm,atomidx,rnod);insertformulaobj(sym,sidx,lnod,rnod,pnod,inod,nod1);nodc:=lnod;FI;.insertbeforerpar:beep;LEAVEinsertchar;.insertbeforelpar:IFsidx<=atomidxTHENcreateformulaobj(sym,atomidx,lnod);insertformulaobj(applyari,applyidx,lnod,rnod,pnod,inod,nod1);nodc:=lnod;xrel:=+1;ELIFslbp=prefixlbpTHENinsertformulaobj(sym,sidx,0,rnod,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELIFslbp=lparlbpTHENinsertformulaobj(sym,sidx,0,rnod,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELIFsrbp=postfixrbpTHENcreateformulaobj(atomari,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);insertformulaobj(applyari,applyidx,snod,rnod,pnod,inod,nod1);nodc:=lnod;ELIFsrbp=rparrbpTHENcreateformulaobj(atomari,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);insertformulaobj(applyari,applyidx,snod,rnod,pnod,inod,nod1);nodc:=lnod;ELSEcreateformulaobj(atomari,atomidx,lnod);insertformulaobj(sym,sidx,lnod,rnod,pnod,inod,nod1);nodc:=lnod;FI;.insertbeforeop:IFsidx<=atomidxTHENcreateformulaobj(sym,atomidx,lnod);insertformulaobj(timesari,timesidx,lnod,rnod,pnod,inod,nod1);nodc:=lnod;xrel:=+1;ELIFslbp=prefixlbpTHENinsertformulaobj(sym,sidx,0,rnod,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELIFslbp=lparlbpTHENinsertformulaobj(sym,sidx,0,rnod,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELIFsrbp=postfixrbpTHENcreateformulaobj(atomari,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);insertformulaobj(timesari,timesidx,snod,rnod,pnod,inod,nod1);nodc:=lnod;ELIFsrbp=rparrbpTHENcreateformulaobj(atomari,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);insertformulaobj(timesari,timesidx,snod,rnod,pnod,inod,nod1);nodc:=lnod;ELSEcreateformulaobj(atomari,atomidx,lnod);insertformulaobj(sym,sidx,lnod,rnod,pnod,inod,nod1);nodc:=lnod;FI;.insertbehindobject:IF NOTwashopANDxpoi<xend-1THENbeep;LEAVEinsertcharFI;IFnodx=2THENnod1:=pnod;getformulatree(nod1,lnod,rnod,pnod,inod)FI;pidx:=formulaindex(formulaaddress(pnod));WHILEpidx=enddifidxORpidx=begdifidxORoplforce(sidx)=0ANDinod=2ANDslbp<oprbp(pidx)ANDoprforce(pidx)=0REPnod1:=pnod;idx:=pidx;getformulaaddress(nod1,nod2,nodx,adr1,adr2);getformulatree(nod1,lnod,rnod,pnod,inod);getformulaobject(nod1,xobj,yobj);pidx:=formulaindex(formulaaddress(pnod));PER;lnod:=nod1;IFidx<=atomidxTHENinsertbehindatom;ELIFnodx=2THENinsertbehindrpar;ELIFnod1<>nod2ANDidx<>begdifidxTHENinsertbehindlpar;ELSEinsertbehindop;FI;.insertbehindatom:IFsidx<=atomidxTHENdefformulaterm(adr1,trm);nodc:=nod1;xrel:=xpoi-xobj+1;ELIFslbp=prefixlbpTHENcreateformulaobj(ltrm,atomidx,lnod);createformulaobj(atomari,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(timesari,timesidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFslbp=lparlbpTHENcreateformulaobj(ltrm,atomidx,lnod);createformulaobj(atomari,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(applyari,applyidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFsrbp=postfixrbpTHENcreateformulaobj(ltrm,atomidx,lnod);insertformulaobj(sym,sidx,lnod,0,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELIFsrbp=rparrbpTHENcreateformulaobj(ltrm,atomidx,lnod);insertformulaobj(sym,sidx,lnod,0,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELSEcreateformulaobj(ltrm,atomidx,lnod);createformulaobj(atomari,atomidx,rnod);insertformulaobj(sym,sidx,lnod,rnod,pnod,inod,nod1);nodc:=rnod;
FI;.insertbehindrpar:IFsidx<=atomidxTHENcreateformulaobj(sym,atomidx,rnod);insertformulaobj(timesari,timesidx,lnod,rnod,pnod,inod,nod1);nodc:=rnod;xrel:=+1;ELIFslbp=prefixlbpTHENcreateformulaobj(atomari,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(timesari,timesidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFslbp=lparlbpTHENcreateformulaobj(atomari,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(applyari,applyidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFsrbp=postfixrbpTHENinsertformulaobj(sym,sidx,lnod,0,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELIFsrbp=rparrbpTHENinsertformulaobj(sym,sidx,lnod,0,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELSEcreateformulaobj(atomari,atomidx,rnod);insertformulaobj(sym,sidx,lnod,rnod,pnod,inod,nod1);nodc:=rnod;FI;.insertbehindlpar:beep;LEAVEinsertchar;.insertbehindop:IFsidx<=atomidxTHENcreateformulaobj(sym,atomidx,rnod);insertformulaobj(timesari,timesidx,lnod,rnod,pnod,inod,nod1);nodc:=rnod;xrel:=+1;ELIFslbp=prefixlbpTHENcreateformulaobj(atomari,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(timesari,timesidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFslbp=lparlbpTHENcreateformulaobj(atomari,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(applyari,applyidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFsrbp=postfixrbpTHENinsertformulaobj(sym,sidx,lnod,0,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELIFsrbp=rparrbpTHENinsertformulaobj(sym,sidx,lnod,0,pnod,inod,nod1);nodc:=nod1;xrel:=+1;ELSEcreateformulaobj(atomari,atomidx,rnod);insertformulaobj(sym,sidx,lnod,rnod,pnod,inod,nod1);nodc:=rnod;FI;.insertintoobject:IFidx<=atomidxTHENinsertintoatom;ELIFnodx=2THENinsertintorpar;ELIFnod1<>nod2THENinsertintolpar;ELSEinsertintoop;FI;.insertintoatom:IFsidx<=atomidxTHENdefformulaterm(adr1,trm);nodc:=nod1;xrel:=xpoi-xobj+1;ELIFslbp=prefixlbpTHENcreateformulaobj(ltrm,atomidx,lnod);createformulaobj(rtrm,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(timesari,timesidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFslbp=lparlbpTHENcreateformulaobj(ltrm,atomidx,lnod);createformulaobj(rtrm,atomidx,rnod);adjoinformulaobj(sym,sidx,0,rnod,snod);insertformulaobj(applyari,applyidx,lnod,snod,pnod,inod,nod1);nodc:=rnod;ELIFsrbp=postfixrbpTHENcreateformulaobj(ltrm,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);createformulaobj(rtrm,atomidx,rnod);insertformulaobj(timesari,timesidx,snod,rnod,pnod,inod,nod1);nodc:=rnod;ELIFsrbp=rparrbpTHENcreateformulaobj(ltrm,atomidx,lnod);adjoinformulaobj(sym,sidx,lnod,0,snod);createformulaobj(rtrm,atomidx,rnod);insertformulaobj(timesari,timesidx,snod,rnod,pnod,inod,nod1);nodc:=rnod;ELSEcreateformulaobj(ltrm,atomidx,lnod);createformulaobj(rtrm,atomidx,rnod);insertformulaobj(sym,sidx,lnod,rnod,pnod,inod,nod1);nodc:=rnod;FI;.insertintorpar:beep;LEAVEinsertchar;.insertintolpar:beep;LEAVEinsertchar;.insertintoop:beep;LEAVEinsertchar;.END PROCinsertchar;PROCinsertpars(TEXT CONSTlparari,rparari,INT CONSTlparidx,rparidx):IF NOTwriteenabledORnod1<1ORypoi<>yobjTHENbeep;LEAVEinsertparsFI;out("�");snod:=nod1;insertformulapars(lparari,rparari,lparidx,rparidx,snod,pnod,inod,nod1,nod2);nodc:=snod;xrel:=xpoi-xobj;pointermode:=3;regenerate:=TRUE;newdisplay:=TRUE;END PROCinsertpars;PROCdeletepars(TEXT CONSTlparari,rparari):IF NOTwriteenabledORnod1=nod2ORypoi<>yobjTHENbeep;LEAVEdeleteparsFI;out("�");IFnodx=2THENnod1EXCnod2;adr1EXCadr2FI;IF(formulaterm(adr1)<>lparariORformulaterm(adr2)<>rparari)THENbeep;LEAVEdeleteparsFI;removeformulaobj(nod1);removeformulaobj(nod2);IFlnod>0THENnodc:=lnodELIFrnod>0THENnodc:=rnodELSEnodc:=nod1FI;pointermode:=2;regenerate:=TRUE;newdisplay:=TRUE;END PROCdeletepars;PROCdisplayformeditbuffer:IFbufferonTHENcursor(xbuffer,ybuffer);outtext(dspbuffer+buffer,1,lbuffer);cursor(xcur,ycur);FI;END PROCdisplayformeditbuffer;PROCclearformeditbuffer:IFbufferonTHENcursor(xbuffer,ybuffer);outtext(clrbuffer,1,lbuffer);cursor(xcur,ycur);FI;END PROCclearformeditbuffer;PROCdisplayformeditarith:IFarithonTHENrec:=
dsparith;recCAT"";INT CONSTxaoff:=LENGTHrec;INT CONSTxabeg:=xarith+xaoff;INT CONSTxasiz:=larith-xaoff;recCATarithnotation;changeall(rec,delimiter," ");cursor(xarith,yarith);outtext(rec,1,larith);IFadr1=0THEN LEAVEdisplayformeditarithFI;IFpbeg-1>=0ANDpbeg-1<xasizTHENcursor(xabeg+pbeg-2,yarith);out(dspmarkSUB10)FI;outsubtext(rec,(1MAXpbeg)+xaoff,(pendMINxasiz-1)+xaoff);IFpend+1>=0ANDpend+1<xasizTHENcursor(xabeg+pend,yarith);out(dspmarkSUB12)FI;IFapos<xasizTHENcursor(xabeg+apos-1,yarith);out(clrmarkSUB12);cursor(xabeg+apos-1,yarith);out(recSUBapos+xaoff);FI;cursor(xarith+larith-1,yarith);out("");FI;END PROCdisplayformeditarith;PROCclearformeditarith:IFarithonTHENrec:=clrarith;cursor(xarith,yarith);outtext(rec,1,larith);FI;END PROCclearformeditarith;PROCdisplayformediterror:TEXT VARpm;IFiserrorANDerrormessage<>""THENbeep;IFerroronTHENpm:=dsperror;pmCATerrormessage;IFerrorline>0THENpmCAT" bei Zeile ";pmCATtext(errorline)FI;pmCAT" ";cursor(xerror,yerror);outsubtext(pm,1,lerror);cursor(xerror,yerror);pause;cursor(xcur,ycur);FI;FI;END PROCdisplayformediterror;PROCclearformediterror:IFerroronTHEN TEXT VARpm:=clrerror;cursor(xerror,yerror);outsubtext(pm,1,lerror);cursor(xcur,ycur);FI;END PROCclearformediterror;PROCbeep:IFbeeponTHENout("�");FI;END PROCbeep;PROCdisplayformeditrubin:IFrubinonTHENcursor(xrubin,yrubin);out(dsprubin);cursor(xcur,ycur);FI;END PROCdisplayformeditrubin;PROCclearformeditrubin:IFrubinonTHENcursor(xrubin,yrubin);out(clrrubin);cursor(xcur,ycur);FI;END PROCclearformeditrubin;PROCdisplayformeditlearn:IFlearnonTHENcursor(xlearn,ylearn);out(dsplearn);cursor(xcur,ycur);FI;END PROCdisplayformeditlearn;PROCclearformeditlearn:IFlearnonTHENcursor(xlearn,ylearn);out(clrlearn);cursor(xcur,ycur);FI;END PROCclearformeditlearn;PROCdisplaykey(TEXT CONSTkey):IFkeysonAND(keySUB1)>=" "THENcursor(headpos,ykeys);out("");out(key);out(" ");cursor(xcur,ycur);headposINCR3+LENGTHkey;FI;END PROCdisplaykey;PROCclearkey(TEXT CONSTkey):IFkeysonAND(keySUB1)>=" "THENheadposDECR3+LENGTHkey;cursor(headpos,ykeys);out(" ");LENGTHkeyTIMESOUT" ";out("  ");cursor(xcur,ycur);FI;END PROCclearkey;PROCdefformeditbuffer(INT CONSTxp,yp,xl):xbuffer:=xp;ybuffer:=yp;lbuffer:=xl;END PROCdefformeditbuffer;PROCgetformeditbuffer(INT VARxp,yp,xl):xp:=xbuffer;yp:=ybuffer;xl:=lbuffer;END PROCgetformeditbuffer;PROCdefformeditarith(INT CONSTxp,yp,xl):xarith:=xp;yarith:=yp;larith:=xl;END PROCdefformeditarith;PROCgetformeditarith(INT VARxp,yp,xl):xp:=xarith;yp:=yarith;xl:=larith;END PROCgetformeditarith;PROCdefformediterror(INT CONSTxp,yp,xl):xerror:=xp;yerror:=yp;lerror:=xl;END PROCdefformediterror;PROCgetformediterror(INT VARxp,yp,xl):xp:=xerror;yp:=yerror;xl:=lerror;END PROCgetformediterror;PROCdefformeditrubin(INT CONSTxp,yp):xrubin:=xp;yrubin:=yp;END PROCdefformeditrubin;PROCgetformeditrubin(INT VARxp,yp):xp:=xrubin;yp:=yrubin;END PROCgetformeditrubin;PROCdefformeditlearn(INT CONSTxp,yp):xlearn:=xp;ylearn:=yp;END PROCdefformeditlearn;PROCgetformeditlearn(INT VARxp,yp):xp:=xlearn;yp:=ylearn;END PROCgetformeditlearn;PROCdefformeditkeys(INT CONSTxp,yp):xkeys:=xp;ykeys:=yp;END PROCdefformeditkeys;PROCgetformeditkeys(INT VARxp,yp):xp:=xkeys;yp:=ykeys;END PROCgetformeditkeys;PROCdefformeditbuffer(TEXT CONSTdsp,clr):dspbuffer:=dsp;clrbuffer:=clr;END PROCdefformeditbuffer;PROCgetformeditbuffer(TEXT VARdsp,clr):dsp:=dspbuffer;clr:=clrbuffer;END PROCgetformeditbuffer;PROCdefformeditarith(TEXT CONSTdsp,clr):dsparith:=dsp;clrarith:=clr;END PROCdefformeditarith;PROCgetformeditarith(TEXT VARdsp,clr):dsp:=dsparith;clr:=clrarith;END PROCgetformeditarith;PROCdefformediterror(TEXT CONSTdsp,clr):dsperror:=dsp;clrerror:=clr;END PROCdefformediterror;PROCgetformediterror(TEXT VARdsp,clr):dsp:=dsperror;clr:=clrerror;END PROCgetformediterror;PROCdefformeditkeys(TEXT CONSTdsp,clr):dspkeys:=dsp;clrkeys:=clr;END PROCdefformeditkeys;PROCgetformeditkeys(TEXT VARdsp,clr):dsp:=dspkeys;clr:=clrkeys;END PROCgetformeditkeys;PROCdefformeditrubin(TEXT CONSTdsp,clr):dsprubin:=dsp;clrrubin:=clr;END
 PROCdefformeditrubin;PROCgetformeditrubin(TEXT VARdsp,clr):dsp:=dsprubin;clr:=clrrubin;END PROCgetformeditrubin;PROCdefformeditlearn(TEXT CONSTdsp,clr):dsplearn:=dsp;clrlearn:=clr;END PROCdefformeditlearn;PROCgetformeditlearn(TEXT VARdsp,clr):dsp:=dsplearn;clr:=clrlearn;END PROCgetformeditlearn;PROCdefformeditmark(TEXT CONSTdsp,clr):replace(dspmark,1,dsp);replace(clrmark,1,clr);END PROCdefformeditmark;PROCgetformeditmark(TEXT VARdsp,clr):dsp:=dspmark;clr:=clrmark;END PROCgetformeditmark;PROCdefformeditbuffer(BOOL CONSTon):bufferon:=on;END PROCdefformeditbuffer;PROCgetformeditbuffer(BOOL VARon):on:=bufferon;END PROCgetformeditbuffer;BOOL PROCformeditbuffer:bufferonEND PROCformeditbuffer;PROCdefformeditarith(BOOL CONSTon):arithon:=on;END PROCdefformeditarith;PROCgetformeditarith(BOOL VARon):on:=arithon;END PROCgetformeditarith;BOOL PROCformeditarith:arithonEND PROCformeditarith;PROCdefformediterror(BOOL CONSTon):erroron:=on;END PROCdefformediterror;PROCgetformediterror(BOOL VARon):on:=erroron;END PROCgetformediterror;BOOL PROCformediterror:erroronEND PROCformediterror;PROCdefformeditbeep(BOOL CONSTon):beepon:=on;END PROCdefformeditbeep;PROCgetformeditbeep(BOOL VARon):on:=beepon;END PROCgetformeditbeep;BOOL PROCformeditbeep:beeponEND PROCformeditbeep;PROCdefformeditrubin(BOOL CONSTon):rubinon:=on;END PROCdefformeditrubin;PROCgetformeditrubin(BOOL VARon):on:=rubinon;END PROCgetformeditrubin;BOOL PROCformeditrubin:rubinonEND PROCformeditrubin;PROCdefformeditlearn(BOOL CONSTon):learnon:=on;END PROCdefformeditlearn;PROCgetformeditlearn(BOOL VARon):on:=learnon;END PROCgetformeditlearn;BOOL PROCformeditlearn:learnonEND PROCformeditlearn;PROCdefformeditkeys(BOOL CONSTon):keyson:=on;END PROCdefformeditkeys;PROCgetformeditkeys(BOOL VARon):on:=keyson;END PROCgetformeditkeys;BOOL PROCformeditkeys:keysonEND PROCformeditkeys;PROCdefformeditmark(BOOL CONSTon):markon:=on;END PROCdefformeditmark;PROCgetformeditmark(BOOL VARon):on:=markon;END PROCgetformeditmark;BOOL PROCformeditmark:markonEND PROCformeditmark;PROCresetformulaeditor:disablestop;xcur:=1;ycur:=1;xlow:=1;ylow:=1;xhig:=79;yhig:=24;xoff:=0;yoff:=0;xpoi:=1;ypoi:=1;xmin:=1;ymin:=1;xmax:=1;ymax:=1;pointermode:=2;buffer:="";bufferon:=FALSE;xbuffer:=0;ybuffer:=0;lbuffer:=0;arithon:=FALSE;xarith:=0;yarith:=0;larith:=0;erroron:=TRUE;xerror:=0;yerror:=0;lerror:=0;beepon:=TRUE;rubinon:=TRUE;xrubin:=0;yrubin:=0;learnon:=FALSE;xlearn:=0;ylearn:=0;keyson:=FALSE;xkeys:=0;ykeys:=0;markon:=TRUE;dspbuffer:="Puffer : ";clrbuffer:="           ";dsparith:="Formel : ";clrarith:="           ";dsperror:="FEHLER : ";clrerror:="           ";dsprubin:="RUBIN ";clrrubin:="        ";dsplearn:="LEARN ";clrlearn:="        ";dspkeys:="Tasten : ";clrkeys:="           ";dspmark:="+-+| |+-++ +";clrmark:="            ";END PROCresetformulaeditor;PROCdefformeditexitkeys(TEXT CONSTstd,hop,esc):stdkeys:=std;hopkeys:=hop;esckeys:=esc;END PROCdefformeditexitkeys;PROCgetformeditexitkeys(TEXT VARstd,hop,esc):std:=stdkeys;hop:=hopkeys;esc:=esckeys;END PROCgetformeditexitkeys;TEXT PROCformeditexitkey:exitkeyEND PROCformeditexitkey;PROCdefformeditwindow(INT CONSTxl,yl,xh,yh):disablestop;xcurDECRxlow;ycurDECRylow;xoffDECRxlow;yoffDECRylow;xlow:=xl;ylow:=yl;xhig:=xh;yhig:=yh;xoffINCRxlow;yoffINCRylow;xcurINCRxlow;ycurINCRylow;END PROCdefformeditwindow;PROCgetformeditwindow(INT VARxl,yl,xh,yh):xl:=xlow;yl:=ylow;xh:=xhig;yh:=yhig;END PROCgetformeditwindow;PROCdefformeditoffset(INT CONSTxo,yo):disablestop;xcurDECRxoff;ycurDECRyoff;xoff:=xo;yoff:=yo;xcurINCRxoff;ycurINCRyoff;END PROCdefformeditoffset;PROCgetformeditoffset(INT VARxo,yo):xo:=xoff;yo:=yoff;END PROCgetformeditoffset;PROCdefformeditshift(INT CONSTxs,ys):defformeditoffset(xs+xlow-1,ys+ylow-1);END PROCdefformeditshift;PROCgetformeditshift(INT VARxs,ys):xs:=xoff-xlow+1;ys:=yoff-ylow+1;END PROCgetformeditshift;PROCdefformeditcursor(INT CONSTxc,yc):xmove(xc-xcur);ymove(yc-ycur);END PROCdefformeditcursor;PROCgetformeditcursor(INT VARxc,yc):xc:=xcur;yc:=ycur
;END PROCgetformeditcursor;PROCdefformeditpointer(INT CONSTxp,yp):xmove(xp-xpoi);ymove(yp-ypoi);END PROCdefformeditpointer;PROCgetformeditpointer(INT VARxp,yp):xp:=xpoi;yp:=ypoi;END PROCgetformeditpointer;PROCmoveformeditpointer(INT CONSTxd,yd):xmove(xd);ymove(yd);END PROCmoveformeditpointer;PROCxmove(INT CONSTxdel):disablestop;IFxdel<0THENmoveleftELIFxdel>0THENmoverightFI;pointermode:=2;.moveleft:IFxpoi<=xminTHENbeep;LEAVEmoveleftFI;xcurINCRxdel;xpoiINCRxdel;IFxpoi<xminTHENxcurINCRxmin-xpoi;xpoi:=xminFI;IFxcur<xlowTHENxoffINCRxlow-xcur;xcur:=xlow;newdisplay:=TRUE FI;.moveright:IFxpoi>=xmaxTHENbeep;LEAVEmoverightFI;xcurINCRxdel;xpoiINCRxdel;IFxpoi>xmaxTHENxcurINCRxmax-xpoi;xpoi:=xmaxFI;IFxcur>xhigTHENxoffINCRxhig-xcur;xcur:=xhig;newdisplay:=TRUE FI;.END PROCxmove;PROCymove(INT CONSTydel):disablestop;IFydel<0THENmoveupELIFydel>0THENmovedownELSE LEAVEymoveFI;pointermode:=2;.moveup:IFypoi<=yminTHENbeep;LEAVEmoveupFI;ycurINCRydel;ypoiINCRydel;IFypoi<yminTHENycurINCRymin-ypoi;ypoi:=yminFI;IFycur<ylowTHENyoffINCRylow-ycur;ycur:=ylow;newdisplay:=TRUE FI;.movedown:IFypoi>=ymaxTHENbeep;LEAVEmovedownFI;ycurINCRydel;ypoiINCRydel;IFypoi>ymaxTHENycurINCRymax-ypoi;ypoi:=ymaxFI;IFycur>yhigTHENyoffINCRyhig-ycur;ycur:=yhig;newdisplay:=TRUE FI;.END PROCymove;END PACKETformulaeditor;