home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a046 / 5.img / TEMPLATE / GENSAY.INC < prev    next >
Encoding:
Text File  |  1992-04-01  |  1.2 KB  |  57 lines

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