On Tue, January 10, 2012 05:14, waldo kitty wrote:
Hi, . . > are certain enforced limits on these lines... as such, i have defined a > record > > type > sat_name = string[25]; > line_data = string[69]; > two_line = array [1..2] of line_data; > three_line_data = record > satname : sat_name; > satdata : two_line; > end; > > const > max_sats = 65536; > > var > sat_data : array [1..max_sats] of three_line_data; > abuf : two_line; > new_data : three_line_data; > > right now i'm loading the array via a simple readln into the array > elements... > > Procedure Input_Satellite(index : word); > begin > if not EOF(fsat) then > begin > Readln(fsat,sat_data[index].satname); > Readln(fsat,sat_data[index].satdata[1]); > Readln(fsat,sat_data[index].satdata[2]); > end; {if} > end; {Procedure Input_Satellite} > > this is fine for the initial loading but i'm needing to read additional > TLE > files and insert those records into the above array... my problem is that > i need > the array sorted on a sectional value from sat_data[index].satdata[1] > > sat_catnr := Copy(abuf[1],3,5); > and > new_catnr := Copy(abuf[1],3,5); > > which are loaded and compared between sat_data[index].sat_data and > new_data.sat_data > > in the case of collisions (same catnr), i need to choose between the > greater of > a pair of values from the stored record (sat_data) and the new record > (new_data) > read from a file... > > Function Real_Value(buffer : string; > start,length : integer) : double; > var > result : integer; > answer : double; > begin > buffer := Copy(buffer,start,length); > Convert_Blanks(buffer); > if buffer = '' then > buffer := '0'; > Val(buffer,answer,result); > if result = 0 then > Real_Value := answer > else > Real_Value := 0.0; > end; {Function Real_Value} > > > via... > > sat_epoch := Real_Value(abuf[1],19,14); > and > new_epoch := Real_Value(abuf[1],19,14); > > > which are loaded and compared between sat_data[index].satdata and > new_data.satdata... > > my problem is that i cannot find any similar examples where an array of > records > is built, sorted and duplicates are eliminated based on specific factors > of the > two records being compared... > > uncle has been failing me for the last several hours and i'm loosing sight > of > what i'm trying to get done... i've seen references to using a > tstringlinst as > well as something apparently non-existent called a tarray... in all of the > stuff > i've seen on tstringlinst, there's nothing that i find that is close to > what i'm > (thinking i'm) looking for... and here's where i keep getting diverted > away from > the final goal due to trying to follow everything else :/ I've tried something similar recently. After trying to figure out how to use the classes included with FPC and build something on top of them, I resorted to using the old TP/BP compatible object model with TSortedCollection (as provided in unit objects). Tomas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal