home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CICA 1995 May
/
cica_0595_4.zip
/
cica_0595_4
/
UTIL
/
ENHPCP1
/
DECOM.WAS
next >
Wrap
Text File
|
1992-12-01
|
2KB
|
51 lines
;"DeCom" - Script to de-comment scripts
;When I began to comment my scripts, I found that my comments almost always
;carried the lines to more than 80 characters, making printouts almost
;impossible to read (I like to work on my scripts while I'm riding the bus).
;This script will de-comment another script file. It will not remove
;#comment-#endcomment blocks, only those lines containing a ";" will
;be affected.
;please send any comments, criticisms, complaints, praises, donations (haha), etc. to
;Erick Hammersmark, ehammers@u.washington.edu
string OldLine,NewLine,InFile,OutFile,LineString = "Line 0"
integer lines,selection,index
proc main
sdlgfopen "Input File" "c:\prowin\aspect\*.was" InFile ;select input file
if not success
exit
endif
fopen 0 InFile READ TEXT ;open input file
sdlgsaveas "Output File" "c:\prowin\aspect\*.was" OutFile ;select output file
if not success
exit
endif
fopen 1 OutFile CREATE TEXT ;create output file
dialogbox 161 128 133 50 3 "Converting"
vtext 33 19 66 9 center LineString
enddialog
while 1
fgets 0 OldLine ;read line from input file
inc lines ;increase "lines" by one
strfmt LineString "Line %d" lines ;display new value for "lines"
updatedlg 64
strfind OldLine ";" index ;locate comment
if Found ;if there's a comment
strcpy NewLine OldLine index ;copy only everything before the comment to NewLine
else ;else
NewLine = OldLine ;copy everything to NewLine
endif
fputs 1 NewLine ;write NewLine to output file
if feof 0 ;if at the end of input file
exitwhile ;exit loop
endif
endwhile
destroydlg
fclose 0
fclose 1
sdlgmsgbox "Done!" "Conversion complete." INFORMATION OK selection 1
endproc