Category : Files from Magazines
Archive   : DBMS9003.ZIP
Filename : RETTIG1.MAR
Output of file : RETTIG1.MAR contained in archive : DBMS9003.ZIP
FOXHELP converter
001: * Program: FOX2TRH.PRG
002: * Syntax : DO fox2trh
003: * Authors: Tom Rettig and Leonard Zerman
004: * Notice : Copyright (c) 1989 by Tom Rettig Associates
005: * Version: FREEWARE 1.01 -- November, 1989
006: * Notes : Runs under all versions of FoxPro
007: *
008: * Requires MVARSIZ be set over 45 in CONFIG.FP:
009: * For example: MVARSIZ = 45
010: * Increase if you get a variable overflow error.
011: *
012: ************************************************************
013:
014: * Program environment.
015: PRIVATE ALL
016: SET CONSOLE OFF
017: _talk = SET("TALK") = "ON"
018: SET CONSOLE ON
019: IF _talk
020: SET TALK OFF
021: ENDIF
022: _exact = SET("EXACT") = "ON"
023: IF _exact
024: SET EXACT OFF
025: ENDIF
026: _start = SECONDS()
027:
028: * Program constants.
029: _crlf = CHR(13)+CHR(10)
030: tab = CHR(9)
031: eof = CHR(26)
032: space = " "
033: null = ""
034: zero = 0
035: line_width = 69
036:
037: * Open input database file.
038: SET HELP OFF && close help file (if opened previously)
039: SELECT (zero)
040: USE Foxhelp
041: ? "Creating temporary file from FOXHELP.DBF --",;
042: LTRIM(STR(RECCOUNT(),3)), "entries."
043:
044: * Open temporary output file.
045: _tempfile = GETENV("TMP")
046: IF !EMPTY(_tempfile)
047: IF !RIGHT(_tempfile,1)$"\:"
048: _tempfile = _tempfile + "\"
049: ENDIF
050: handle = FCREATE(_tempfile)
051: IF handle == -1 && invalid TMP setting, so
052: _tempfile = "Foxhelp.trs" && use current directory
053: handle = FCREATE(_tempfile)
054: ENDIF
055: ELSE
056: _tempfile = "Foxhelp.trs"
057: handle = FCREATE(_tempfile)
058: ENDIF
059:
060: * FoxPro version.
061: build = VERSION()
062: start = 1
063: DO WHILE !ISDIGIT(SUBSTR(build,start))
064: start = start+1
065: ENDDO
066: build = STR(VAL(SUBSTR(build,start)),4,2)
067:
068: * File header.
069: string = "\filename FOXHELP.TRH"+;
070: _crlf+"\notice Copyright 1989 Fox Software, " +;
071: "All Rights Reserved"+;
072: _crlf+"\comment Converted from FOXHELP.DBF " +;
073: DTOC(DATE())+;
074: _crlf+"\version " + build
075: ? string
076: = FPUTS(handle, string+_crlf)
077: _error = FERROR() > zero
078:
079: * Records.
080: SCAN WHILE !_error
081: * Keyword.
082: keyword = STRTRAN(ALLTRIM(Topic), "( )", "()")
083: is_info = LEFT(keyword,1)==CHR(16) && info prefix
084: IF is_info
085: keyword = LTRIM(SUBSTR(keyword,2))
086: ENDIF
087: ? STR(RECNO(),3), keyword
088: key4 = space+LEFT(keyword,4)
089: key3 = space+LEFT(keyword,3)
090: key1 = LEFT(keyword,1)
091: set4 = IIF(keyword="SET ", SUBSTR(keyword,4,5), null)
092: u_keyword = UPPER(keyword)
093:
094: * Info menu.
095: IF !is_info
096: is_info = "EXAMPLE" $ u_keyword .OR.;
097: "DEFINED FUNCTION" $ u_keyword .OR.;
098: "SYSTEM MEMORY" $ u_keyword .OR.;
099: "READ ME"==u_keyword
100: ENDIF
101: string = "\keyword " +;
102: IIF(is_info, PROPER(keyword), keyword) + _crlf
103:
104: * Category.
105: DO CASE
106: CASE ...
107:
108:
109:
110: OTHERWISE
111: * Default category is FoxPro if not covered above.
112: build = "FoxPro"
113: ENDCASE
114: string = string + "\category " + build + _crlf
115: ?? " " + build
116:
117: * Type.
118: DO CASE
119: CASE ...
120:
121:
122:
123: OTHERWISE
124: * Default type is Command if not covered above.
125: build = "Command"
126: ENDCASE
127: string = string + "\type " + build + _crlf
128: ?? space + IIF(is_info, LEFT(build,4), build)
129:
130: * See also.
131: i = 1
132: start = ATC("See also:", Details, i) + 10
133: IF start > 10
134: build = null
135: DO WHILE .T.
136: end = AT(_crlf, SUBSTR(Details, start))
137: IF end==zero
138: build = build + ALLTRIM(SUBSTR(Details, start))
139: ELSE
140: build = build + ALLTRIM(SUBSTR(Details, start,;
141: end-1))
142: ENDIF
143: i = i+1
144: start = ATC("See also:", Details, i) + 10
145: IF start > 10
146: build = build + ", "
147: ELSE
148: string = string + "\also " +;
149: STRTRAN(build, "( )", "()") + _crlf
150: EXIT
151: ENDIF
152: ENDDO
153: ENDIF
154:
155: * Detail.
156: detail = STRTRAN(STRTRAN(STRTRAN(STRTRAN(STRTRAN(;
157: STRTRAN(STRTRAN(STRTRAN(STRTRAN(STRTRAN(;
158: STRTRAN(STRTRAN(TRIM(Details),;
159: "\", "\\"),;
160: eof, "\a"),;
161: tab, SPACE(3)),;
162: "( )", "()"),;
163: "Format:", "\hFormat:\e"),;
164: "Formats:", "\hFormats:\e"),;
165: "See also:", "\nSee also:\e"),;
166: "See Also:", "\nSee Also:\e"),;
167: "WARNING:", "\hWARNING:\e"),;
168: "Examples:", "\hExamples:\e"),;
169: "Example:", "\hExample:\e"),;
170: "Program Example:", "\hProgram Example:\e")
171: start = 1
172: end = LEN(detail)
173: DO WHILE SUBSTR(detail,end-1,2) == _crlf .OR.;
174: SUBSTR(detail,end,1) $ space+tab
175: end = end-IIF(SUBSTR(detail,end-1,2)==_crlf, 2, 1)
176: ENDDO
177: build = null
178:
179: DO WHILE .T. && handle one line at a time
180: line = SUBSTR(detail, start, line_width)
181: IF end-start < line_width && last line
182: build = build + SUBSTR(line, 1, end-start+1)
183: EXIT
184: ENDIF
185: pos = RAT(_crlf, line)
186: IF pos > zero && parse line at last hard _crlf
187: build = build + LEFT(line, pos-1) + _crlf
188: start = start+pos+1
189: ELSE && parse line at last hard space
190: pos = RAT(space, line)
191: IF pos > zero
192: build = build + LEFT(line, pos-1) + _crlf
193: start = start+pos
194: ELSE && exceeds line_width with no _crlf or spaces
195: build = build + line + _crlf
196: start = start+line_width-1
197: ENDIF
198: ENDIF
199: ENDDO
200: = FPUTS(handle, string + "\detail" + _crlf + build +;
201: _crlf + "\end" + _crlf)
202: _error = FERROR() > zero
203: ENDSCAN
204:
205: * Clean up.
206: = FCLOSE(handle)
207: USE
208: RELEASE ALL EXCEPT _*
209:
210: * Compile and delete temporary file.
211: IF ! _error
212: ? "Making TRHELP Data File from temporary file..."+_crlf
213: RUN /160 Fox2trh
214: ELSE
215: ? "File Error:", FERROR(), _crlf
216: ENDIF
217: ERASE (_tempfile)
218:
219: * Elapsed time.
220: et = SECONDS() - _start
221: ?? "FOX2TRH elapsed time: " +;
222: LTRIM(STR(INT(et/60))) + " minutes " +;
223: LTRIM(STR(MOD(et,60),6,3)) + " seconds."
224:
225: * Restore environment and return to FoxPro.
226: IF _exact
227: SET EXACT ON
228: ENDIF
229: IF _talk
230: SET TALK ON
231: ENDIF
232: RETURN
233: * EOF: Fox2trh.prg
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/