home *** CD-ROM | disk | FTP | other *** search
-
- * Program.: MAKEMEMS.PRG
- * Author..: Harry F. Gilbert
- * Date....: 4/2/87
- * Version.: 1.00
- * Notice..: Copyright (c) 1987, Harry F. Gilbert, All Rights Reserved.
- * Notes...: Compiled with Clipper Autumn 1986 (Copyright Nantucket)
- * Purpose.: Creates .mem-type file for Shell System
- *
- * This is an attempt to "externalize" the configuration
- * variables and strings that clutter up my Clipper Code. By
- * storing printer control codes, title strings, and common
- * variables in .MEM-type files, they can be excluded from the
- * .EXE file. This code fragment, which would normally be found in
- * a stand-along installation program, generates a series of typical
- * memory files, then allows you to choose from among the available
- * printer definition files (xxx.PRT) which is then "copied" to
- * the PRINTER.MEM file. The end user's program can thus change its
- * current printer definition without having ANY printer data
- * hard coded! To add a printer, one merely sends the user a disk
- * with any number of xxx.PRT files.
- *
- * Note that Clipper allows use of .MEM type files with extensions
- * other than .MEM; thus I define my printer definition files as
- * <printername.PRT>, and then choose one to become PRINTER.MEM.
- *
- * Also, note use of macro to handle the array name, and how the
- * array element is passed to the Printbar procedure.
- *
- * Limitations: This code is for demonstration only; thus it doesn't handle
- * very long lists of files that require multiple columns. You may
- * wish to add such niceties as save/restore previous screen, turn
- * cursor off during scroll bar, etc.
- * Any suggestions for improvements are welcome, and should be sent
- * to the author (Harry Gilbert) at THE BOSS DBBS
- * (201) 568-7293
- * 1200,2400 N,8,1
- * Register, join the Clipper conference, and support the board!
- *
- * Disclaimer: Copyright Holder (Harry F. Gilbert) hereby grants permission to
- * copy and distribute this code freely, on condition that no charge
- * whatsoever is levied for it. This software is provided FREELY
- * on an "AS IS" basis, WITHOUT ANY WARRANTY, express or implied.
- * IN PARTICULAR, the author disclaims all warranties or fitness for
- * ANY PURPOSE, and the user waives ALL claims against author for
- * special, direct, indirect, or consequential damages arising out
- * of or in connection with the use or performance of this software.
- *
- * Compile Batch File:
- * RAMCLEAR (See Data Based Advisor, October, 1986
- * CLIPPER %1
- * RAMCLEAR
- * PLINK86 FI %1 LIB DBU
- *
- * Main Program Starts here to build .mem files for system
- *
- *
- SET COLOR TO "GR+/B,N/W,B"
- CLEAR
- @ 1,0 SAY "MEMORY FILE CREATION UTILITY"
- @ 2,0 SAY REPLICATE("=",80)
- @ 21,0 SAY REPLICATE("-",80)
- @ 22,0 SAY "Creating Memory Files"
- RELEASE ALL
- c_norm = "GR+/B,N/W,B"
- c_hilite = "N/G,N/W,B"
- c_box = "BG+/B,N/W,B"
- c_head = "W+/B,N/W,B"
- c_warn = "R*/W,N/W,B"
- c_alert = "R/W,N/W,B"
- c_1 = "W+/N,GR+/N,N"
- c_2 = "GR+/N,GR+/N,N"
- c_3 = "N/N,N/N,N"
- SAVE ALL LIKE c_* TO Color.MEM
- @ 4,0 SAY "COLOR.MEM saved"
- RELEASE ALL
- *
- c_norm = "W/N,N/W,N"
- c_hilite = "N/W,W/N,W"
- c_box = "W+/N,N/W,N"
- c_head = "W+/N,N/W,N"
- c_warn = "W*/N,N/W,N"
- c_alert = "W*/N,N/W,N"
- c_1 = "W/N,W/N,N"
- c_2 = "W+/N,W/N,N"
- c_3 = "N/N,N/N,N"
- SAVE ALL LIKE c_* TO Mono.MEM
- @ 5,0 SAY "MONO.MEM saved"
- RELEASE ALL
- *
- * Create Typical System Variables MEM file
- *
- snam1 = "Harry F. Gilbert Associates Computer Programming Database"
- snam2 = "H. F. G. A."
- STORE " " TO expression,string,help_code,mode,m_fil,m_ndx,m_fld,m_prompt
- STORE " " TO seg,seg_name,output,drive,mcon
- STORE 1 TO mcopies
- STORE chr(204)+REPLICATE(chr(205),78)+chr(185) TO dline
- SAVE TO System.MEM
- @ 6,0 SAY "SYSTEM.MEM saved"
- RELEASE ALL
- *
- * Create a series of "source printer code definition files"
- *
- pxname = "EPSON FX or LQ Series Dot Matrix Printer" && name
- pxport = "LPT1:" && port
- pxreset = CHR(27)+"@" && reset printer code
- pxcond = CHR(27)+CHR(15) && condensed mode
- pxelite = CHR(27)+"M" && elite mode
- pxpica = CHR(27)+"P" && pica mode
- pxbldon = "" && bold on
- pxbldof = "" && bold off
- pxulon = "" && underline on
- pxulof = "" && underline off
- SAVE ALL LIKE px* TO Epson.PRT
- @ 7,0 SAY "EPSON.PRT saved"
- RELEASE ALL
- *
- pxname = "Hewlett-Packard Laser Jet"
- pxport = "COM2:9600,N,8,1,P"
- pxreset = chr(27)+"E"
- pcxond = chr(27)+"(s16.6H"
- pxelite = chr(27)+"&k10H"
- pxpica = chr(27)+"&k12H"
- pxbldon = ""
- pxbldof = ""
- pxulon = ""
- pxulof = ""
- SAVE ALL LIKE px* TO Laser1.PRT
- @ 8,0 SAY "LASER1.PRT saved"
- RELEASE ALL
- *
- pxname = "Diablo 630 Type Daisy Wheel Printer"
- pxport = "LPT1:"
- pxreset = chr(27)+chr(13)+"P"
- pxcond = chr(27)+chr(31)+chr(16)
- pxelite = chr(27)+chr(31)+chr(11)
- pxpica = chr(27)+chr(31)+chr(13)
- pxbldon = ""
- pxbldof = ""
- pxulon = ""
- pxulof = ""
- SAVE ALL LIKE px* TO Diablo.PRT
- @ 9,0 SAY "DIABLO.PRT saved"
- RELEASE ALL
- *
- pxname = "Okidata Dot Matrix Printer"
- pxport = "LPT1:"
- pxreset = chr(27)+chr(48)
- pxcond = chr(29)
- pxelite = chr(28)
- pxpica = chr(30)
- pxbldon = ""
- pxbldof = ""
- pxulon = ""
- pxulof = ""
- SAVE ALL LIKE px* TO Okidata.PRT
- @ 10,0 SAY "OKIDATA.PRT saved"
- RELEASE ALL
- *
- pxname = "NEC 8023 Series Dot Matrix Printer"
- pxport = "LPT1:"
- pxreset = chr(27)+"N"
- pxcond = chr(27)+"Q"
- pxelite = chr(27)+"E"
- pxpica = pxreset
- pxbldon = ""
- pxbldof = ""
- pxulon = ""
- pxulof = ""
- SAVE ALL LIKE px* TO NecDmp.PRT
- @ 11,0 SAY "NECDMP.PRT saved"
- RELEASE ALL
- *
- pxname = "IBM Proprinter Series Printer"
- pxport = "LPT1:"
- pxreset = ""
- pxcond = chr(27)+chr(15)
- pxelite = chr(27)+chr(58)
- pxpica = ""
- pxbldon = ""
- pxbldof = ""
- pxulon = ""
- pxulof = ""
- SAVE ALL LIKE px* TO Proprint.PRT
- @ 12,0 SAY "PROPRINT.PRT saved"
- RELEASE ALL
- *
- c1 = "GR+/B,N/W,B"
- c2 = "N/W,W/N,B"
- SET COLOR TO &c1
- @ 21,0 SAY "-"
- WAIT
- CLEAR
- @ 1, 0 SAY "Part 2 - List Mem Files"
- @ 2, 0 SAY REPLICATE("=",80)
- @ 21,0 SAY REPLICATE("-",80)
- *
- * Create array of Print Files
- *
- a1 = "array1"
- mask = "*.PRT" && You could insert a routine to get
- DECLARE &a1[ADIR("&mask")] && mask from user
- n = ADIR("&mask",&a1)
- *
- * Draw Box and Array
- *
- namelen = 12 && length of the filespec = xxxxxxxx.xxx
- row = 4 && top row of box
- col = 5 && left column of box
- @ row,col TO n+col,col+namelen+1 DOUBLE
- FOR i=1 TO n
- DO WHILE LEN(&a1[i]) < namelen && make string 12 characters long
- &a1[i] = &a1[i] + " " && so scroll bar fills window
- ENDDO
- @ i+row,col+1 SAY &a1[i]
- NEXT
- *
- * Initialize variables
- *
- target = SPACE(12) && selected file
- x = 0 && keypress
- i = 1 && position in array
- *
- * Highlight first file
- *
- SET COLOR TO &c2
- @ i+row,col+1 SAY &a1[i]
- *
- * Scroll Bar Routine
- *
- DO WHILE .T.
- x = INKEY()
- DO CASE
- CASE x = 27 && Pressed ESCAPE (No Selection)
- SET COLOR TO &c1
- EXIT
- CASE x = 13 && Pressed RETURN to make a selection
- target = &a1[i]
- SET COLOR TO &c1
- EXIT
- CASE x = 5 && Up arrow
- DO Paintbar WITH c1,i,row,col,&a1[i]
- i = IIF(i=1,n,i-1)
- DO Paintbar WITH c2,i,row,col,&a1[i]
- CASE x = 24 && Down Arrow
- DO Paintbar WITH c1,i,row,col,&a1[i]
- i = IIF(i=n,1,i+1)
- DO Paintbar WITH c2,i,row,col,&a1[i]
- CASE x = 1 .OR. x = 18 && Home or PageUp
- DO Paintbar WITH c1,i,row,col,&a1[i]
- i = 1 && Go to top of list
- DO Paintbar WITH c2,i,row,col,&a1[i]
- CASE x = 6 .OR. x = 3 && End or PageDn
- DO Paintbar WITH c1,i,row,col,&a1[i]
- i = n && Go to end of list
- DO Paintbar WITH c2,i,row,col,&a1[i]
- ENDCASE
- ENDDO
- target = TRIM(target)
- IF EMPTY(target)
- @ 22,0 SAY "No file was selected"
- ELSE
- @ 22,0 SAY "You have selected "+TRIM(target)+" as the current printer."
- RUN COPY &target PRINTER.MEM > NUL
- ENDIF
- RETURN
- * EOF: MAKEMEMS.PRG
-
-
-
- PROCEDURE Paintbar
- PARAMETERS color,j,r,c,line
- SET COLOR TO &color
- @ j+r,c+1 SAY line
- RETURN
- * EOP: Paintbar
-
-
- STORE " " TO expression,string,help_code,mode,m_fil,m_ndx,m_fld,m_prompt
- STORE "