home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / comm / fido / spot / rexx / headliner / headliner.spot < prev   
Text File  |  1994-03-20  |  4KB  |  152 lines

  1. /*
  2.  *
  3.  * HeadLiner: Headline generator © 1994 PSR Software
  4.  * 
  5.  * Freeware.  May not be altered or modified without permission!
  6.  *
  7.  * $VER: Headliner v1.3 (04.04.94)
  8.  *
  9.  */
  10.  
  11. /* BOUNDARY · This marks the start of the program which I hereby
  12. give permission to be altered as suits you. */
  13.  
  14.   FONTPATH = 'Fonts:Headliner'
  15.   TEMP = 'T:Spot.Headliner.temp'
  16.  
  17. /* BOUNDARY · This marks the end of the program which may be
  18. altered. */
  19.  
  20. LF = '0d'x
  21. AP = '27'x
  22.  
  23. Address SPOT
  24. Options Results
  25.  
  26. 'IsIconified'
  27. If RC=0 Then 'UnIconify'
  28.  
  29. 'IsMessages'
  30. If ~(RC=0) Then Do
  31.    'RequestNotify PROMPT "Use only from Message window."'
  32.    Exit
  33. End
  34.  
  35. lineloop=1
  36. Do Until RC>0
  37.   'RequestString TITLE "Headline #'lineloop'" PROMPT "Specify the headline'LF'   Cancel to stop"'
  38.   If ~(RC>0) Then Do
  39.     LINE.lineloop=RESULT
  40.     lineloop=lineloop+1
  41.   End
  42. End
  43.  
  44. LINENO=lineloop-1
  45. If LINENO=0 Then Exit
  46.  
  47. 'RequestFile TITLE "Headliner Font" PATH "'fontpath'" FILE "Headliner.SANSERIF.font" PATTERN "Headliner.#?.font"'
  48. If RC>0 Then Exit
  49. FONT=RESULT
  50.  
  51. If ~Open('Font',FONT,'r') Then Do
  52.   'RequestResponse TITLE "Headliner" PROMPT "Cannot open requested font."'
  53.   Exit
  54. End
  55.  
  56. /* Read in font */
  57.  
  58. CHARSNO=0
  59. HEIGHT=0
  60. SPACE=3
  61. GAP=1
  62.  
  63. Do Until Eof('Font') | (LINE='begin')
  64.   LINE=ReadLn('Font')
  65.   If Upper(Left(LINE,6))='CHARS=' Then Do
  66.     CHARS=Trim(Right(LINE,Length(LINE)-6))
  67.     CHARNO=Length(CHARS)
  68.   End
  69.   If Upper(Left(LINE,7))='HEIGHT=' Then Do
  70.     HEIGHT=Strip(Right(LINE,Length(LINE)-7),'b')
  71.   End  
  72.   If Upper(Left(LINE,6))='SPACE=' Then Do
  73.     SPACE=Strip(Right(LINE,Length(LINE)-6),'b')
  74.   End
  75.   If Upper(Left(LINE,4))='GAP=' Then Do
  76.     GAP=Strip(Right(LINE,Length(LINE)-4),'b')
  77.   End
  78. End
  79.  
  80. If Eof('Font') Then Do
  81.   'RequestNotify TITLE "Headliner" PROMPT "Font file insufficient.'LF'End of file reached."'
  82.   Exit
  83. End
  84. If CHARNO=0 Then Do
  85.   'RequestNotify TITLE "Headliner" PROMPT "Font file insufficient.'LF'No character references."'
  86.   Exit
  87. End
  88. If HEIGHT=0 Then Do
  89.   'RequestNotify TITLE "Headliner" PROMPT "Font file insufficient.'LF'Character height not specified."'
  90.   Exit
  91. End
  92.  
  93. 'progressopen TITLE "Headliner" PROMPT "Reading font"'
  94. REQ=RESULT
  95.  
  96. Do charloop=1 To CHARNO
  97.   'progressupdate' REQ charloop CHARNO
  98.   If RC>0 Then Do
  99.     'progressclose' REQ
  100.     Exit
  101.   End
  102.   Do heightloop=0 to HEIGHT-1
  103.     CHAR.charloop.heightloop=ReadLn('Font')
  104.   End
  105. End
  106.  
  107. Call Close('Font')
  108. 'progressupdate' REQ 1 1 'PROMPT "Creating message"'
  109.  
  110. /* Create Message · you know, this algorithm killed half my brain.  If anyone
  111.    ever has a silly idea like I did when I wrote this, think again :-)        */
  112.  
  113. Do clearloop=1 To ((LINENO*height)+height)
  114.   MESSAGE.clearloop=''
  115. End
  116.  
  117. Do lineloop=1 To LINENO
  118.   Do charloop=1 To Length(LINE.lineloop)
  119.     THECHAR=Pos(SubStr(LINE.lineloop,charloop,1),CHARS)
  120.     If THECHAR=0 Then Do heightloop=0 To Height-1
  121.       ref=(lineloop*height)+heightloop
  122.       MESSAGE.ref=Insert(Copies(' ',SPACE),MESSAGE.ref,Length(MESSAGE.ref))
  123.     End
  124.     Else Do heightloop=0 To Height-1
  125.       ref=(lineloop*height)+heightloop
  126.       MESSAGE.ref=Insert(CHAR.thechar.heightloop,MESSAGE.ref,Length(MESSAGE.ref))
  127.       MESSAGE.ref=Insert(Copies(' ',GAP),MESSAGE.ref,Length(MESSAGE.ref))
  128.     End
  129.   End
  130. End
  131.  
  132. 'progressclose' REQ
  133.  
  134. /* Write Message · the everso simple bit */
  135.  
  136. If ~Open('Message',TEMP,'w') Then Do
  137.   'RequestNotify PROMPT "Can'AP't create output file"'
  138. End
  139.  
  140. Do lineloop=1 To LINENO
  141.   Do heightloop=0 To Height-1
  142.     ref=(lineloop*height)+heightloop
  143.     Call WriteLn('Message',MESSAGE.ref)
  144.   End
  145. End
  146.  
  147. Call Close('Message')
  148.  
  149. 'Write FILE "'TEMP'"'
  150.  
  151. Address Command 'Delete >NIL:' TEMP
  152.