home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / TEMPLGEN / GENSAY.INC < prev    next >
Encoding:
Text File  |  1987-12-20  |  1.2 KB  |  56 lines

  1. <<* GENSAY.INC *>>
  2. <<#pragma
  3.  
  4. function GenCtrlSeq( seq : string; cp,seqlen : integer ) : integer
  5. string  ch
  6. logical isprevctrl
  7. integer chcount
  8. begin
  9.   chcount := 0
  10.   isprevctrl := false
  11.   while (cp <= seqlen) and (chcount < 50)
  12.     chcount := chcount + 1
  13.     ch := seq[cp]
  14.     if (ch < ' ') or (ch = '"')    <<*Control char or '"'*>>
  15.       if not isprevctrl
  16.         gen( '"' )
  17.         isprevctrl := true
  18.       endif
  19.       gen( '+CHR(',ord(ch),')' )
  20.     else
  21.       if isprevctrl
  22.         gen( '+"' )
  23.         isprevctrl := false
  24.       endif
  25.       gen( ch )
  26.     endif
  27.     cp := cp + 1
  28.   endwhile
  29.   if isprevctrl
  30.     gen( '+"' )
  31.   endif
  32.   RETURN cp
  33. end <<*GenCtrlSeq*>>
  34.  
  35.  
  36. procedure GenSay( row,col : integer; strg : string )
  37. integer nextcol,cp,strglen
  38. begin
  39.   if isctrl( strg )
  40.     cp := 1
  41.     strglen := len( strg )
  42.     nextcol := col
  43.     while cp <= strglen
  44.       gen( '@ ',str(row,2),',',str(nextcol,2),' SAY "' )
  45.       cp := GenCtrlSeq( strg,cp,strglen )
  46.       genln( '"' )
  47.       nextcol := col + cp - 1
  48.     endwhile
  49.   else
  50.     genln( '@ ',str(row,2),',',str(col,2),' SAY "',strg,'"' )
  51.   endif
  52. end <<*GenSay*>>
  53.  
  54. <<* EOF: GENSAY.INC *>>
  55. #>>
  56.