home *** CD-ROM | disk | FTP | other *** search
- '***********************************************************************
- ' FileView.rlz
- '
- ' Load any size file into Realizer windows
- '
- ' Copyright ⌐ 1991-1992 Computer Associates International, Inc.
- ' All rights reserved.
- '
- '***********************************************************************
-
- PROC LogAppendStr (logNum, s)
- '
- ' FAST append string s to Log #logNum.
- '
- 'WARNING: Use this routine only if you're sure the carriage returns and linefeeds
- 'are all OK. If you are sure, this routine is a LOT FASTER than:
- ' PRINT #logNum; s
- 'since the PRINT statement guarantees proper carriage return handling.
-
- LOCAL oldLog, oldLen, hwt
- LOCAL WM_USER, EM_SETSEL, EM_REPLACESEL
-
- EXTERNAL "User" PROC SendMessage (word, word, word, pointer)
- WM_USER = 1024
- EM_SETSEL = (WM_USER + 1)
- EM_REPLACESEL = (WM_USER + 18)
-
- oldLog = {LogQ(_Selected), 0}
- IF NOT LogQ(_Exists; logNum) THEN
- LogNew(logNum)
- ELSE
- LogSelect(logNum)
- END IF
- oldLen = LogQSize
- hwt = LogQ(_Hwnd)
- SendMessage(hwt, EM_SETSEL, 0, Pointer(32767*2^16 + 32767))
- SendMessage(hwt, EM_REPLACESEL, 0, s)
- IF oldLog[1] THEN
- LogSelect(oldLog[1], oldLog[2])
- END IF
- IF oldLen + Len(s) <> LogQSize THEN
- STOP USING "Error appending to Log.", 1
- END IF
- END PROC
-
- fn = StdOpen("*.*", "Select file")
- IF fn = "" THEN
- EXIT PROGRAM
- END IF
-
- FontNew(1; "Courier", 10)
-
- title = Right$(fn, 12)
- LOOP
- J = InStr(title, "\")
- IF J THEN
- title = Right$(title, Len(title) - J)
- ELSE
- EXIT LOOP
- END IF
- END LOOP
-
- perPart = 30000
- sz = FileQ(fn, _Size)
- nParts = (sz - 1) \ perPart + 1
- FileOpen(1, fn)
- part = 0
- WHILE NOT FileEOF(1)
- part = part + 1
- FileRead(1, s, perPart)
- thisLog = LogQUnique()
- IF nParts > 1 THEN
- LogNew(thisLog; SPRINT("& (part P(0) of P(0))", title, part, nParts))
- IF NOT FileEOF(1) THEN
- ' put some characters back to end at a CRLF.
- this = 0
- nxt = MAX(Len(s) - 1000, 1)
- WHILE nxt
- this = nxt
- nxt = InStr(s, CHR$(13) + CHR$(10), this + 1)
- END WHILE
- IF this THEN
- FileSeek(1, this + 1 - Len(s), _Cur)
- s = LEFT$(s, this + 1)
- END IF
- END IF
- ELSE
- LogNew(thisLog; title)
- END IF
- LogAppendStr(thisLog, s)
- LogControl(_SetFont; 1)
- LogControl(_Show)
- END WHILE
- FileClose(1)
- FontControl(_Close)
-