home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / prtdrv.zip / PRTSETUP.PRG < prev    next >
Text File  |  1987-03-04  |  6KB  |  226 lines

  1. * Program...: PrtSetup.PRG
  2. * Author....: Kent Irwin
  3. * Date......: May 1, 1987
  4. * Version...: dBASE III PLUS
  5. * Note(s)...: Program to store printer control codes to a memory file.
  6. *
  7. *
  8. SET TALK OFF
  9. SET BELL OFF
  10. SET PROCEDURE TO PrtSetup
  11. blanks = SPACE(30)
  12. row    = 24
  13. STORE blanks TO p_six, p_eight, p_10cpi, p_12cpi, p_name, p_cmpr_on,;
  14.                 p_cmpr_off, p_nlq_on, p_nlq_off, p_bold_on, p_bold_off,;
  15.                 p_und_on, p_und_off, p_ital_on, p_ital_off, p_emph_on
  16.  
  17. STORE blanks TO p_emph_off, p_dbl_on, p_dbl_off, p_expn_on, p_expn_off,;
  18.                 p_supr_on, p_supr_off, p_sub_on, p_sub_off, p_msb_on,p_msb_off
  19. CLEAR
  20. f_name = SPACE(8)
  21. @ 10, 15 SAY "Name of Setup .MEM file" ;
  22.     GET f_name;
  23.     PICTURE "@!"
  24. READ
  25. IF AT('.MEM', f_name) = 0
  26.   IF AT('.', f_name) <> 0
  27.     f_name = LEFT(f_name, AT('.', f_name) - 1)
  28.   ENDIF 
  29.   f_name = LEFT(f_name, MIN(8, LEN(TRIM(f_name)))) + '.MEM'
  30. ENDIF
  31. IF FILE(f_name)
  32.   CLEAR
  33.   @ row, 20 SAY "Loading, please wait "
  34.   column = COL()
  35.   @ row, column + 1 SAY REPLICATE('.', 20)
  36.   offset = 0                    
  37.   RESTORE FROM &f_name ADDITIVE
  38.   DO Dconvert WITH p_six
  39.   DO Dconvert WITH p_cmpr_on
  40.   DO Dconvert WITH p_eight
  41.   DO Dconvert WITH p_10cpi
  42.   DO Dconvert WITH p_12cpi
  43.   DO Dconvert WITH p_cmpr_off
  44.   DO Dconvert WITH p_nlq_ON
  45.   DO Dconvert WITH p_nlq_OFF
  46.   DO Dconvert WITH p_bold_on
  47.   DO Dconvert WITH p_bold_off
  48.   DO Dconvert WITH p_und_on
  49.   DO Dconvert WITH p_und_off
  50.   DO Dconvert WITH p_ital_on
  51.   DO Dconvert WITH p_ital_off
  52.   DO Dconvert WITH p_emph_on
  53.   DO Dconvert WITH p_emph_off
  54.   DO Dconvert WITH p_dbl_on
  55.   DO Dconvert WITH p_dbl_off
  56.   DO Dconvert WITH p_expn_on
  57.   DO Dconvert WITH p_expn_off
  58.   DO Dconvert WITH p_supr_ON
  59.   DO Dconvert WITH p_supr_off
  60.   DO Dconvert WITH p_sub_on
  61.   DO Dconvert WITH p_sub_off
  62.   DO Dconvert WITH p_msb_on
  63.   DO Dconvert WITH p_msb_off
  64.   @ 24, 0 
  65. ENDIF
  66. CLEAR
  67. @  1, 28 SAY "Printer Setup Program"
  68. @  3, 12 SAY "Printer Name"
  69. @  4, 10 SAY "Six Lines/Inch"
  70. @  5,  8 SAY "Eight Lines/Inch"
  71. @  6, 17 SAY "Ten CPI"
  72. @  7, 14 SAY "Twelve CPI"
  73. @  9, 28 SAY "ON"
  74. @  9, 62 SAY "OFF"
  75. @ 10,  4 SAY "Compressed"
  76. @ 11,  0 SAY "Letter Quality"
  77. @ 12, 10 SAY "Bold"
  78. @ 13,  5 SAY "Underline"
  79. @ 14,  8 SAY "Italic"
  80. @ 15,  4 SAY "Emphasized"
  81. @ 16,  1 SAY "Double-Strike"
  82. @ 17,  6 SAY "Expanded"
  83. @ 18,  3 SAY "Superscript"
  84. @ 19,  5 SAY "Subscript"
  85. @ 20,  4 SAY "No 8th bit"
  86. @ 24, 15 SAY "Press Ctrl-Q to quit, or Ctrl-W to Save."
  87. *
  88. @  3, 25 GET p_name
  89. @  4, 25 GET p_six
  90. @  5, 25 GET p_eight
  91. @  6, 25 GET p_10cpi
  92. @  7, 25 GET p_12cpi
  93. @ 10, 15 GET p_cmpr_on
  94. @ 10, 49 GET p_cmpr_off
  95. @ 11, 15 GET p_nlq_ON
  96. @ 11, 49 GET p_nlq_OFF
  97. @ 12, 15 GET p_bold_on
  98. @ 12, 49 GET p_bold_off
  99. @ 13, 15 GET p_und_on
  100. @ 13, 49 GET p_und_off
  101. @ 14, 15 GET p_ital_on
  102. @ 14, 49 GET p_ital_off
  103. @ 15, 15 GET p_emph_on
  104. @ 15, 49 GET p_emph_off
  105. @ 16, 15 GET p_dbl_on
  106. @ 16, 49 GET p_dbl_off
  107. @ 17, 15 GET p_expn_on
  108. @ 17, 49 GET p_expn_off
  109. @ 18, 15 GET p_supr_ON
  110. @ 18, 49 GET p_supr_off
  111. @ 19, 15 GET p_sub_on
  112. @ 19, 49 GET p_sub_off
  113. @ 20, 15 GET p_msb_on
  114. @ 20, 49 GET p_msb_off
  115. READ
  116. CLEAR
  117. choice = " "
  118. @ 12, 15 SAY "Save This Setup File?" GET choice PICTURE "@!"
  119. READ
  120. CLEAR
  121. IF UPPER(choice) <> "Y"
  122.   CLOSE PROCEDURE
  123.   SET TALK ON
  124.   RETURN
  125. ENDIF
  126. @ row, 20 SAY "Now processing "
  127. column     = COL()
  128. offset     = 0
  129. x_msb_flag = .F.
  130. @ row, column + 1 SAY REPLICATE('.', 20)
  131. DO Convert WITH p_msb_on
  132. DO Convert WITH p_msb_off
  133. x_msb_flag = (LEN(TRIM(p_msb_on)) <> 0 .AND. LEN(TRIM(p_msb_off)) <> 0)
  134. DO Convert WITH p_six
  135. DO Convert WITH p_cmpr_on
  136. DO Convert WITH p_eight
  137. DO Convert WITH p_10cpi
  138. DO Convert WITH p_12cpi
  139. DO Convert WITH p_cmpr_off
  140. DO Convert WITH p_nlq_ON
  141. DO Convert WITH p_nlq_OFF
  142. DO Convert WITH p_bold_on
  143. DO Convert WITH p_bold_off
  144. DO Convert WITH p_und_on
  145. DO Convert WITH p_und_off
  146. DO Convert WITH p_ital_on
  147. DO Convert WITH p_ital_off
  148. DO Convert WITH p_emph_on
  149. DO Convert WITH p_emph_off
  150. DO Convert WITH p_dbl_on
  151. DO Convert WITH p_dbl_off
  152. DO Convert WITH p_expn_on
  153. DO Convert WITH p_expn_off
  154. DO Convert WITH p_supr_ON
  155. DO Convert WITH p_supr_off
  156. DO Convert WITH p_sub_on
  157. DO Convert WITH p_sub_off
  158. @ 24, 0 
  159. *
  160. SET SAFETY OFF
  161. SAVE TO &f_name ALL LIKE p_*
  162. SET SAFETY ON
  163. CLOSE PROCEDURE
  164. SET TALK ON
  165. RETURN
  166. * EOP PrtSetup.PRG
  167.  
  168. PROCEDURE Dconvert
  169. PARAMETERS string
  170. *
  171. temp      = 1
  172. newstring = ""
  173. *
  174. * Comment out the next line to disable 'walking arrow' and 
  175. * speed up the operation.
  176. *
  177. DO Walk WITH row, column, offset
  178. macro = "LTRIM(STR(ASC(SUBSTR(string, temp, 1)), 3))"
  179. DO WHILE temp <= LEN(string)
  180.   newstring = IIF(LEN(newstring) <> 0, newstring + ',' + ¯o, ¯o)
  181.   temp      = temp + 1
  182. ENDDO
  183. newstring = LEFT(newstring + blanks, 30)
  184. string    = newstring
  185. RETURN
  186. * EOP DConvert
  187.  
  188. PROCEDURE Convert
  189. PARAMETERS string
  190. *
  191. string    = TRIM(string)
  192. newstring = ""
  193. *
  194. * Comment out the next line to disable 'walking arrow' and 
  195. * speed up the operation.
  196. *
  197. DO Walk WITH row, column, offset
  198. x_msb_ok = .F.
  199. pos      = AT("," , SUBSTR(string, 1, LEN(string)))
  200. DO WHILE pos <> 0
  201.   char      = SUBSTR(string, 1, pos - 1)
  202.   x_msb_ok  = x_msb_ok .OR. (x_msb_flag .AND. (char = '0'))
  203.   newstring = newstring + IIF(x_msb_ok, CHR(128), CHR(VAL(char)))
  204.   string    = SUBSTR(string, pos + 1, LEN(string) - pos + 1)
  205.   pos       = AT("," , string)
  206. ENDDO
  207. x_msb_ok  = x_msb_ok .OR. (x_msb_flag .AND. (string = '0'))
  208. newstring = newstring + IIF(x_msb_ok, CHR(128), CHR(VAL(string)))
  209. IF x_msb_ok
  210.   string = p_msb_on + newstring + p_msb_off
  211. ELSE
  212.   string = newstring
  213. ENDIF
  214. RETURN
  215. * EOP Convert
  216.  
  217. PROCEDURE Walk
  218. PARAMETERS row, column, offset
  219.  
  220. @ row, column + offset SAY '.'
  221. offset = MOD(offset + 1, 20)
  222. @ row, column + offset SAY CHR(16)
  223. @ row, column + offset SAY SPACE(0)
  224. RETURN
  225. * EOP Walk
  226.