Re: [fpc-pascal] replace one field of a record in a collection...
Am 02.02.2012 21:22, schrieb waldo kitty: On 2/1/2012 17:13, Sven Barth wrote: Are you storing pointers to records in your collection? If so then just replace the field's value. The change will then be immediately visible for every other code part that holds a reference to this record. thanks for your reply, sven... you've been a big help with your responses to my questions... in answer to your question, yes... the collections are storing pointers to the records and the records are also pointers to the data (i think!)... i'm using this line to replace the data in the collection with the new data if they are not already the same... PSCRec(aSatCatColl^.At(idx))^.satname^ := asatname; the data is changing but i'm suspecting that i need to be doing something more because with the above line in place, i'm getting a lot of errors like the following... i suspect the problem is that the data being replaced is a different length that the replacement data?? if i comment out the above line, my program runs with no errors at all... What is satname? A pointer to a ShortString or a pointer to a AnsiString? Did some other part of your code catch (and cache ^^) a reference to that string? Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] replace one field of a record in a collection...
On 2/3/2012 05:07, Sven Barth wrote: Am 02.02.2012 21:22, schrieb waldo kitty: PSCRec(aSatCatColl^.At(idx))^.satname^ := asatname; the data is changing but i'm suspecting that i need to be doing something more because with the above line in place, i'm getting a lot of errors like the following... i suspect the problem is that the data being replaced is a different length that the replacement data?? if i comment out the above line, my program runs with no errors at all... What is satname? A pointer to a ShortString or a pointer to a AnsiString? Did some other part of your code catch (and cache ^^) a reference to that string? ummm... the record that contains satname has satname as a type pstring... i did try converting asatname to pstring but then ran into all kinds of stuff that had to be altered and then everything fell apart even worse so i backed out of that... as i've written before, pointer stuff is very alien to me... i'm extremely used to working with the old style 64k limitations and where strings were simply pascal strings :? i can post code if needed but i'm not sure what really need to break down into small bits for posting :? there are times that i truly hate not being college educated in this stuff but i've been at it for 30+ years and it would be a hard row to how at this point in time to try to go back and learn it all again... but i am, kinda on that road as it is... one of these days i *will* grok it... hopefully sooner than later ;) should i post (again) the type structures? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] replace one field of a record in a collection...
On 2/1/2012 17:13, Sven Barth wrote: Are you storing pointers to records in your collection? If so then just replace the field's value. The change will then be immediately visible for every other code part that holds a reference to this record. thanks for your reply, sven... you've been a big help with your responses to my questions... in answer to your question, yes... the collections are storing pointers to the records and the records are also pointers to the data (i think!)... i'm using this line to replace the data in the collection with the new data if they are not already the same... PSCRec(aSatCatColl^.At(idx))^.satname^ := asatname; the data is changing but i'm suspecting that i need to be doing something more because with the above line in place, i'm getting a lot of errors like the following... i suspect the problem is that the data being replaced is a different length that the replacement data?? if i comment out the above line, my program runs with no errors at all... Marked memory at $022847B8 invalid Wrong signature $1DBA9722 instead of 9F406D83 $004154DB $00415597 $0042E321 $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Heap dump by heaptrc unit 567275 memory blocks allocated : 27238499/28896072 521148 memory blocks freed : 26693877/28221592 46127 unfreed memory blocks : 544622 True heap size : 5439488 (112 used in System startup) True free heap : 1224336 Should be : 1812768 Call trace for block $014B5778 size 50 $00406DD1 line 1073 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 $00407515 line 1135 of satsort32.lpr $00413901 $00413901 Call trace for block $022D63C8 size 13 $00406DA8 line 1073 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $014D5A68 size 66560 $00404903 line 760 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 $F0F0F0F0 $F0F0F0F0 $F0F0F0F0 Marked memory at $022847B8 invalid Wrong signature $1DBA9722 instead of 9F406D83 $00416367 $004154DB $00415597 $0042E321 $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02284758 size 13 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Marked memory at $022846F8 invalid Wrong signature $370627AA instead of AD6CB9AE $00416367 $004154DB $00415597 $0042E321 $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $022881E0 size 6 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02284698 size 13 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02284638 size 10 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02288190 size 6 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $022845D8 size 13 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02284578 size 11 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02288140 size 6 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02284518 size 13 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Marked memory at $022844B8 invalid Wrong signature $370627AA instead of 9AB2499C $00416367 $004154DB $00415597 $0042E321 $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $022780A8 size 6 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02284458 size 13 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02284398 size 19 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02278058 size 6 $004048B2 line 759 of satsort32.lpr $00406BEE line 1042 of satsort32.lpr $0042C774 $00407515 line 1135 of satsort32.lpr $00413901 Call trace for block $02281E78 size 13 $004048B2 line 759 of
[fpc-pascal] replace one field of a record in a collection...
i've gone brain dead after a few days at my $$$ job and i cannot figure out how to replace one field of a record in a collection :/ i'm looking at my existing code that does something similar but it is replacing the entire record and that's too much as well as the fact that the two records i'm working with are not the same... i'm building a record with data from a file... this record has a field that is basically the joiner between two tables if we were talking databases... all data is linked based on this field... there is another field that contains some text... is it this text field that needs to be put in place of the text field in the collection record if the two are not the same.. so, i'm creating a record to use for the collection's search function but then when i find the record i'm seeking, i don't know how to replace its text field... the more i look at the code and try to figure it out, the more it looks like tarzan's squiggly bugs in the books that he learned to read from :? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] replace one field of a record in a collection...
Am 01.02.2012 21:21 schrieb waldo kitty wkitt...@windstream.net: i've gone brain dead after a few days at my $$$ job and i cannot figure out how to replace one field of a record in a collection :/ i'm looking at my existing code that does something similar but it is replacing the entire record and that's too much as well as the fact that the two records i'm working with are not the same... i'm building a record with data from a file... this record has a field that is basically the joiner between two tables if we were talking databases... all data is linked based on this field... there is another field that contains some text... is it this text field that needs to be put in place of the text field in the collection record if the two are not the same.. so, i'm creating a record to use for the collection's search function but then when i find the record i'm seeking, i don't know how to replace its text field... the more i look at the code and try to figure it out, the more it looks like tarzan's squiggly bugs in the books that he learned to read from :? Are you storing pointers to records in your collection? If so then just replace the field's value. The change will then be immediately visible for every other code part that holds a reference to this record. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal