• embedded records/mpl

    From Pequito@21:1/126 to g00r00 on Tuesday, July 11, 2017 23:28:31
    g00r00,

    Quick question, was embedded records meant to work with data as well or just assigned data like the one posted in the whatsnew.txt.

    [snip your example from whatsnew.txt]
    Type
    Record1 = Record
    A : Byte;
    End;

    Type
    Record2 = Record
    A : Record1;
    End;

    Var
    Test : Record2;
    Begin
    Test.A.A := 10;
    End.

    [end snip]

    Here is the code I am writing in mpl but does not seem to grab the data correctly if I am using embedded records. I am trying to cut down on the amount of functions being used aka re-usable code/functions.

    [snip my code]

    uses user,cfg

    Type
    recLast = Record
    DT : LongInt
    NewUser : Boolean
    PeerIP : String[15]
    PeerHost : String[50]
    Node : Byte
    CallNum : LongInt
    Handle : String[30]
    City : String[25]
    Address : String[30]
    Gender : Char
    Email : String[35]
    UInfo : String[30]
    OptionalData: Array[1..10] of String[60]
    Reserved : Array[1..53] of Byte
    End

    Type
    recTask = record
    rec_last : recLast
    End

    Var fp : File
    Var task : recTask
    Var itext : String

    function data_read (fn:string;i:integer) : boolean
    begin
    data_read := false

    fassign(fp,fn,66)
    freset(fp)

    if ioresult = 0 then begin
    fseek(fp,(i-1)*sizeof(task))
    if not feof(fp) then begin
    fread(fp,task,sizeof(task))
    data_read := true
    end
    fclose(fp)
    end
    end

    begin
    data_read(cfgdatapath+'callers.dat',2)
    write('|CR'+task.rec_Last.Handle)
    end.

    [end snip]

    As you can see it does read it but not the right size, I am wondering if I should be using FileOpen,FileSeek etc here but there are no examples of how those are used just they where added in 1.12 A3.

    Thanks for your time g00r00!
    Pequito

    --- Mystic BBS v1.12 A34 (Linux/32)
    * Origin: Twinkle BBS # (21:1/126)
  • From g00r00@21:1/108 to Pequito on Thursday, July 13, 2017 05:49:51
    Quick question, was embedded records meant to work with data as well or just assigned data like the one posted in the whatsnew.txt.

    No I think it should work when reading as well.

    if ioresult = 0 then begin
    fseek(fp,(i-1)*sizeof(task))
    if not feof(fp) then begin
    fread(fp,task,sizeof(task))
    data_read := true
    end
    fclose(fp)
    end

    One thing I am noticing here is that fseek isn't being checked for success,
    but I can't remember how MPL reacts in this situation.

    It may very well be bugged so that it doesn't work when reading embedded records, but I am going to have to take some time to make some tests and see what I can find before I can fix it or give you an answer.

    To be honest the next 3 months or so are going to be pretty rough for me with time to spend on Mystic, but I will do my best to get through this list I have here! I apologize if this takes me a little bit to get to.

    Things should settle back down in November/December for me (I hope)....

    I have a huge list of things to look into and new ideas to consider!

    --- Mystic BBS v1.12 A35 (Windows/32)
    * Origin: Sector 7 [Mystic BBS WHQ] (21:1/108)
  • From Pequito@21:1/126 to g00r00 on Thursday, July 13, 2017 06:20:02
    On 07/13/17, g00r00 said the following...

    Quick question, was embedded records meant to work with data as well just assigned data like the one posted in the whatsnew.txt.

    No I think it should work when reading as well.

    if ioresult = 0 then begin
    fseek(fp,(i-1)*sizeof(task))
    if not feof(fp) then begin
    fread(fp,task,sizeof(task))
    data_read := true
    end
    fclose(fp)
    end

    One thing I am noticing here is that fseek isn't being checked for success, but I can't remember how MPL reacts in this situation.

    Not unless I am doing another ioresult, I never checked for a success on an fseek. This does work if it is not embedded but inside an embedded record it looks like the size is 201 static does not change when I checked.

    I stumped g00r00 with how mpl reacts in a situation whats my prize. *grin*

    To be honest the next 3 months or so are going to be pretty rough for me with time to spend on Mystic, but I will do my best to get through this list I have here! I apologize if this takes me a little bit to get to.

    All good was making a practical library set that uses re-usable functions for more than one task, why I had been playing with your embedded structures. :)

    Things should settle back down in November/December for me (I hope)....

    I have a huge list of things to look into and new ideas to consider!

    Believe me and everyone else we all have busy times, take as much as you need to respond we all appreciate the hard work you put into mystic!

    Cheers!
    Pequito

    --- Mystic BBS v1.12 A34 (Linux/32)
    * Origin: Twinkle BBS # (21:1/126)
  • From Zazz@21:1/134 to g00r00 on Saturday, July 15, 2017 12:28:59
    To be honest the next 3 months or so are going to be pretty rough for me with time to spend on Mystic, but I will do my best to get through this list I have here! I apologize if this takes me a little bit to get to.

    Things should settle back down in November/December for me (I hope)....

    I have a huge list of things to look into and new ideas to consider!

    Thanks for the update and much, very much appreciation, for what you do here!

    Ruben Figueroa aka Zazz
    Mystic Prison Board Sysop
    telnet://pb.darktech.org:24
    Web: www.rdfig.net

    --- Mystic BBS v1.12 A34 (Windows/32)
    * Origin: Mystic Prison Board BBS*Mesquite Tx (21:1/134)
  • From Pequito@21:1/101 to g00r00 on Monday, September 04, 2017 09:26:40
    On 07/13/17, g00r00 pondered and said...

    Quick question, was embedded records meant to work with data as well just assigned data like the one posted in the whatsnew.txt.

    No I think it should work when reading as well.

    if ioresult = 0 then begin
    fseek(fp,(i-1)*sizeof(task))
    if not feof(fp) then begin
    fread(fp,task,sizeof(task))
    data_read := true
    end
    fclose(fp)
    end

    One thing I am noticing here is that fseek isn't being checked for success, but I can't remember how MPL reacts in this situation.

    It may very well be bugged so that it doesn't work when reading embedded records, but I am going to have to take some time to make some tests and see what I can find before I can fix it or give you an answer.

    To be honest the next 3 months or so are going to be pretty rough for me with time to spend on Mystic, but I will do my best to get through this list I have here! I apologize if this takes me a little bit to get to.

    Things should settle back down in November/December for me (I hope)....

    I have a huge list of things to look into and new ideas to consider!

    --- Mystic BBS v1.12 A35 (Windows/32)
    * Origin: Sector 7 [Mystic BBS WHQ] (21:1/108)

    Any breaking ground with this one since the beta's for A35? =) Re-checking
    as I know this is one was or possibly is a little more complicated.

    Cheers!
    Pequito

    --- Mystic BBS v1.12 A35 (Windows/32)
    * Origin: Agency BBS | telnet://agency.bbs.geek.nz (21:1/101)