Area: Quik_Bas Msg: #719 Date: 06-16-92 18:00 (Public) From: Coridon Henshaw To: David Yale Subject: anyone know about?
In a msg on <Jun 07 11:47>, David Yale of 1:141/535 writes:
DY> I am looking for two things for QB:
DY> 1- data structures fro MAXIMUS BBS (squish message structures
DY> specifically). I have the C source, but if someone has already
DY> converted them that would be a real time saver.
Here's a full reader:
--Cut Here--
TYPE SQIDX ' .SQI file: one of these per message (12 bytes)
Offst AS LONG ' A signed INTEGER with a min of -65553 and a max of +65535
UMSGID AS LONG
Hash AS LONG
END TYPE
TYPE SQBASE ' .SQD database header (256 bytes): 1 per .SQD file
SLEN AS INTEGER ' A signed INTEGER with a min or -
32767 and a max of 32767
RSVD1 AS INTEGER
NUMMSG AS LONG ' No of msgs in area
HIMSG AS LONG ' Highest msg number (same as NUMMSG)
SKIPMSG AS LONG ' # of msgs to protect from autoKill
HiWater AS LONG ' Highwatermark
UID AS LONG ' # of next UMSGID to use
BASEID AS STRING * 80' Name (incl path) of this message base
FBEGIN AS LONG ' Offset to 1st frame
FLAST AS LONG ' Offset to last frame
FFBEGIN AS LONG ' Offset to 1st free frame
FFLAST AS LONG ' Offset to last free frame
FEND AS LONG ' Offset to end of file
MAXMSGS AS LONG ' # of msgs to keep
MAXDAYS AS INTEGER ' # of days to keep msgs for
SZSQHDR AS INTEGER ' Size of SQHDR (32 bytes)
END TYPE
TYPE SQHDR
ID AS LONG
NEXTF AS LONG
PREVF AS LONG
FLEN AS LONG
MsgLen AS LONG
CLEN AS LONG
FTYP AS INTEGER
RSVD AS INTEGER
END TYPE
TYPE SQMESSAGE ' The message Header, as it appears in a Squish area
ATTRIB AS LONG
From AS STRING * 36'Fixed length string, with
the length of the number after the "*"
Dest AS STRING * 36
Subj AS STRING * 72
OrigZone AS INTEGER
OrigNet AS INTEGER
OrigNode AS INTEGER
OrigPoint AS INTEGER
DestZone AS INTEGER
DestNet AS INTEGER
DestNode AS INTEGER
DestPoint AS INTEGER
BINDATES AS STRING * 8
UTCOFST AS INTEGER
ReplyTo AS LONG
Replies AS STRING * 40
DateMsg AS STRING * 20
END TYPE
DIM Index AS SQIDX
DIM DataBase AS SQMESSAGE
DIM Pickup AS SQHDR
DIM Header AS SQBASE
COLOR 14, 1
CLS
LINE INPUT "Squish message BASE path: ", Name$
IF Name$ = "" THEN BEEP: END
IF INSTR(Name$, ".") <> 0 THEN
SquishIndex$ = MID$(Name$, 1, INSTR(Name$, ".")) + "SQI"
SquishDataBase$ = MID$(Name$, 1, INSTR(Name$, ".")) + "SQD"
ELSE
SquishIndex$ = Name$ + ".SQI"
SquishDataBase$ = Name$ + ".SQD"
END IF
IF DIR$(SquishIndex$) = "" OR DIR$(SquishDataBase$) = "" THEN
PRINT "File Not Found"
BEEP
END
END IF
OPEN SquishIndex$ FOR RANDOM AS #1 LEN = 12
OPEN SquishDataBase$ FOR BINARY AS #2
GET #2, 1, Header
PRINT "Enter message number (" +
LTRIM$(RTRIM$(STR$(Header.HiWater))) + " Max): ";
INPUT ; "", Number
PRINT
IF Number = 0 OR Number > Header.HiWater THEN
PRINT "Bad Messsage Number"
BEEP
END
END IF
CLS
SEEK #1, Number
GET #1, , Index
SEEK #2, Index.Offst + 1
GET #2, , Pickup
PRINT " ID: "; HEX$(Pickup.ID)
PRINT " Length: "; LTRIM$(STR$(Pickup.MsgLen))
SEEK #2, Index.Offst + 29
GET #2, , DataBase
PRINT " Date: "; DataBase.DateMsg
PRINT " From: "; DataBase.From
PRINT " To: "; DataBase.Dest
PRINT "Subject: " + MID$(DataBase.Subj, 1, 70)
LOCATE 7, 1
PRINT STRING$(80, "Í");
VIEW PRINT 8 TO 25
Flag = -1
Message$ = STRING$(Pickup.MsgLen - 230 - 28, " ")
GET #2, , Message$
Xlen = LEN(Message$)
FOR X = 1 TO Xlen
Mchr$ = MID$(Message$, X, 1)
IF Mchr$ = CHR$(1) THEN Mchr$ = CHR$(13) + CHR$(1)
IF Mchr$ = CHR$(0) THEN Mchr$ = CHR$(13)
PRINT Mchr$;
IF CSRLIN >= 24 AND Flag = 0 THEN
COLOR 14 + 16, 1
PRINT "Press Any Key"
A$ = INPUT$(1)
COLOR 14, 1
CLS
END IF
Flag = 0
NEXT
VIEW PRINT
COLOR 14 + 16
PRINT
PRINT "Press Any Key"
A$ = INPUT$(1)
COLOR 14, 1
CLS
END
'Ok, now for the explanations: the two main files are
<name>.SQD and <name>.SQI.
' The first structure is for the .SQI file (you can open
that one as RANDOM with
'a length of 12); the others are for the .SQD file (which you open as BINARY).
'
'There is a one-to-one correspondence between records in .SQI and the (non-
'deleted) messages. You want message #25: just read the 25th record from the
'.SQI file into the SQIDX-dimensioned variable. Then, use
the offset SQI.OFFST
'+ 1 to read the SQHDR-dimensioned variable (the SQI offsets start at 0 but QB
'treats the first byte in a BINARY file as byte 1). This SQHDR is 28-bytes
'long, and it is immediately followed by the 230 bytes of the SQMSG-defined
'variable (the message header), and SQD.MSGLEN bytes of message text.
--Cut Here--
DY> 2- A library or example code for writing QB commmmunication programs
DY> access a FOSSIL driver.
I'll have one out soon, but not PD. Nor am I going to release source. But
if your just looking for info, get a hold of FSC-0015.*
from a Fido board.
--- msgedsq 2.0.5
* Origin: -=- Point Blank -=- (1:250/804.200)
~~

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET