home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / utilsr / reppoc / RPFUNC.OPL < prev   
Text File  |  1995-01-09  |  4KB  |  192 lines

  1. app reppoc
  2. enda
  3.  
  4. rem rpfunc contains all text functions for RepPoc.
  5. rem Text functions always return a string (may be empty).
  6. rem Result string may contain control characters: chr$(10) = newline, chr$(9) = tab
  7. rem Text functions may have one argument or no argument.
  8. rem Text functions can be invoked in field specifications used for
  9. rem Searching, Sorting, Printing.
  10. rem Text functions are invoked with their name followed by :: and the argument.
  11. rem     e.g.
  12. rem             sender::
  13. rem             date::
  14. rem             sur::name:
  15. rem
  16. rem Modify this module, translate it,
  17. rem then copy RPFUNC.OPA from M:\APP\ to drive:\APP\REPPOC\
  18. rem If you are running RepPoc on an S3a in S3 mode (shareware version)
  19. rem use S3 mode (Shift-T) for all translations!
  20.  
  21.  
  22. rem stripb$: is an internal function that removes blanks from the back
  23. rem and end of a string
  24.  
  25. rem ------------------------------------
  26. rem IMPORTANT !!!
  27. rem sender$: Please insert your address here !
  28. rem If you need different formats, simply create new procedures: sender2, sender3, ...
  29. rem ------------------------------------
  30.  
  31. proc sender$:
  32.     return "Berthold Daum"+chr$(10)+"21 Margate St."+chr$(10)+"Beaumaris, Vic. 3193"+chr$(10)+"AUSTRALIA"
  33. endp
  34.  
  35. proc date$:
  36.     return left$(datim$,15)
  37. endp
  38.  
  39. proc given$:(t$)
  40. local r%,tt$(255),tit$(50)
  41.     onerr err1
  42.     if len(t$)
  43.         tt$ = stripb$:(t$)
  44.         r% = loc(tt$,",")
  45.         if r%
  46.             tt$ = stripb$:(right$(tt$,len(tt$)-r%))+" "+stripb$:(left$(tt$,r%-1))
  47.         endif
  48.         while left$(tt$,5) = "Prof " or left$(tt$,5) = "Prof."
  49.             tit$ = tit$ + left$(tt$,5)
  50.             tt$ = stripb$:(right$(tt$,len(tt$)-5))
  51.         endwh
  52.         while left$(tt$,3) = "Dr " or left$(tt$,3) = "Dr."
  53.             tit$ = tit$ + left$(tt$,3)
  54.             tt$ = stripb$:(right$(tt$,len(tt$)-3))
  55.         endwh
  56.         r% = loc(tt$," ")
  57.         if r% >= 3
  58.             if r% > 3 or mid$(tt$,2,1) <> "."
  59.                 return left$(tt$,r%-1)
  60.             endif
  61.         endif
  62.         while r%
  63.             tt$ = right$(tt$,len(tt$)-r%)
  64.             r% = loc(tt$," ")
  65.         endwh
  66.         if len(tit$) : return tit$+tt$ : endif
  67.         return tx$:(52)+tt$ : rem "Mrs./Mr. "
  68.     else
  69. err1::
  70.         return tx$:(75) : rem "Madam/Sir"
  71.     endif
  72. ENDP
  73.  
  74. proc title$:(t$)
  75. local r%,tt$(255),tit$(50)
  76.     onerr err1
  77.     if len(t$)
  78.         tt$ = stripb$:(t$)
  79.         r% = loc(tt$,",")
  80.         if r%
  81.             tt$ = stripb$:(right$(tt$,len(tt$)-r%))
  82.         endif
  83.         while left$(tt$,5) = "Prof " or left$(tt$,5) = "Prof."
  84.             tit$ = tit$ + left$(tt$,5)
  85.             tt$ = stripb$:(right$(tt$,len(tt$)-5))
  86.         endwh
  87.         while left$(tt$,3) = "Dr " or left$(tt$,3) = "Dr."
  88.             tit$ = tit$ + left$(tt$,3)
  89.             tt$ = stripb$:(right$(tt$,len(tt$)-3))
  90.         endwh
  91.         if len(tit$) : return tit$ : endif
  92.         return tx$:(52)
  93.     endif
  94. err1::
  95.     return tx$:(75)
  96. ENDP
  97.  
  98. proc initial$:(t$)
  99. local r%,tt$(255)
  100.     if len(t$)
  101.         tt$ = stripb$:(t$)
  102.         r% = loc(tt$,",")
  103.         if r%
  104.             tt$ = stripb$:(right$(tt$,len(tt$)-r%))+" "+stripb$:(left$(tt$,r%-1))
  105.         endif
  106.         while left$(tt$,5) = "Prof " or left$(tt$,5) = "Prof."
  107.             tt$ = stripb$:(right$(tt$,len(tt$)-5))
  108.         endwh
  109.         while left$(tt$,3) = "Dr " or left$(tt$,3) = "Dr."
  110.             tt$ = stripb$:(right$(tt$,len(tt$)-3))
  111.         endwh
  112.         if loc(tt$," ")
  113.             return left$(tt$,1)+"."
  114.         endif
  115.     endif
  116. ENDP
  117.  
  118. proc sur$:(t$)
  119. local r%,tt$(255)
  120.     if len(t$)
  121.         r% = loc(t$,",")
  122.         if r%
  123.             return stripb$:(left$(t$,r%-1))
  124.         endif
  125.         tt$ = stripb$:(t$)
  126.         r% = loc(tt$," ")
  127.         while r%
  128.             tt$ = right$(tt$,len(tt$)-r%)
  129.             r% = loc(tt$," ")
  130.         endwh
  131.         return tt$
  132.     endif
  133. ENDP
  134.  
  135. proc uc$:(t$)
  136.     return upper$(t$)
  137. endp
  138.  
  139. proc uc1$:(t$)
  140.     if len(t$)
  141.         return upper$(left$(t$,1))+lower$(right$(t$,len(t$)-1))
  142.     endif
  143. endp
  144.  
  145. proc country$:(t$)
  146. local r%
  147.     if asc(t$) = %+
  148.         return gcnam$:(t$)
  149.     else
  150.         r% = loc(t$,"[")
  151.         if r%
  152.             if right$(t$,1) = "]"
  153.                 return upper$(mid$(t$,r%+1,len(t$)-r%-1))
  154.             endif
  155.         endif
  156.     endif
  157. endp
  158.  
  159. proc fillin$:(t$)
  160. local s$(40)
  161.     s$ = left$(t$,40)
  162.     lock on
  163.     dinit "Enter data for"
  164.     dedit s$,""
  165.     if dialog
  166.         lock off
  167.         return s$
  168.     endif
  169.     lock off
  170. endp
  171.  
  172. proc prompt$:
  173. rem repprmt$ and repprmt% are defined globally.
  174.     if not repprmt%
  175.         repprmt% = -1
  176.         lock on
  177.         dinit "Enter global data string"
  178.         dedit repprmt$,""
  179.         dialog
  180.         lock off
  181.     endif
  182.     return repprmt$
  183. endp
  184.  
  185. proc pos$:
  186. rem reppos% is defined globally.
  187.     return num$(reppos%,8)
  188. endp
  189.  
  190.  
  191.  
  192.