Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : STPWS101.ZIP
Filename : STPWS101.PRG

 
Output of file : STPWS101.PRG contained in archive : STPWS101.ZIP
* STRIP_WS.PRG is a program to strip the formatting from a WordStar document.
* Written in Clipper Summer '87 (tm) and Clipper Tools One (tm) library
*
* (c) Ken LaCapria 10/12/89
* CaPDUG BBS 301-292-7955
* FidoNet 109/412
*
VERSION='1.01'
* 10/31/89
* Fixed a trouble where when you save the edited string it
* writes more than it was suposed to.
*
* Will now remove all ^Z's from the file. WordStar fills the file with
* ^Z's to the closest 128 bytes. Some programs and BBS's do not like to
* see a ^Z at the end of the file. Especially ones that append to the
* end of a file. They will do the append, but the fact that the ^Z is
* still there you will not be able to view that appended data. DOS
* and other software use ^Z as an END-OF-FILE marker.
*
*
* Version 1.00
* 10/12/89
*
* Features:
* Changes soft carriage returns to hard carriage returns.
* Removes page breaks.
* Removes WS 5.0 header.
* Converts high order bits.
* Removes DOT command lines.
* Converts tabs to spaces.
* Converts ^OC centered text commands to spaces.
* Converts right justified text embedded characters to spaces to
* preserve justification.
*
* The striped file is displayed if a full screen edit mode to allow
* further editing before saving to disk.
*
* Also adds one blank space to blank lines to make the file compatible
* with MLTBBS text files.
*
* Will handle files up to 64K bytes in length.
*
* Command line syntax:
*
* STRIP_WS d:\path\source.ext d:\path\destination.ext
*
* You can specify both files on the command line, or you can load the
* program and then enter source and destination file names.
* Will support full drive and subdirectory path designations.
* Will over-write the source file.
*
* This program has been released to the public domain. I am supplying the
* source code so you can see what makes this program tick.If you
* want to add WordStar commands to it that I have not implemented here,
* feel free to.
* All I ask is that I be given credit for writing the origional version.
* You may add your name to the list if you make changes and I would appreciate
* a copy of the modifications so I can see what has been done. There are many
* Clipper programmers better than I out there and the best way to learn more
* about any language is to see what some one else has done.
*
* Here is the legal stuff:
* This program carries absolutely no warranty.
* You use it at your own risk.
*
*
*
* Beginging on the program
*
SET SCOREBOARD OFF
SAVE SCREEN
CMDLINE=DOSPARAM()
DO WHILE .T.
CMDLINE=ALLTRIM(CMDLINE)
CMDLEN=LEN(CMDLINE)
SP=AT(' ',CMDLINE)
IF SP>1
INFILE=SUBSTR(CMDLINE,1,SP-1)
INFILE=SUBSTR(INFILE+SPACE(40),1,40)
OUTFILE=ALLTRIM(SUBSTR(CMDLINE,SP+1,CMDLEN))
OUTFILE=SUBSTR(OUTFILE+SPACE(40),1,40)
ELSE
INFILE=CMDLINE
INFILE=SUBSTR(INFILE+SPACE(40),1,40)
OUTFILE=SPACE(40)
ENDIF
@ 0,0 CLEAR TO 24,79
@ 0,0 TO 5,79 DOUBLE
IF INFILE=' '
@ 1,1 SAY 'ESC to quit'
ENDIF
@ 1,40-(LEN('STRIP_WS '+VERSION)/2) SAY 'STRIP_WS '+VERSION
@ 2,10 SAY 'Input file' GET INFILE PICTURE '@K' VALID ISIN(@INFILE)=.T.
@ 4,10 SAY 'Output file' GET OUTFILE PICTURE '@K' VALID ISOUT(@OUTFILE)=.T.
READ
IF INFILE=' '
RESTORE SCREEN
QUIT
ENDIF
@ 1,1 SAY ' '
SET CURSOR OFF
SET COLOR TO W*
@ 1,70 SAY 'Reading'
SET COLOR TO W
IN_HAN=FOPEN(INFILE)
IN_BUF=' '
OTEXT=''
TEMP=''
EOF=FREAD(IN_HAN,@IN_BUF,1)
DO WHILE EOF=1
DO WHILE IN_BUF=CHR(29)
EOF=FREAD(IN_HAN,@IN_BUF,1)
IF IN_BUF=CHR(125) .OR. IN_BUF=CHR(32)
DO WHILE IN_BUF<>CHR(29)
@ 3,1 SAY CHR(219)
EOF=FREAD(IN_HAN,@IN_BUF,1)
ENDDO
EOF=FREAD(IN_HAN,@IN_BUF,1)
IF IN_BUF=CHR(46)
DO KILLDOT
ENDIF
ELSE
FOR C=1 TO 8
@ 3,1 SAY CHR(219)
EOF=FREAD(IN_HAN,@IN_BUF,1)
NEXT
OTEXT=OTEXT+SPACE(ASC(IN_BUF))
FOR C=1 TO 4
EOF=FREAD(IN_HAN,@IN_BUF,1)
NEXT
ENDIF
ENDDO
@ 3,1 CLEAR TO 3,78
IF ASC(IN_BUF)>159
@ 3,1 SAY CHR(219)
IN_BUF=CHR(ASC(IN_BUF)-128)
ENDIF
IF ASC(IN_BUF)=138
IN_BUF=CHR(10)
ENDIF
@ 3,1 CLEAR TO 3,78
IF IN_BUF=CHR(10)
OTEXT=OTEXT+IN_BUF
EOF=FREAD(IN_HAN,@IN_BUF,1)
DO KILLDOT
ENDIF
@ 3,1 CLEAR TO 3,78
IF IN_BUF=CHR(29) .OR. ASC(IN_BUF)>159
LOOP
ENDIF
IF IN_BUF=CHR(26)
EOF=FREAD(IN_HAN,@IN_BUF,1)
LOOP
ENDIF
OTEXT=OTEXT+IN_BUF
EOF=FREAD(IN_HAN,@IN_BUF,1)
ENDDO
FCLOSE(IN_HAN)
*
@ 1,1 CLEAR TO 4,78
@ 0,40-(LEN(CHR(181)+'EDIT COMMANDS'+CHR(198))/2) SAY CHR(181)+'EDIT COMMANDS'+CHR(198)
@ 1,1 SAY '^E up one line ^X down one line ^R PgUp page up ^C PgDn page down'
@ 2,1 SAY '^S left one letter ^D right one letter ^A left on word ^F right one word'
@ 3,1 SAY '^G Del delete letter ^T delete word ^V Ins toggle insert ^Y delete line'
@ 4,1 SAY '^W save changes HOME begining of line END end of line ESC save no change'
SET CURSOR ON
WBOARD(6,0,24,79)
W_NO=WOPEN(6,0,24,79)
OTEXT=MEMOEDIT(OTEXT,0,0,18,79,.T.,'DUM',78,8)
OTEXT=STRTRAN(OTEXT,CHR(10)+CHR(13),CHR(10)+' '+CHR(13))
* OTEXT=STRTRAN(OTEXT,CHR(13)+CHR(10),CHR(13)+CHR(10)+' ')
FLEN=LEN(OTEXT)
O_FIL=FCREATE(OUTFILE)
FWRITE(O_FIL,HARDCR(OTEXT),FLEN)
FCLOSE(O_FIL)
@ 0,0 CLEAR
WCLOSE(W_NO)
CMDLINE=' '
ENDDO WHILE .T.
*
*** FUNCTION TO CHECK FOR VALID INPUT FILE NAME
*
FUNCTION ISIN
PARAMETERS XX
IF AT(',',XX)=0
X=.T.
@ 3,1 CLEAR TO 3,78
ELSE
SET COLOR TO W*
@ 3,1 SAY 'COMMA IN THE FILE NAME'
SET COLOR TO W
X=.F.
ENDIF
*
IF NUMAT(':',XX)<2
X=.T.
@ 3,1 CLEAR TO 3,78
ELSE
SET COLOR TO W*
@ 3,1 SAY 'TOO MANY COLONS'
SET COLOR TO W
X=.F.
ENDIF
*
IF FILE(XX)
X=.T.
@ 3,1 CLEAR TO 3,78
ELSE
X=.F.
SET COLOR TO W*
@ 3,1 SAY 'FILE NOT FOUND'
SET COLOR TO W
ENDIF
RETURN X
*
*** FUNCTION TO CHECK FOR VALID OUTPUT FILE NAME
*
FUNCTION ISOUT
PARAMETERS XX
IF AT(',',XX)=0
X=.T.
@ 3,1 CLEAR TO 3,78
ELSE
SET COLOR TO W*
@ 3,1 SAY 'COMMA IN THE FILE NAME'
SET COLOR TO W
X=.F.
ENDIF
*
IF NUMAT(':',XX)<2
X=.T.
@ 3,1 CLEAR TO 3,78
ELSE
SET COLOR TO W*
@ 3,1 SAY 'TOO MANY COLONS'
SET COLOR TO W
X=.F.
ENDIF
RETURN X
*
*** DUMMY FUNCTION
*
FUNCTION DUM
RETURN ''
*
*** PROCEDURE TO REMOVE .DOT COMMANDS
*
PROCEDURE KILLDOT
DO WHILE IN_BUF=CHR(46)
@ 3,1 SAY CHR(219)
DO WHILE IN_BUF<>CHR(10)
IF IN_BUF=CHR(29)
EXIT
ENDIF
EOF=FREAD(IN_HAN,@IN_BUF,1)
ENDDO
IF IN_BUF=CHR(29)
EXIT
ENDIF
EOF=FREAD(IN_HAN,@IN_BUF,1)
ENDDO
RETURN


  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : STPWS101.ZIP
Filename : STPWS101.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/