From f8b8244ab1c78a2b4e8b28f908e1c63609e97d40 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Mon, 18 Jun 2012 06:31:54 -0400 Subject: [PATCH] More record support/work/fixes --- mystic/mpl_compile.pas | 47 +++++++++++++++++++++++++++++++++++++----- mystic/mpl_execute.pas | 17 ++++++++++++++- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/mystic/mpl_compile.pas b/mystic/mpl_compile.pas index d3d20c4..88930b7 100644 --- a/mystic/mpl_compile.pas +++ b/mystic/mpl_compile.pas @@ -1287,6 +1287,9 @@ Begin VarNum := FindVariable(IdentStr); + // need to create a file type parser in execute + // so we can output the record size and support "file of records" + If VarData[VarNum]^.vType <> iFile Then Error (mpsTypeMismatch, ''); End; @@ -1304,6 +1307,10 @@ Begin Error (mpsTypeMismatch, ''); OutWord (VarData[VarNum]^.VarID); + + ParseArray (VarNum, True); + ParseElement (VarNum, False, iLongInt); + // added array and element 1.10a14 for onecard := deck[1] problem End; Procedure TParserEngine.NewBooleanCrap; @@ -2245,9 +2252,10 @@ End; Procedure TParserEngine.StatementCase; Var - VarNum : LongInt; - SavedPos : LongInt; - Count : LongInt; + VarNum : LongInt; + SavedPos : LongInt; + Count : LongInt; + TargetType : TIdentTypes; Begin OutString(Char(opCase)); @@ -2270,7 +2278,32 @@ Begin Exit; End; - OutString(Char(Byte(VarData[VarNum]^.vType))); + TargetType := VarData[VarNum]^.vType; + + If TargetType = iRecord Then + TargetType := ParseElementType(VarNum, True); + + OutString(Char(Byte(TargetType))); + //asf + //asdf + + Case TargetType of + iString : ParseVarString; + iChar : ParseVarChar; + iBool : ParseVarBoolean; + iByte, + iShort, + iWord, + iInteger, + iLongInt, + iCardinal, + iReal : ParseVarNumber(True); + Else + Error (mpsTypeMismatch, ''); + End; + + +(* If VarData[VarNum]^.vType = iString Then ParseVarString @@ -2283,8 +2316,12 @@ Begin Else If VarData[VarNum]^.vType in vNums Then ParseVarNumber(True) + Else + If VarData[VarNum]^.vType = iRecord Then + ParseVarRecord Else Error (mpsTypeMismatch, ''); +*) Case tkwType of 1 : GetStr (tkw[wCaseOf], True, False); @@ -2299,7 +2336,7 @@ Begin NextChar; PrevChar; - Case VarData[VarNum]^.vType of + Case TargetType of iChar, iString: Repeat ParseVarString; diff --git a/mystic/mpl_execute.pas b/mystic/mpl_execute.pas index b73a09c..d4d73e6 100644 --- a/mystic/mpl_execute.pas +++ b/mystic/mpl_execute.pas @@ -931,6 +931,9 @@ Var Target : Byte; TempStr : String; RecID : Word; + + AD : TArrayInfo; + RI : TRecInfo; Begin CheckArray (VarNum, ArrayData, RecInfo); @@ -964,7 +967,17 @@ Begin RecID := FindVariable(W); - Move (VarData[RecID]^.Data^, GetDataPtr(VarNum, ArrayData, RecInfo)^, VarData[RecID]^.DataSize); + CheckArray (RecID, AD, RI); +//asdf DEBUG DEBUG +// how do we get the real size of the shit here? +// i added Checkarray here and ParseElement in ParseVarRecord for compiler +//session.io.outfullln('datasize=' + stri2s(vardata[recid]^.datasize)); +//session.io.outfullln('varsize=' + stri2s(vardata[recid]^.varsize)); +//session.io.outfullln('|PN'); + + Move (GetDataPtr(RecID, AD, RI)^, GetDataPtr(VarNum, ArrayData, RecInfo)^, RecInfo.OneSize {VarData[RecID]^.VarSize}); + +// Move (VarData[RecID]^.Data^, GetDataPtr(VarNum, ArrayData, RecInfo)^, VarData[RecID]^.DataSize); End; End; End; @@ -1250,6 +1263,8 @@ Begin Param[Count].vID := FindVariable(W); Param[Count].vSize := VarData[Param[Count].vID]^.DataSize; Param[Count].vData := VarData[Param[Count].vID]^.Data; + //parsesometrihng + CheckArray (Param[Count].vID, ArrayData, RecInfo); End; End; End;