home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
ronheb.zip
/
RONHEB.PRG
< prev
next >
Wrap
Text File
|
1988-11-11
|
6KB
|
305 lines
function initheb
parameters rhp1
* -- public: rhcount initiated to 0 rhcount
* -- asci-string ('...ABC...hebrew set....') rhtr
* -- current rhebvld variable rhcv
* -- hebrew-read simu-updated() function variable rhupdth
if pcount()=0
rhp1=50
else
if type('p1')!="N"
rhp1=50
endif
endif
public rhcount,rhtr,rhcv,rhupdth,prg,rhcolor,rhver
set confirm on
set scoreboard off
public rhrow[rhp1],rhcol[rhp1],rhvar[rhp1],rhvld[rhp1],rhsk[71]
rhcount=0
rhver="RONHEB/S87 V1.1"
rhtr=",()*+Ü-ò.0123456789:ô<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_;ÖÉüéùïÆëÅçîèûÄìö/ÿâÇàä'æêå"
rhcv=""
rhcolor=setcolor()
afill(rhsk,"")
prg=""
rhupdth=.f.
return(.t.)
function rhebvld
private hrow,hcol,vrhcount,irhcount,irh,yrh,tmprvar,ovar,rvar,lenvar,lrh
irhcount=substr(readvar(),4,2)
vrhcount=&irhcount
if !(rhn&irhcount=="")
rhn&irhcount=""
return(.t.)
endif
hrow=rhrow[vrhcount]
hcol=rhcol[vrhcount]
rvar=rhvar[vrhcount]
rhcv=upper(rvar)
ovar=&rvar
rhtmp=ovar
lenvar=len(rhtmp)
ins=.f.
rhcolor=setcolor()
rhcolour()
@ hrow,hcol say ""
irh=1
do while .t.
inkey(0)
lrh=lastkey()
do case
case lrh>31
if irh>lenvar
?? chr(7)
loop
endif
tmprvar=htrans(lrh)
if .not.ins
rhtmp=substr(rhtmp,1,lenvar-irh)+tmprvar+substr(rhtmp,lenvar-irh+2,irh-1)
* htrans will transform an inkey() value into
* corresponding hebrew set charecter by substr a charecter-list string.
* if .not. ins then say rhtmp[i] and cursor only. else say by arraysay
* after ains with pos=i+1
@ hrow,hcol-irh+1 say tmprvar
irh=irh+1
@ hrow,hcol-irh+1 say ""
loop
else
rhtmp=substr(rhtmp,2,lenvar-irh)+tmprvar+substr(rhtmp,lenvar-irh+2,irh-1)
@ hrow,hcol-lenvar+1 say substr(rhtmp,1,lenvar-irh+1)
irh=irh+1
@ hrow,hcol-irh+1 say ""
loop
endif
case lrh=4 && rt arrow
irh=iif(irh>1,irh-1,1)
* say cursor only
@ hrow,hcol-irh+1 say ""
loop
case lrh=19 && lt arrow
irh=iif(irh<lenvar,irh+1,lenvar)
@ hrow,hcol-irh+1 say ""
loop
case lrh=22 && insert
ins=iif(ins,.f.,.t.)
loop
case lrh=7 && del
rhtmp=" "+substr(rhtmp,1,lenvar-irh)+substr(rhtmp,lenvar-irh+2,irh-1)
@ hrow,hcol-lenvar+1 say rhtmp
@ hrow,hcol-irh+1 say ""
loop
case lrh=8
if irh>1
irh=irh-1
rhtmp=substr(rhtmp,1,lenvar-irh)+" "+;
substr(rhtmp,lenvar-irh+2,irh-1)
@ hrow,hcol-lenvar+1 say rhtmp
@ hrow,hcol-irh+1 say ""
endif
loop
case lrh=1
loop
case lrh=2
loop
case lrh=26
loop
case lrh=29
loop
case lrh=30
loop
case lrh=31
loop
case lrh=27
setcolor(rhcolor)
rhcv=""
rhn&irhcount=substr(rhtmp,lenvar,1)
* keyboard the last chr
&rvar=ovar
hkboard("chr(27)")
return(.F.)
otherwise
* check for pre-defined hot-keys
if !(rhsk[lrh+40]=="")
dorhsk=rhsk[lrh+40]
setcolor(rhcolor)
&rvar=rhtmp
do &dorhsk with prg,0,rhcv
rhcolor = setcolor()
rhcolour()
@ hrow,hcol say ""
irh=1
ins=.f.
loop
else
if lrh != 13
loop
endif
endif
endcase
&rvar=rhtmp
* check validity of input
setcolor(rhcolor)
rvld=rhvld[vrhcount]
rhcolor = setcolor()
rhcolour()
if .not.&rvld
&rvar=ovar
@ hrow,hcol say ""
irh=1
ins=.f.
loop
endif
setcolor(rhcolor)
if ovar!=rhtmp
* update inicator
rhupdth=.t.
endif
rhcv=""
rhn&irhcount=substr(rhtmp,lenvar,1)
* keyboard the last chr
lchar=str(lrh)
hkboard("chr(&lchar)")
return(.F.)
enddo
function readh
* will initiate a read.
* will release all redundant hebrew vars.
rhupdth=.f.
read
release rvar
release rvld
release all like rhn*
rhcv=""
rhcount=0
return(.t.)
function htrans
parameters asci
* rhtr=",()*+Ü-ò.0123456789:ô<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_;"+
* "ÖÉüéùïÆëÅçîèûÄìö/ÿâÇàä'æêå"
return(iif((asci<123).and.(asci>38),substr(rhtr,asci-38,1),chr(asci)))
function hkboard
parameters kbdchar
* -- flush keyboard into a buffer and add a control character upfront.
* -- re-keyboard it all
private cinkbfr,keybfr
keybfr=kbdchar
do while inkey()>0
cinkbfr=str(lastkey())
keybfr=keybfr+"+chr(&cinkbfr)"
enddo
keyboard &keybfr
return(.t.)
function readhvar
* -- to return current hebrew-read variable
if rhcv==""
return(readvar())
else
return(rhcv)
endif
function hebfield
return(iif(rhcv=="",.f.,.t.))
function hupdated
* -- returns .t. if there was an update in the last read
return((updated()).or.(rhupdth))
function rhsetk
parameters keynumb,keycont
rhsk[keynumb+40]=keycont
set key keynumb to &keycont
return(.t.)
function rhcolour
private tcolor,ncolor,ecolor
tcolor=rhcolor
ncolor=substr(tcolor,1,at(",",tcolor)-1)
tcolor=substr(tcolor,len(ncolor)+2,len(tcolor))
ecolor=substr(tcolor,1,at(",",tcolor)-1)
setcolor(ecolor+","+ecolor+","+tcolor)
return(.t.)