home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
utilsr
/
reppoc
/
RPFUNC.OPL
< prev
Wrap
Text File
|
1995-01-09
|
4KB
|
192 lines
app reppoc
enda
rem rpfunc contains all text functions for RepPoc.
rem Text functions always return a string (may be empty).
rem Result string may contain control characters: chr$(10) = newline, chr$(9) = tab
rem Text functions may have one argument or no argument.
rem Text functions can be invoked in field specifications used for
rem Searching, Sorting, Printing.
rem Text functions are invoked with their name followed by :: and the argument.
rem e.g.
rem sender::
rem date::
rem sur::name:
rem
rem Modify this module, translate it,
rem then copy RPFUNC.OPA from M:\APP\ to drive:\APP\REPPOC\
rem If you are running RepPoc on an S3a in S3 mode (shareware version)
rem use S3 mode (Shift-T) for all translations!
rem stripb$: is an internal function that removes blanks from the back
rem and end of a string
rem ------------------------------------
rem IMPORTANT !!!
rem sender$: Please insert your address here !
rem If you need different formats, simply create new procedures: sender2, sender3, ...
rem ------------------------------------
proc sender$:
return "Berthold Daum"+chr$(10)+"21 Margate St."+chr$(10)+"Beaumaris, Vic. 3193"+chr$(10)+"AUSTRALIA"
endp
proc date$:
return left$(datim$,15)
endp
proc given$:(t$)
local r%,tt$(255),tit$(50)
onerr err1
if len(t$)
tt$ = stripb$:(t$)
r% = loc(tt$,",")
if r%
tt$ = stripb$:(right$(tt$,len(tt$)-r%))+" "+stripb$:(left$(tt$,r%-1))
endif
while left$(tt$,5) = "Prof " or left$(tt$,5) = "Prof."
tit$ = tit$ + left$(tt$,5)
tt$ = stripb$:(right$(tt$,len(tt$)-5))
endwh
while left$(tt$,3) = "Dr " or left$(tt$,3) = "Dr."
tit$ = tit$ + left$(tt$,3)
tt$ = stripb$:(right$(tt$,len(tt$)-3))
endwh
r% = loc(tt$," ")
if r% >= 3
if r% > 3 or mid$(tt$,2,1) <> "."
return left$(tt$,r%-1)
endif
endif
while r%
tt$ = right$(tt$,len(tt$)-r%)
r% = loc(tt$," ")
endwh
if len(tit$) : return tit$+tt$ : endif
return tx$:(52)+tt$ : rem "Mrs./Mr. "
else
err1::
return tx$:(75) : rem "Madam/Sir"
endif
ENDP
proc title$:(t$)
local r%,tt$(255),tit$(50)
onerr err1
if len(t$)
tt$ = stripb$:(t$)
r% = loc(tt$,",")
if r%
tt$ = stripb$:(right$(tt$,len(tt$)-r%))
endif
while left$(tt$,5) = "Prof " or left$(tt$,5) = "Prof."
tit$ = tit$ + left$(tt$,5)
tt$ = stripb$:(right$(tt$,len(tt$)-5))
endwh
while left$(tt$,3) = "Dr " or left$(tt$,3) = "Dr."
tit$ = tit$ + left$(tt$,3)
tt$ = stripb$:(right$(tt$,len(tt$)-3))
endwh
if len(tit$) : return tit$ : endif
return tx$:(52)
endif
err1::
return tx$:(75)
ENDP
proc initial$:(t$)
local r%,tt$(255)
if len(t$)
tt$ = stripb$:(t$)
r% = loc(tt$,",")
if r%
tt$ = stripb$:(right$(tt$,len(tt$)-r%))+" "+stripb$:(left$(tt$,r%-1))
endif
while left$(tt$,5) = "Prof " or left$(tt$,5) = "Prof."
tt$ = stripb$:(right$(tt$,len(tt$)-5))
endwh
while left$(tt$,3) = "Dr " or left$(tt$,3) = "Dr."
tt$ = stripb$:(right$(tt$,len(tt$)-3))
endwh
if loc(tt$," ")
return left$(tt$,1)+"."
endif
endif
ENDP
proc sur$:(t$)
local r%,tt$(255)
if len(t$)
r% = loc(t$,",")
if r%
return stripb$:(left$(t$,r%-1))
endif
tt$ = stripb$:(t$)
r% = loc(tt$," ")
while r%
tt$ = right$(tt$,len(tt$)-r%)
r% = loc(tt$," ")
endwh
return tt$
endif
ENDP
proc uc$:(t$)
return upper$(t$)
endp
proc uc1$:(t$)
if len(t$)
return upper$(left$(t$,1))+lower$(right$(t$,len(t$)-1))
endif
endp
proc country$:(t$)
local r%
if asc(t$) = %+
return gcnam$:(t$)
else
r% = loc(t$,"[")
if r%
if right$(t$,1) = "]"
return upper$(mid$(t$,r%+1,len(t$)-r%-1))
endif
endif
endif
endp
proc fillin$:(t$)
local s$(40)
s$ = left$(t$,40)
lock on
dinit "Enter data for"
dedit s$,""
if dialog
lock off
return s$
endif
lock off
endp
proc prompt$:
rem repprmt$ and repprmt% are defined globally.
if not repprmt%
repprmt% = -1
lock on
dinit "Enter global data string"
dedit repprmt$,""
dialog
lock off
endif
return repprmt$
endp
proc pos$:
rem reppos% is defined globally.
return num$(reppos%,8)
endp