Re: [fpc-pascal] windres not required/provided by Debian 2.6.0 FPC
On 10/8/2012 03:12, Tomas Hajny wrote: The manual forgets to mention that this is only the case on Win32 (where the various GNU tools and utilities are included with the FPC installation package). It also doesn't mention that different resource compilers may be used on other platforms (e.g. gorc on Win64, etc.). i've run into resource problems when compiling projects from win32(?) to OS2... on OS2, i have to use fpc directly... everything is developed on win32(?) [w2000pro or vista] and then copied to the OS2 machine to compile the project.lpr... currently i'm using EMX on the OS2 box and i always get an error on the resource file unless i simply "comment" it out (with a '.' as the second character)... how can i handle these resource files on OS2? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Editing resource of executable
On 9/1/2012 02:56, Mark Morgan Lloyd wrote: waldo kitty wrote: Of course, an even safer way would be to leave the executable alone and to put an early check in the startup code that a subsidiary key file existed, and for that key to include something that identified the machine or site on which the program was entitled to run. true... but as i recall, one of the goals of this capability was to not have extra files laying about... i remember the days of dongles and never liked them at all... Oh yes. And all those copy-protection systems that transferred a token from a floppy to a file on disc. yup! plus there were also those floppy and some CD based ones that insisted on the floppy or CD being in the drive so they could check for a specific flaw or data in a specific place that couldn't normally be read by standard tools... But if the choice was between having an extra file or patching the executable, and if the patched executable failed on 5% of customer systems due to an OS or anti-virus check, I'd settle for the extra file and count myself lucky. agreed... i run an old(er) firewall product that performs MD5 checksums on all executable files so that it can alert when a file has changed since its last execution... when i'm updating lazarus from SVN, i like that this firewall pops up a box alerting me when svn2inc, fpmake, and a few others change during the build... this lets me know, without having to go hunting, that my new stuff is up to date... or, at least i think it is... the process will hold everything until i acknowledge the file update... it gets in the way sometimes but more often than not, i'm happy to see its alerts... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Editing resource of executable
On 8/31/2012 16:18, Mark Morgan Lloyd wrote: waldo kitty wrote: i also used this technique to store registration data and options settings directly in the executable instead of having a separate and external configuration file... i can post those old sources if anyone is interested... they only need ask... the sources are dated May 1993 and i likely saved them from the Fidonet PASCAL echo (message area)... they might have even ended up in the SWAG archives but i don't know ;) -=B-) I did this sort of thing back in the days of MZ files, where there was a simple length field in the header. and that's one of the thing this main routine uses to jump to the end real quickly... but there's also a set of starting and ending markers... plus the fact that the data is a "Typed Constant" is another factor... i don't recall for sure, but i think i've been told that FPC doesn't have typed constants??? I believe that NE files similarly had an accessible overall length, but they also had a checksum field even though this was rarely (if ever) used. interesting... this routine has a checksum item built into it... IIRC, it was so we could detect if the executable had been modified and abort operation if true... Later Windows formats (PE etc.) might use signing/blessing/branding/checksumming to varying extents, and I also think there was discussion of unix-style signing in this (or a related) list a few weeks ago. Which leaves me thinking that the safest way of doing it would be to look for an "official" program, i.e. from MS or from unix binutils, which- if a program was already signed- might request some sort of key before it would change anything. Of course, an even safer way would be to leave the executable alone and to put an early check in the startup code that a subsidiary key file existed, and for that key to include something that identified the machine or site on which the program was entitled to run. true... but as i recall, one of the goals of this capability was to not have extra files laying about... i remember the days of dongles and never liked them at all... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Editing resource of executable
On 8/31/2012 11:55, Reinier Olislagers wrote: On 31-8-2012 17:48, waldo kitty wrote: if i'm reading the above correctly, it would appear that it can possibly do what you are looking for... maybe... I'd say it can definitely do what he's asking for - but I'm biased: as well you should be :) you did notice the guy posting that message is me? And that I again posted the link to my CheckRide code project in this thread? ;) yup... i've been jumping back and forth thru several things while catching up on my emails... Thanks for looking up that post and kudos to your memory of ancient threads. you are welcome and thanks :) your original posting and Krzysztof's reminded me so much of what i use in some of my TP6 stuff... but what i use is slightly different in that it uses typed constants and modifies them in the executable during execution... one purpose of this would be to limit the execution of a trial program to only X executions or that it will only run for Y days after it is first executed or even a combination of those such that only X executions are allowed within Y days and if either is reached, then the program stops... i also used this technique to store registration data and options settings directly in the executable instead of having a separate and external configuration file... i can post those old sources if anyone is interested... they only need ask... the sources are dated May 1993 and i likely saved them from the Fidonet PASCAL echo (message area)... they might have even ended up in the SWAG archives but i don't know ;) -=B-) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Editing resource of executable
On 8/29/2012 17:46, Krzysztof wrote: Hi, I have some problem. Example: I created some exec using free pascal and lazarus. It is placed on http server. User in webbrowser click download, and server should attach link from where it is clicked into this exec. So when user run downloaded exec, this exec can read this link. The idea is that everything is in one file (and must be). My question is, exists any commandline tool which can edit executable file for edit some resource (like ResEdit or Restorator for Windows) which can be used by http server? By resource I mean some const (or resourcestring section, free pascal binary can replace it in runtime, can some tool do this same outside?). So main problem is in server side. Finally we can use free pascal compiler and compile modified source by server, but this solution we use when everything fails (admins, restrictions etc.). I need this only for windows (for now), so I'm considering some commandline installer makers like InnoSetup or something. Any idea? i think i know what you are asking for and my thought actually matches what mark loyd seemed to be saying... with that in mind, i remember reading about some sort of resource editor to allow editing of resources in a binary... it was posted in this area back in jan 2012... i don't know if this is what you are looking for but here's what i found... [QUOTE] Date: Mon, 30 Jan 2012 09:09:42 +0100 From: Reinier Olislagers To: FPC Mailing list , Lazarus mailing list Subject: [fpc-pascal] Poor man's resource code available and CheckRide update: now with editor Hi all, (Cross posted to Lazarus+FPC lists) Thanks to UPayload (http://www.delphidabbler.com/articles?article=7) and some help on the forum, I could implement an alternative way of storing files in an executable file (basically it just appends them with a footer). See source: poormansresource.pas in https://bitbucket.org/reiniero/checkride/src/, and the CheckRideResourceZipper project for sample code This method allows me to edit such a "resource" using an FPC/Lazarus program. As - I think - DoDi predicted, I had a lot of trouble trying to work with regular Windows resources, but whether that is due to bugs in FPC, Windows or me, I don't know ;) I updated my CheckRide remote control package with this functionality: a helper can edit CheckRide.exe with his hostname and port number and distribute that single exe to his clients/helped persons. This allows 1 click operation at the helped side. I also tested operation with a Linux helper running stunnel+vncviewer and a WIndows helped party running CheckRide.exe See the site mentioned above. Comments, patches, as well as criticism welcome ;) Thanks, Reinier [/QUOTE] if i'm reading the above correctly, it would appear that it can possibly do what you are looking for... maybe... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] variant.inc(82, 10) Error: Illegal type conversion: "Text" to "TextRec"
On 8/24/2012 18:07, Sven Barth wrote: Am 24.08.2012 21:21 schrieb "Jonas Maebe" It is something with your old build, namely the fact that it is not the latest release (2.6.0 at this time). Building svn versions is only supported if your starting compiler is the latest release. Sometimes I wonder if we should put this on some prominent place on the website... it seems to me that folk confuse the term "release" with... uherrrmmm... "release"... they tend to think of any release as the latest release... they don't always think of a published release as being different than intermediate releases... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TObjectQueue with ability to dequeue arbitrary positions
On 8/24/2012 14:57, Jorge Aldo G. de F. Junior wrote: [trim] When the object issues request it has to keep looping (until timeout) and dequeueing the last message from the mailbox, inspecting its transaction id for a match and requeueing the same message back into the mailbox if theres no match. Thats the problem. When messages are requeued i lose message order guarantees (Very usefull). They are still guaranteed to be delivered, but not in order anymore. when i got here, my first thought was why not add a queueID which is nothing more than a sequential serial number that gets reset to zero when the queue is empty... then keep the queue sorted on this ID... that should keep the queue in order... shouldn't it? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Get all caller adresses of a given function/procedure before executing
On 8/15/2012 03:33, Rainer Stratmann wrote: Am Wednesday 15 August 2012 03:52:00 schrieb waldo kitty: On 8/14/2012 03:11, Rainer Stratmann wrote: Am Tuesday 14 August 2012 03:28:26 schrieb waldo kitty: i've been following this whole thread with interest... one thing that i'm still not clear about, though, is why is this important? is it to see what areas of the program are actually used or something else? Yes. It has to do with that. ok... that's one part that is understandable from a statistics POV... I am not this experienced with the english language, so sorry if I do noz understand everything 100%. What means POV? sorry... acronym... Point Of View... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Get all caller adresses of a given function/procedure before executing
On 8/14/2012 22:05, Martin wrote: On 15/08/2012 02:52, waldo kitty wrote: this would be no different than the program doing writeln(snippet1); .i must still be missing something :? If I understood him correct: It is not writeln(snippet1); it is writeln('snippet1'); With quotes. yes, i caught that but thought that those were to be short examples of the strings... He does want (or already has) the text snippets as in-lined constants. ok... He does not want to do the work of maintain them in another place (which an array, or resource string would require.) what work? someone has to do it, somehow... it just seems better and even easier to have them in string variables and then just use them... i mean, ok... constants are one thing but they have their limits... if they are not intended to be constant then they should be in vars... FWIW: i have, around here somewhere, code that does alter constants during execution... but it is TP6 based hackery code... in the same vein, i also have code that saves constants to the executable and then changes them based on settings... this instead of a configuration file... then there is also code to alter the parent environment's variables... all of these things are TP6 stuff but they won't work in FPC or many of today's setups... i'm really dreading to have to figure out some other way of handling these types of things... single file distributions are very nice even if they are actually multiple files all stored in the executable ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: fpdoc executable both in bin and utils\fpdoc - but not fpdoc.css
On 8/14/2012 09:47, michael.vancann...@wisa.be wrote: On Tue, 14 Aug 2012, Tomas Hajny wrote: Actually, the file is more a configuration file for fpdoc than its documentation, isn't it? From this point of view, shouldn't SysUtils.GetAppConfigDir serve as the most reasonable location? It is definitely not a config file. It is a file that must be copied to every project you want to document with fpdoc. does that include FPC itself? it seems to me that folks questioning this install problem are talking specifically about fpc documenting itself and where this file needs to be for the fpc documentation to work and look proper in an out of the box installation whether that is from some sort of installation program thing or whether it is via downloading the sources from SVN and building them with the make system... the task of placing it correctly for one's own projects is another matter completely... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Get all caller adresses of a given function/procedure before executing
On 8/14/2012 03:11, Rainer Stratmann wrote: Am Tuesday 14 August 2012 03:28:26 schrieb waldo kitty: i've been following this whole thread with interest... one thing that i'm still not clear about, though, is why is this important? is it to see what areas of the program are actually used or something else? Yes. It has to do with that. ok... that's one part that is understandable from a statistics POV... in my mind, a multi-language tool will have all strings translated into the supported languages... The translation is a different thing to that. i don't understand... you have a list of the original strings and other lists of those strings translated into other languages... on startup, the program determines which language is chosen and it loads that translated language file... there is then no more translation needed... the program then simply uses those strings using the very same routines and no additional coding is needed... ??? if there are some that are ambiguous or used in a different way, then they would get broken down further for proper language constructs... I do not understand this... consider in english we might say "she opened the door" but in another language they might use the format of "door opened she"... basically what i'm trying to say is that the constructs of the sentences may be different... my comment above was looking that one might have to break down that sentence "she opened the door" into multiple parts so that the translation would be performed and assembled in the output of the program easier... while i have numerous tools and utils out in the wild being used on a daily bases, none of them are multi-language but i do look forward to the day when i can produce such with minimal effort in coding... i have to leave it to others to do the actual translations, though... I put only ls('snippet1'), ls('snippet2'), ls('snippet3')... around the text everywhere I want a translation. this would be no different than the program doing writeln(snippet1); when all strings are translated and stored in some translated language file... snippet1 in english would be the same snippet1 in german, dutch, japanese, etc... it is my understanding that this is also the way the existing *.po files work... the code simply loads english.po or german.po or klingon.po at the start of the program and after that, everything is the same... This is also better if you are searching for text in the program. You find then exactly the position you want. i understand what you are saying but i don't understand why... since you mentioned an online translation service, are you looking at using live translations instead of static ones stored in a language file?? [trim] You can make other tables (or fields in an array) for each translation for example. The translation is done somewhere else (for example online http://109.91.95.104/sprache). so you are looking to perform live translations, then? what if that translation service disappears tomorrow? what about your users then? There is a file with all snippets and translations (handles _not_ included, because they may change with each execution of the program). i don't see how a language can change from one day to the next or even one execution to the next... [trim] Again: all you have to do in the program is putting a ls() everywhere around you want a translation. No need for tons od additional identyfiers and additional lines like: but there's nothing like that with the existing po files if i'm understanding their purpose and method of use... the loading code simply chooses the proper po file and then loads the strings into an array or whatever using the same variables which are used everywhere no matter what language their contents are written in... i must still be missing something :? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Get all caller adresses of a given function/procedure before executing
On 8/13/2012 05:09, Rainer Stratmann wrote: Am Monday 13 August 2012 10:35:55 schrieb Lukasz Sokol: [TRIM] You were saying, that you want to know, which string has not been used / which string has been used and how many times ? I want to knof if the string was called the first time. But since I also get the pchar information of the textsnippets from the programmemory I can translate (make a list or whatever in the future) all snippets before they were called. i've been following this whole thread with interest... one thing that i'm still not clear about, though, is why is this important? is it to see what areas of the program are actually used or something else? in my mind, a multi-language tool will have all strings translated into the supported languages... if there are some that are ambiguous or used in a different way, then they would get broken down further for proper language constructs... while i have numerous tools and utils out in the wild being used on a daily bases, none of them are multi-language but i do look forward to the day when i can produce such with minimal effort in coding... i have to leave it to others to do the actual translations, though... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Translating from error numbers to symbolic name
On 8/3/2012 18:24, Marco van de Voort wrote: EAGAIN generally means that you should try again. So repeat until repeat res:=dofunc; err:=geterrno; until (res<>-1) or ((err<>ESysEINTR) and (err<>ESysEAgain)); it is a workaround against potential deadlock between userland and kernel iirc. Retrying means it can simple work. should there be some sort of retry count or timing period in which to decide to give up so that one doesn't retry forever? if yes, how might that be accomplished? ;) admittedly, i may have missed something in the ESysEINTR and ESysAgain portion since i'm a new babe with regards to signaling like that... but i just had to ask, ya know? ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
fpc-pascal@lists.freepascal.org
On 7/22/2012 03:39, leledumbo wrote: I have a web app that works fine with embedded http server, but due to its current bugs, I need to switch to something more reliable. So I choose ummm what is "its" in "its current bugs"?? the embedded http server or?? i'm going to guess the embedded http server... have these bugs been reported so they can be fixed? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inter-process communication, a cautionary tale
On 7/19/2012 03:12, Mark Morgan Lloyd wrote: waldo kitty wrote: On 7/18/2012 08:48, Mark Morgan Lloyd wrote: I was reminded of this when somebody was asking about portable signalling APIs the other day, but I think it's also relevant to discussion of e.g. how to pass a keyword to a help viewer. I am obviously aware of the fact that FPC has an IPC unit which uses a temporary file, although I have always assumed that that was more to support targets like DOS that had absolutely no concept of pipes or sockets. But perhaps it really is the safest choice in all cases. FWIW: DOS does have and has had pipes... otherwise things like DIR | MORE would not work... maybe you mean named pipes? ;) Yes, I do. And I'm obviously aware that there are plenty of addons that graft named pipes (and mailslots etc.) onto DOS. i never used any of that... didn't need to AFAIK... just regular pipes worked fine for the times i needed them but yes, they a much different animals than named pipes... However I always think of named pipes, threads etc. as being primarily OS/2 v1 innovations, although some might have been introduced by the obscure Microsoft OS usually referred to as "European MS-DOS v4.0". for some reason i was thinking that unix and xenix had named pipes back then... either way, i'm out and apologize for the diversion ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Variable of class method type of function
On 7/15/2012 08:13, Jonas Maebe wrote: On 15 Jul 2012, at 14:05, CA Gorski wrote: How to declare a variable of class method type of function? ... var MyVar: function(AParam: string): boolean of class; ... gives an error using FPC 2.6.1 (Win64). You have to use "of object", just like for a regular method. pardon my intrusion but i'm looking for clarification... in the beginning we had objects... then classes came along and they were the "new object" as objects should have been written to start with (parroting)... so now we need to remember to use "of object" when we are working with nothing but classes? i hope that is sufficiently "bikini style"* ;) [* "bikini style: short and to the point] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: RE : JSON and UTF8
On 7/11/2012 01:36, Reinier Olislagers wrote: On 11-7-2012 4:19, waldo kitty wrote: On 7/10/2012 07:00, Luiz Americo Pereira Camara wrote: With the old behavior, in an system with a system code page<> UTF8, if i try to show the parsed value of "\u4E01" in e.g. a LCL app will get garbage. I would expect to work correctly in any enviroment this means that some environments will end up with "garbage" for those UTF-8 characters that cannot be translated back to the local codepage... And your point is? that there will be data loss when converting from UTF-8 to codepages with less characters than UTF-8 has... that is what i stated and i thought it was an answer to the poster's question/problem of conversion... This change moves the conversion problem from with the JSON library to your responsibility. Please note that these same characters in a JSON string would have ended up as garbage already in the old situation. and they'll still end up as garbage anyway... especially if they do not exist in the current codepage and there's no multiple characters format to represent them... In the new situation, you have some more control over it. If you don't like the new behaviour, you can always set the conversion flag in the constructor to false instead of its default true... and move back to the earlier "conversion in a black box" method. However, if you don't have a need to convert to system codepage, as you say, you could lose information because the conversion is lossy. That has been fixed (and correctly so, IMO). For instance, I can now get a UTF8 JSON string, and write it out to a UTF8 File, process it with the FPC UTF8 functions, show it in a Lazarus TEdit or grid, etc. maybe we're talking the same basic point to each other? ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] JSON and UTF8
On 7/10/2012 07:00, Luiz Americo Pereira Camara wrote: With the old behavior, in an system with a system code page <> UTF8, if i try to show the parsed value of "\u4E01" in e.g. a LCL app will get garbage. I would expect to work correctly in any enviroment this means that some environments will end up with "garbage" for those UTF-8 characters that cannot be translated back to the local codepage... i've been running headlong into this with another project and needing to convert from UTF-8 back to at least CP437... there are more than 255 characters in UTF-8 and there's no way i know of to translate them all back to 255 characters... even with trying to use multiples like ae for æ ( alt-145 in CP437 i think realizing that this editor can do whatever it wants to :/ )... the doublet and the character i typed the ones i was thinking of for this example, though... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Windows Phone 8 + pascal
On 6/25/2012 05:12, michael.vancann...@wisa.be wrote: On Mon, 25 Jun 2012, Sven Barth wrote: Why does "COM-based + .NET-like metadata" imply that it's not native code? The core libraries are written in either C or C++ and the metadata is needed so that runtimes like .NET and languages like JavaScript can interface with WinRT. We can also use this metadata to generate Object Pascal wrappers (it is basically the successor of IDL which was used for interface definitions in the original COM) Well, now we know what you will do during your holidays ;-) I can't believe they invented yet another technology/API. Their partners must go crazy :/ they still have "partners"? or is that just a different name for something else? :P :lol: ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compilation progress
On 4/26/2012 15:06, Jonas Maebe wrote: On 26 Apr 2012, at 17:31, OBones wrote: Is there a way get progress information output by the compiler while building a project? I tried the -vt option, but I can't figure out a way to parse this and get something like current value and max while the lines are output. I also tried to look in the lazarus sources but could not figure out how they do it either. -vl shows progress every 100 lines. The compiler only knows the total number of lines once it reaches the end of the source file, so it does not print the total until it is finished. is this why there is a blank line every X lines when logging via redirection? i've seen it but not hunted it down as to why ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compiling from and to memory
On 4/20/2012 14:13, Mattias Gaertner wrote: On Fri, 20 Apr 2012 18:26:28 +0200 Florian Klaempfl wrote: [...] Do you have any proof that writing/reading to the files to disk is an issue? On modern harddisks and OSes the plain I/O speed is normally not the issue when compiling. True. Lazarus make clean all under Linux 64 bit: ramdisk: real1m8.377s user1m2.584s sys 0m4.212s disk: real1m11.661s user1m5.488s sys 0m4.352s AFAIK, linux also has much better caching capabilities, too... at least as compared to winwhatever... in one project i work with, there are magnitudes of difference when sufficiently large cache memory is available... i'm talking about compiling a complete and stripped linux based OS with all associated tools and apps for a network security device aimed at dumpster diving acquired hardware, though... still, when we're talking about 100 minutes of RAM based IO compared to 200+ or more minutes of strictly hardware based IO writes, it makes a huge difference ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compiling from and to memory
On 4/19/2012 08:11, OBones wrote: Hello all, I'm currently creating a build chain where FPC is the last step, the one producing a DLL for Windows, x86 and x64. In front of it in the chain, I have designed a generator that creates a program and a set of units from its own representation. Right now, the program and units are written to disk and then FPC is called on those files. This works fine but is somewhat slow because of disk writing and reading. I was thus wondering if there was a way to send the program and unit contents directly to FPC without writing to disk, and then get FPC to output the final DLL to a memory location as well. i'm old school so please forgive this if is is "out of bounds"... but... how about a RAM disk? do the compiling on that and then copy off to physical media when completed? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Resolving a local hostnames to an IP address
On 4/14/2012 02:20, Mark Morgan Lloyd wrote: waldo kitty wrote: [...] some systems need the trailing dot and others do not... i've seen this problem for years and it seems to be limited to some OS' to a certain extent... That issue IME is specifically at the server, i.e. you've got to be careful with your DNS zone files. no... it is different than that... i have never used bind or "zone files"... this issue exists and is especially notable with winwhatever boxen... Cf the cricket book. I've not checked what the RFCs have to say about trailing dots at the client or in the client protocol, IMO strictly they're an error. i should have included better examples, i guess... nslookup easily shows this problem when it happens... part of it has to do with the way a client _machine_ is configured... ie: is there a default domain suffix defined in the dns configuration? as for the trailing dot, as i wrote before, it signals that there are no more TLDs to look at... if ralf quint is on this list, he can definitely provide more info and better examples... we both work with the same FOSS firewall software ;) [...] the main point is that many do not know about the use of the trailing dot to denote that there are no other domains to append in an attempt to locate the given hostname... clarification: foo.bar -- foo is the hostname, bar is the TLD... foo.bar.com -- foo is the hostname, bar is a SLD, and com is a TLD... foo. -- says look up "foo" only... foo.bar -- says look up "foo.bar" first and maybe other TLDs behind... foo.bar. -- says look up "foo.bar" and don't look up more than that... i hope this makes sense and is of some assistance... The point is that I was knocking together a demo terminal emulator (using non-standard coding etc.) that communicates using telnet, and I'd copied over the ltelnet library that requires (a string containing) an IP address as its parameter. Communicating with localhost worked, but rather late in the day I discovered that I was unable to set up a connection with named servers (i.e. DNS lookups were failing). This applies to Linux, I've not checked the Windows situation (there are other things that might not work such as keycodes, so porting isn't very high on my list). ahhh... Connecting to pye-dev-07 failed, but its IP address (192.168.1.22) was OK. Qualifying the name manually so that it read pye-dev-07.telemetry.co.uk worked, but trying to get the domain name using GetDomainName didn't. now /that/ is much better for understanding the problem... in the above, pye-dev-07 is the host name so the DNS server(s) you were querying needed to know that this was a local LAN host OR you needed to provide the FQDN... The unix /etc/resolv.conf file (normally on each client) has a line for search paths, which are suffixes to be applied to a name if it doesn't immediately match. The libc lookup implementation, wrapped in cnetdb, uses this, while resolve.pas doesn't. The file can also specify a domain although this is rarely used, it might be that this is what GetDomainName refers to. AHHH... so *that's* what you meant about "resolv.conf not being fully parsed"... ok... yes, this is similar to what i mention above about domain suffixes to add and try looking up... I've ended up using a hybrid approach: first well-known names such as localhost and lo, then THostResolver, then cnetdb, with the possible fallback of parsing resolv.conf for cases where libc isn't available. If I look at porting to Windows I'll probably have to consult the registry in lieu of resolv.conf. not sure about that on windows... i just did a search in this w2k box... because it is different than my previous w98 box... the hosts file is found in %systemdir%/drivers/etc where on w98 it was found in %systemdir%... there is no resolv* found anywhere in my OS base directory... i also have this machine configured for pseudo-static IP assignment via DHCP so all address, gateway and DNS settings come from my DHCP server which just happens to be my main firewall box... that box is specifically configured to set a DNS suffix of my internal LAN domain TLD for all lookups with one or less dots in the name ie: foo and foo. both return the same IP... foo. returns just the name as given with the IP and foo (without the dot) returns the name with the domain suffix added and the same IP as foo. returns... [quote] Microsoft Windows 2000 [Version 5.00.2195] (C) Copyright 1985-2000 Microsoft Corp. C:\Documents and Settings\user>nslookup darkstar Server: perseus Address: 192.168.42.1 Name:darkstar.wpusa Address: 192.168.42.22 C:\Documents and Settings\user>nslookup darkstar. Server: perseus Address: 192.168.42.1 Name:darkstar Address: 192.168.42.22 [/quote] i get the same output on my *nix boxen, as well... does this make sense and/
Re: [fpc-pascal] Resolving a local hostnames to an IP address
On 4/13/2012 04:54, Mark Morgan Lloyd wrote: If I use THostResolver.NameLookup I find that it can convert a fully-qualified name but not one where the domain is omitted, can you explain this a bit more, please? the reason i ask is because some code wants at least one dot separator... example: foo.bar -- .bar is the TLD and foo is the hostname foo.bar. -- the last dot says this is the end, do not look to other domains so... foo -- may result in other domains being automatically looked up by stuffing known TLDs after it ie: foo.com, foo.net, foo.org... *BUT* foo. -- says there is no more domains to look at... so effectively one is looking for only the LAN name which should be easily served up by the LAN DNS server or the HOSTS file... some systems need the trailing dot and others do not... i've seen this problem for years and it seems to be limited to some OS' to a certain extent... I notice that the README specifically says that resolv.conf isn't fully parsed. in the above, i'm speaking purely from a network admin/tech/specialist POV... i work with a FOS firewall product and this is quite a common problem IF what i'm thinking it is is correct... sadly i've not (yet!) the coding knowledge in this area to be able to be more specific or of more help :? the main point is that many do not know about the use of the trailing dot to denote that there are no other domains to append in an attempt to locate the given hostname... clarification: foo.bar -- foo is the hostname, bar is the TLD... foo.bar.com -- foo is the hostname, bar is a SLD, and com is a TLD... foo.-- says look up "foo" only... foo.bar -- says look up "foo.bar" first and maybe other TLDs behind... foo.bar.-- says look up "foo.bar" and don't look up more than that... i hope this makes sense and is of some assistance... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Is there a function that returns UTC time in FPC or Lazarus?
On 3/30/2012 15:31, Reinier Olislagers wrote: On 30-3-2012 16:05, Frank Church wrote: When I get the time via the DateTime function result is adapted for the timezone, making it an hour ahead now? Is there a function that returns the UTC time, either as a UnixTime or TDateTime irregardless of timezone? Frank, You could search the fpc and lazarus mailing list; I know there've been posts regarding this. IIRC, the conclusion was that doing this is potentially very difficult to do cross platform, keeping daylight saving changes etc in mind. agreed... even in the TP/BP6/7 days... it depends on the setting of the local clock as to whether you to daylight saving display or not... i know of many that operate on UTC and do not do local time when viewing... it can be done but it is going to be a "trick" ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SysUtils.GetEnvironmentVariable
On 3/29/2012 21:26, Marcos Douglas wrote: Thanks for the test. We have a little difference: my FPC is 2.6.1 (svn /fixes_2_6). The env variable was added before I start the application, always. and this is from command line (cmd.exe, command.exe or *shell) ?? or in the user or system environment? i'm just trying to keep up ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Spam
On 3/11/2012 08:08, Jürgen Hestermann wrote: Jonas Maebe schrieb: Sorry about this spam message. This person simply subscribed to the list and then sent the message. I've now changed the list options so that new members are moderated by default. This may result in some new members' first real posts to be accidentally discarded along with the spam that's held for moderator approval, but I don't know of another way to defend against this sort of abuse. Please don't overmoderate everything! It is so simple for me to delete some spam messages. They cannot be avoided anyway. ummm... speaking as one who has fought the spammers and won their mailbox back from them, this is much bovine fecal material... i have fought "them" from +1000/day spams back to less than ~5/day... it is very possible but one nes to stay vigilant and report the spams to those who can actually do something about it... Filtering spam does not work perfectly. Trying to find every spam (well, what's spam at all?) will also delete some interesting (and sometimes even important) message too. this is the main reason why one /must/ visit their spambox and unspam those legitimate messages that may be in there... this is not something to be taken lightly... sadly, until the spammers and advertisers are eliminated from the 'net (which will never happen :(, one must understand and verify much of that which they "see" coming in from the 'net... speaking as a security researcher, this is also an ongoing job that everyone really should also learn, understand and deal with properly ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPCDocs: diff: saving fpdoc gives huge diff
On 2/8/2012 18:56, Mattias Gaertner wrote: On Wed, 8 Feb 2012 16:03:05 +0100 Mattias Gaertner wrote: [...] Of course it would be nicer if the used xml readers/writers can be told to keep the spaces. Especially for version control systems. I will take a look. The xml reader/writer used by the fpdoc editor now preserve the attribute order and have options to preserve white spacing. This means the fpdoc editor now only changes the edited element and keeps the rest. excellent! :) There are still some whitespace issues about the edited element. there's always something to do, eh? ;) ___ 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 satsort32.lpr
[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] FormatDatetime is not respecting the specified pattern
On 1/31/2012 22:23, Luciano de Souza wrote: Hello listers, A strange error came up when formating a date. See this code: writeln(formatdatetime('dd/mm/', now)); The answer should be: 31/01/2012 The answer was: 31-01-2012 I did one test else: writeln(formatdatetime('dd$mm$', now)); The answer was: 31$01$2012 Yes, the problem seems to be related to the backslash. errrm1... that's not a 'back slash'... that's a "forward" slash.. aka just a plain slash... "back slash" leans backwards (ie: top to the left)... DefaultFormatSettings.DateSeparator := '/'; writeln(formatdatetime('dd/mm/', now)); The answer was: 31/01/2012 Right! That's the answer. But it was necessary to setup the settings manually. The test was done with Freepascal 2.4.4 errrm2: FP 2.6.0 is the current release... unless i'm highly mistaken... but still, see higher above ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] libQT4Pas - Why it is needed?
On 1/30/2012 03:26, zeljko wrote: On Monday 30 of January 2012 08:35:23 waldo kitty wrote: > i may have easily misunderstood the OP's post... i tend to read in literan > english format... ie: if you say eggs are round, that is where i base my > response unless it is very obvious that there is something else to consider > which i point out ; I think that this question was pretty clear: "Do other languages like python use the plain c interface, or C++?" i understood that to mean "when interfacing with dlls" or similar :? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] libQT4Pas - Why it is needed?
On 1/30/2012 01:55, zeljko wrote: On Monday 30 of January 2012 03:28:45 waldo kitty wrote: > On 1/29/2012 17:38, Lars wrote: > > Do other languages like python use the plain c interface, or C++? > > > > how about something like ruby, lua, objective C, php .. > : > :( i don't nderstand why one would want to apply interpreted script > :languages, I've understand that he asks how python bindings works then ? i may have easily misunderstood the OP's post... i tend to read in literan english format... ie: if you say eggs are round, that is where i base my response unless it is very obvious that there is something else to consider which i point out ; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] I found FPC v0.2 source code :-)
On 1/29/2012 17:41, Lars wrote: Anything that has Capacitors in it which use wet electrolytic, can dry out with age. Old stereos that crackle when you turn up the volume are an example. In motherboards though it seems it's more a problem that capacitors blow up and bulge out which is probably from usage rather than idle age. speaking as a hardware man, these components are easily replaced... in many cases, if the board's traces are damaged, they, too, can be repaired... i am still replacing capacitors on boards from that old problem where capacitors were purchased from manufacturers that fell to the capacitor espionage situation of some, what?, 15 years ago? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] libQT4Pas - Why it is needed?
On 1/29/2012 17:38, Lars wrote: Do other languages like python use the plain c interface, or C++? how about something like ruby, lua, objective C, php .. :( i don't nderstand why one would want to apply interpreted script languages, al la BASIC, to today's tasks... sure, these are neat and "more modern" but they are still interpreted scripting languages :( Krzysztof wrote: Just as I thought - it is object class thing. So if "FPC does not (fully) support directly calling external C++ libraries" there are plans to support it? This will be great 2012/1/29 Michael Van Canneyt: On Sun, 29 Jan 2012, Krzysztof wrote: Hi, I am wondering. If I build application for linux using gtk2 widgetset for GNOME (or XFCE etc.) and send this program to my friend, then he can run it without any external librarys (of course if he have gnome too), this same thing on windows. But why when I build application on KDE interface I need some external libQT4Pas to run it and my friend need it too (he have KDE so all QT librarys too)? There is no libGTK4Pas so why exists layer libQT4Pas? What is difference between GTK and QT librarys? GTK has a procedural C interface, it is exposed in the GTK libraries. The FPC compiler understands this interface. Qt is written in C++, and exposes C++ classes in the Qt libraries. The FPC compiler does not know how to handle C++ classes. Therefor, a 'procedural' interface to the C++ needs to be made, and this is libQT4Pas. It is generated by a GCC. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] I found FPC v0.2 source code :-)
On 1/29/2012 16:57, Graeme Geldenhuys wrote: On 29 January 2012 16:21, Mark Morgan Lloyd wrote: My experience is that both media and drives suffer with age, even if not being used. I can imagine that might be for the disk, but not the drive itself. I recently cleaned up my garage and found a crate full of old hardware (boxes and boxes of 5.25" and 3.5" floppies, 2 5.25" floppy drives, 286 motherboard, 1x 84MB HDD, very old software and games etc...). The floppy drives and diskettes still worked. :-) No idea what I must do with all this old stuff though Does anybody collect such stuff? yes... some do... but many of those who do also look to see how obscure such are... i konw of at least two folk who have garages full of old hardware going back as far as the PDP-9 or PDP-11 devices... i even have an old System36 sitting here (holding up the other end of my main "work bench" that came with an 8inch drive which still works and appears to be properly calibrated... sadly, though [!], i don't have the 220V connection capability to fire it up and place a brownout on the neighborhood for the 5 minutes it takes it to come up to speed :P @Florian Definitely try to preserve such old software releases. If you can, you should upload it to SourceForge. +1+ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] I found FPC v0.2 source code :-)
On 1/29/2012 09:21, Mark Morgan Lloyd wrote: Florian Klämpfl wrote: Am 29.01.2012 11:55, schrieb Bart: On 1/29/12, Florian Klämpfl wrote: I've still backups back to 0.1 on 5 1/4 floppies somewhere :) Though I've no idea if they still work :) ___ But do you have a machine to read them? I've still a 5 1/4 floppy lying around, afaik it should still work with current MBs. My experience is that both media and drives suffer with age, even if not being used. while this is true, i /still/ have some full height 5.25 inch drives that take manual adjustment for being able to read the floppies placed in them... and yes, i still have the cat's eye disks used to calibrate them with an o'scope... i can't say this about those half-height 5.25inch devices that i still retain... many of those were not adjustable :? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] I found FPC v0.2 source code :-)
On 1/29/2012 06:19, ik wrote: On Sun, Jan 29, 2012 at 13:15, Florian Klämpfl mailto:flor...@freepascal.org>> wrote: Am 29.01.2012 11:55, schrieb Bart: > On 1/29/12, Florian Klämpfl mailto:flor...@freepascal.org>> wrote: >> I've still backups back to 0.1 on 5 1/4 floppies somewhere :) Though >> I've no idea if they still work :) >> ___ > > But do you have a machine to read them? I've still a 5 1/4 floppy lying around, afaik it should still work with current MBs. You should upload to ftp's and places such as sourceforge. It's a museum display :) while i tend to agree... i'm still servicing some of these that are processing upwards of .5mil+ USD a year... to some they are simply "museum pieces" while to others, they are "life blood" ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] I found FPC v0.2 source code :-)
On 1/29/2012 05:55, Bart wrote: On 1/29/12, Florian Klämpfl wrote: I've still backups back to 0.1 on 5 1/4 floppies somewhere :) Though I've no idea if they still work :) ___ But do you have a machine to read them? if florian doesn't, i do ;) i specifically keep older machines around and in working order specifically to try to support those older machines and installations for the software that i work with... yes, even those old dBIII and dBIV installations which are still active ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] understanding heaptrc and collection init()
i'm trying to understand what heaptrc is telling me... i have two collections that are set up, filled, used and disposed of... at the end of the program run, heaptrc pops up and tells me how much memory was allocated... here's the definitions... Tcat_nbr = pstring; Tsat_name = pstring; Tline_data = pstring; PSCRec = ^TSCRec; TSCRec = object(TObject) catnbr : Tcat_nbr; satname : Tsat_name; inorbit : boolean; constructor Init(cnbr,sname:string; iorbit:boolean); destructor Done; virtual; end; PTLERec= ^TTLERec; TTLERec= object(TObject) satname : Tsat_name; satdata1 : Tline_data; satdata2 : Tline_data; catnbr : Tcat_nbr; epoch: double; constructor Init(sname,sdata1,sdata2,cnbr:string; edate:double); destructor Done; virtual; end; PSCColl= ^TSCColl; TSCColl= object(TSortedCollection) Function Compare(Key1,Key2:Pointer):sw_integer; virtual; Function KeyOf(Item:Pointer):Pointer; virtual; Procedure Insert (Item:Pointer); virtual; end; PTLEColl = ^TTLEColl; TTLEColl = object(TSortedCollection) Function Compare(Key1,Key2:Pointer):sw_integer; virtual; Function KeyOf(Item:Pointer):Pointer; virtual; Procedure Insert (Item:Pointer); virtual; end; here's the initialization of the collections... aSatCatColl := New(PSCColl, Init(8192,64)); aTLEColl := New(PTLEColl, Init(8192,64)); with these above init() numbers, heaptrc tells me the following... Heap dump by heaptrc unit 708179 memory blocks allocated : 2251/24646144 708179 memory blocks freed : 2251/24646144 0 unfreed memory blocks : 0 True heap size : 4521984 (96 used in System startup) True free heap : 4521888 but if i reduce those init() values, aSatCatColl := New(PSCColl, Init(1,1)); aTLEColl := New(PTLEColl, Init(1,1)); heaptrc tells me this... Heap dump by heaptrc unit 735511 memory blocks allocated : 803685377/805873208 735511 memory blocks freed : 803685377/805873208 0 unfreed memory blocks : 0 True heap size : 4521984 (96 used in System startup) True free heap : 4521888 so what i'm not understanding is this... if i allocate one unit at a time for each item in the collection, why does it consume 80megs of space whereas allocating 8192 units to start and then 64 units at a time only uses ~22megs of space? and to continue with that, if i allocate 16384 to start with and then 64 at a time, we're looking at this... Heap dump by heaptrc unit 708008 memory blocks allocated : 14619829/16752640 708008 memory blocks freed : 14619829/16752640 0 unfreed memory blocks : 0 True heap size : 4521984 (96 used in System startup) True free heap : 4521888 which is down to ~14Meg of memory usage... in the above tests, the satcat collection loaded 16612 items and the TLE collection loaded 10897 items... everything was identical in all three tests... i'm trying to keep my memory usage as low as possible without wasting too much by allocating for X number of possible items and only having Y items instead... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] convert "epoch" to UTC
On 1/16/2012 14:49, Sven Barth wrote: On 16.01.2012 20:06, waldo kitty wrote: with this TLE epoch number, 12013.93338171, ya feed it like so... var JEpoch : double; DT : TDateTime; [...] JEpoch := getJulianDay_SatEpoch(12,013.93338171); [...] if TryJulianDateToDateTime(JEpoch,DT) then writeln(FormatDateTime(' MM DD hh:mm:ss',DT)); the above /should/ return 2012 01 14 22:24:04... i'm getting the right dates back but all of the times are 00:00:00 :( do JulianDateToDateTime and TryJulianDateToDateTime not do anything with hours, minutes, seconds and milliseconds?? A quick look at the code reveiled that it doesn't handle it. i kinda figured that... however, here's a nice li'l :TripleFacePalm: for ya... i tried to describe the format of the TLE Epoch number in an earlier post but i guess i pretty much failed... at least insofar as what the actual format is... here's what i posted previously... [quote] >> i'm needing to convert a "UTC epoch" date to a "standard time string"... by >> that, i mean that i want to get something like "2011-01-13 22:24:04" out of >> the "epoch" number 12013.9338171... >> >> the above "epoch" number is (supposedly) built like this... >> >> 12 == 2012 >> 013 == 13th day of the year >> .9338171 * 24 == 22.4116104 hours >> .4114104 * 60 == 24.696624 minutes [/quote] yes, that's the one where i dropped a '3' in the fractional part ;) anyway, the format is like this... *_TLE Epoch Format_* eg: 12013.93338171 1. there are always 5 digits to the left of the decimal. the first two digits are the year of the epoch. if year<57 then year:=year+2000 else year:=year+1900 in the above, 12 is the year which is 2012. 2. the next three digits (up to the decimal point) are the "day number of the year" of the TLE Epoch record. in the above, 013 is the day number of the year. feed this plus the year to a julian date routine to find the julian date number. in this example, we're looking for the julian date number for the 13th day of 2012. 3. the digits from the decimal point to the end are the fractional part of the day. these are /not/ in julian date or julian day format. in the above, .93338171 is the fractional part of the day. the time portion of the formula goes like this. fooo := frac(12013.93338171) rslt := fooo * 24// 22.40116104 hour := trunc(rslt) // 22 fooo := frac(rslt) // .40116104 rslt := fooo * 60// 24.0696624 mins := trunc(rslt) // 24 fooo := frac(rslt) // .0696624 rslt := fooo * 60// 4.179744 secs := trunc(rslt) // 4 fooo := frac(rslt) // .179744 rslt := fooo * 1000 // the more zeros, the more precision msec := trunc(rslt) // 179 4. convert the julian date number from #2 to TDateTime. fill in the TDateTime time fields from #3. now EncodeDateTime and you'll have the proper numbers in a TDateTime record. so what i ran into, besides the julian date routines not doing the time, but i was also sending the entire decimal number, without the year digits, to the julian date routine and that was just flat wrong since the fractional side wasn't a julian date fraction! ::TripleFacePalm:: so there's three pieces of data stored in that one "TLE Epoch" number and each has to be broken out and treated differently... now my answers finally agree with the programs i've been attempting to verify them against... i just couldn't see the forest for the trees and couldn't see the trees for all the leaves on'em :LOL: ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] convert "epoch" to UTC
On 1/16/2012 13:38, Mark Morgan Lloyd wrote: waldo kitty wrote: i think i might be able to do something with the JulianToDateTime once i get the base year portion converted to a true julian... i spotted some C# code while doing a bit of research earlier (see below)... it appears to convert the year to a julian year and then add the decimal day portion... this should then be a proper julian date which i should be able to handle ;) Don't know whether any of this will help that actually looks very similar to some of my old TP/BP 6/7 time libraries that i created because there was not much available out there when i needed it... the one part that hit me the most was that the fractional days stuff is lost and that's one part of what i'm looking for... however, i think i do have a method to pull it out... maybe i can make it generic enough for use elsewhere where decimal julian dates are used... i'm still coding it in my head and will be putting fingers to keyboard in just a bit to actually put it into operation ;) thanks for the input! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] convert "epoch" to UTC
On 1/16/2012 12:54, Ralf A. Quint wrote: At 09:40 AM 1/16/2012, Sven Barth wrote: Well... I would say the same as FPC's "floor" routine ( http://www.freepascal.org/docs-html/rtl/math/floor.html ) does ;) Well... someone might want to check the example for that function ;) +1 especially since the example is for ceil ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] convert "epoch" to UTC
On 1/16/2012 12:40, Sven Barth wrote: On 16.01.2012 17:57, waldo kitty wrote: [TRIM] looks like it should be easy to convert to pascal, too ;) just gotta find out what that "floor" routine does ;) Well... I would say the same as FPC's "floor" routine ( http://www.freepascal.org/docs-html/rtl/math/floor.html ) does ;) hehe, exactly... and it was easy to convert, too... function getJulianDay_Year(year:integer) : double; var dYear, a,b, dResult : double; begin dYear := year - 1; A := Floor(dYear / 100); B := 2 - A + Math.Floor(A / 4); //The use of 30.601 is to correct for floating point rounding problems dResult := Floor(365.25 * dYear) + 1721422.9 + B; getJulianDay_Year := dResult; end; function getJulianDay_SatEpoch(year:integer; dSatelliteEpoch:double) : double; var dResult : double; begin //Tidy up the year and put it into the correct century year := year mod 100; if (year < 57) then year := year + 2000 else year := year + 1900; dResult := getJulianDay_Year(year); dResult := dResult + dSatelliteEpoch; getJulianDay_SatEpoch := dResult; end; with this TLE epoch number, 12013.93338171, ya feed it like so... var JEpoch : double; DT : TDateTime; [...] JEpoch := getJulianDay_SatEpoch(12,013.93338171); [...] if TryJulianDateToDateTime(JEpoch,DT) then writeln(FormatDateTime(' MM DD hh:mm:ss',DT)); the above /should/ return 2012 01 14 22:24:04... i'm getting the right dates back but all of the times are 00:00:00 :( do JulianDateToDateTime and TryJulianDateToDateTime not do anything with hours, minutes, seconds and milliseconds?? i'd give TryModifiedJulianDateToDateTime a try but the docs state that just trying to use that routine raises an exception... is it going to handle the hors, minutes, seconds, and milliseconds when it gets done or is it for some other julian date format?? [ aside: where/how does one report documentation errors? PadLeft says to see also PadLeft instead of PadRight ;) ] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: convert "epoch" to UTC
On 1/16/2012 10:00, Jeff Wormsley wrote: I went here: http://www.satellite-calculations.com/TLETracker/SatTracker.htm funny thing, that! when i woke up this morning and went researching, that was the first site that uncle google showed me, too :lol: It had the TLE for Galaxy 15 as follows: GALAXY 15 1 28884U 05041A 10133.62484064 .0085 0-0 1-3 0 8291 2 28884 000.1391 078.0756 0002640 331.8937 274.1784 01.00285599 16790 i pasted in my ISS TLE and got the result i had been looking for in my example string... that told me that /I/ had goofed something... turns out that i had dropped a '3' in the decimal julian day portion of the number... there should have been three 3s together... it made all the difference, too ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] convert "epoch" to UTC (waldo kitty)
On 1/16/2012 09:44, edgar jordan wrote: 12 == 2012 013 == 13th day of the year .9338171 * 24 == 22.4116104 hours i typoed the above... it should be .93338171 * 24 == 22.40116104 hours .4114104 * 60 == 24.696624 minutes so this becomes .40116104 * 60 == 24.0696624 minutes which then leads to .0696624 * 60 == 4.179744 seconds The decimal portion of hours doesn't match the one multiplied by 60. I just thought it's the one causing the discrepancy. ahhh... it took me a minute to find that errant '4' in there :lol: yeah, that could cause the problem but in this case, i dropped a '3' much earlier :/ so, i'm on the right track... just gotta use the right numbers... now to find the right formula ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] convert "epoch" to UTC
On 1/16/2012 06:22, Sven Barth wrote: Am 16.01.2012 04:10 schrieb "waldo kitty" > > > i'm needing to convert a "UTC epoch" date to a "standard time string"... by > that, i mean that i want to get something like "2011-01-13 22:24:04" out of > the "epoch" number 12013.9338171... TYPO ALERT! that should be .93338171... with the additional '3' in there, the final value for the seconds is 4... long day, tired eyes and dirty glasses :/ [TRIM] > so, my question is this... is there an existing FPC routine that will convert > this (or a part of this) properly or do i need to play with something to get > it right? it is obvious that this is not a "unix epoch"... i'm not sure how > "normal" julian date epochs are represented... > > i've looked through the docs on freepascal.org <http://freepascal.org> but > none of them show an number with which to compare... there's no links pointing > to a definition or example of a julian date or unix date or any such... I don't know whether your format is really a Julian or Unix time (for Julian it looks too low), it is actually one of the "julian" ones... it is the "julian day of year" format... at least that's what i believe it is called... but can take a look at unit "DateUtils" of which the documentation is here: http://www.freepascal.org/docs-html/rtl/dateutils/index-5.html yes, i had been all in there... that's where i was expecting to see an example that actually contained a number that would be converted to a date so that one might work out the math manually if desired... without a number, i had nothing to compare what i have with to see if it was even close... Especially you can try JulianToDateTime and UnixToDateTime. Both return a TDateTime which you can convert to a string using FormatDateTime ( http://www.freepascal.org/docs-html/rtl/sysutils/datetimetostring.html ) or DateTimeToStr ( http://www.freepascal.org/docs-html/rtl/sysutils/datetimetostr.html ). i think i might be able to do something with the JulianToDateTime once i get the base year portion converted to a true julian... i spotted some C# code while doing a bit of research earlier (see below)... it appears to convert the year to a julian year and then add the decimal day portion... this should then be a proper julian date which i should be able to handle ;) [ WARNING: C# code follows ] double getJulianDay_Year(int year) { double dYear = year - 1; double A = Math.Floor(dYear / 100); double B = 2 - A + Math.Floor(A / 4); //The use of 30.601 is to correct for floating point rounding problems double dResult = Math.Floor(365.25 * dYear) + 1721422.9 + B; return dResult; } double getJulianDay_SatEpoch(int year, double dSatelliteEpoch) { //Tidy up the year and put it into the correct century year = year % 100; if (year < 57) year += 2000; else year += 1900; double dResult = getJulianDay_Year(year); dResult += dSatelliteEpoch; return dResult; } [ end of C# code ] looks like it should be easy to convert to pascal, too ;) just gotta find out what that "floor" routine does ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing FPC 2.6.0 on OS/2
On 1/15/2012 18:41, Tomas Hajny wrote: On Sun, January 15, 2012 23:43, waldo kitty wrote: Thanks for letting me know about it. I suggest that you file a standard bug report (not that I expect anyone else to fix it if the problem is restricted to the OS/2 version, but it becomes visible for other users who may come across the problem too this way at least). you are welcome... i will /try/ to do a bug report but i'm not sure where... i've done a few reports on these automated systems but, ha!, they still tend to confound me at times :P http://bugs.freepascal.org if we're lucky, it would be this one http://bugs.freepascal.org/view.php?id=21100 i say lucky because i had to dance some rough hoops to get logged in... that was ugly because i already have/had an account on the wiki where i'd made some edits in the past few years... dunno what weird things were going on but it was not a pretty dance to dance :/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] convert "epoch" to UTC
i'm needing to convert a "UTC epoch" date to a "standard time string"... by that, i mean that i want to get something like "2011-01-13 22:24:04" out of the "epoch" number 12013.9338171... the above "epoch" number is (supposedly) built like this... 12 == 2012 013 == 13th day of the year .9338171 * 24 == 22.4116104 hours .4114104 * 60 == 24.696624 minutes and here's where it breaks on me because .696624 * 60 == 41.79744 seconds and that doesn't match the above time string showing 04 seconds... that time string was built from this "epoch" number (by another program) and i assume that it followed this published formula for this format (which is for satellite TLEs)... so, my question is this... is there an existing FPC routine that will convert this (or a part of this) properly or do i need to play with something to get it right? it is obvious that this is not a "unix epoch"... i'm not sure how "normal" julian date epochs are represented... i've looked through the docs on freepascal.org but none of them show an number with which to compare... there's no links pointing to a definition or example of a julian date or unix date or any such... help! please :/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing FPC 2.6.0 on OS/2
On 1/15/2012 17:17, Tomas Hajny wrote: On 15 Jan 12, at 13:31, waldo kitty wrote: On 1/14/2012 16:49, Tomas Hajny wrote: Any difference between link.res file created in the two cases? yes... the first thing i note is the fp link.res includes the .\ directory and the fpc one does not... indicated with a 1 below... I don't know why they are different, but this probably shouldn't be a problem. i didn't think so, either... i mean, it would seem that fpc looks in the current directory already... as such, it doesn't list the .\ directory in its list... fp seems to need this additional assistance, maybe? ;) the second thing i note is the fp link.res messes up the directory we're working in for the program.o file being compiled whereas the fpc one doesn't say the directory but only the program.o... indicated with a 2 below... . 2 h:\fpc\projects\satellite\h:\fpc\projects\satellite\satsort.o . This obviously is the problem - the linker cannot find the object file this way. :-((( I can reproduce it, i suspected that was the problem once i knew where to look... i'm glad you could reproduce it, too ;) but finding time for debugging it and fixing it will probably take some time (mostly due to time constraints on my side :-( ). i know how that is... i'm the maintainer of an add-on package for a popular firewall product and i haven't much time to work on that, recently, either :/ Fortunately, the workaround of using the command line compiler works well so this shouldn't be a show-stopper (although it certainly isn't pleasant :-( ). yeah, 'about that :LOL: ah'ma gunna haf tah look at sumptin' tah see how tah tell fpc what ah wan' it tah do... like ah have set up in fp when compiling with the different modes :LOL last time i did that was with TP/BP 6&7 and that was a looong time ago ;) Thanks for letting me know about it. I suggest that you file a standard bug report (not that I expect anyone else to fix it if the problem is restricted to the OS/2 version, but it becomes visible for other users who may come across the problem too this way at least). you are welcome... i will /try/ to do a bug report but i'm not sure where... i've done a few reports on these automated systems but, ha!, they still tend to confound me at times :P /me adds "make a bug report" to the LOTTD (List Of Things To Do) and waddles off to try to figure out how to add an internal svn server to his small herd of boxen... :byebye: ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing FPC 2.6.0 on OS/2
On 1/14/2012 16:49, Tomas Hajny wrote: Is there any difference between ppas.cmd created by fp.exe and fpc.exe if you add option -s to compilation from both? i can't find a ppas.cmd when i use "fp -s" and hit F9 or ALT-F9 to compile... it still fails with an error linking... i am allowing the dsk file to load the files i had open... here's the ppas.cmd from "fpc -s" though... [ fpc-ppas.cmd ] @echo off SET THEFILE=satsort echo Assembling %THEFILE% "h:\fp\2.6.0\bin\os2\as.exe" -o satsort.o satsort.s if errorlevel 1 goto asmend Del satsort.s SET THEFILE=satsort.exe echo Linking %THEFILE% "h:\fp\2.6.0\bin\os2\ld.exe" -o satsort.out @link.res if errorlevel 1 goto linkend "h:\fp\2.6.0\bin\os2\emxbind.exe" -b -s -w -k256 -h1 -o satsort.exe satsort.out -ai -s8 if errorlevel 1 goto linkend del satsort.out if errorlevel 1 goto linkend goto end :asmend echo An error occured while assembling %THEFILE% goto end :linkend echo An error occured while linking %THEFILE% :end [ end ] Any difference between link.res file created in the two cases? yes... the first thing i note is the fp link.res includes the .\ directory and the fpc one does not... indicated with a 1 below... the second thing i note is the fp link.res messes up the directory we're working in for the program.o file being compiled whereas the fpc one doesn't say the directory but only the program.o... indicated with a 2 below... [ fp-link.res ] 1 -L.\ -LH:\FP\2.6.0\UNITS\OS2\RTL\ -LH:\FP\2.6.0\UNITS\OS2\zlib\ -LH:\FP\2.6.0\UNITS\OS2\x11\ -LH:\FP\2.6.0\UNITS\OS2\unzip\ -LH:\FP\2.6.0\UNITS\OS2\tcl\ -LH:\FP\2.6.0\UNITS\OS2\symbolic\ -LH:\FP\2.6.0\UNITS\OS2\rexx\ -LH:\FP\2.6.0\UNITS\OS2\regexpr\ -LH:\FP\2.6.0\UNITS\OS2\paszlib\ -LH:\FP\2.6.0\UNITS\OS2\pasjpeg\ -LH:\FP\2.6.0\UNITS\OS2\os2units\ -LH:\FP\2.6.0\UNITS\OS2\libpng\ -LH:\FP\2.6.0\UNITS\OS2\libgd\ -LH:\FP\2.6.0\UNITS\OS2\lexyacc\ -LH:\FP\2.6.0\UNITS\OS2\imlib\ -LH:\FP\2.6.0\UNITS\OS2\hermes\ -LH:\FP\2.6.0\UNITS\OS2\hash\ -LH:\FP\2.6.0\UNITS\OS2\gtk1\ -LH:\FP\2.6.0\UNITS\OS2\fv\ -LH:\FP\2.6.0\UNITS\OS2\fppkg\ -LH:\FP\2.6.0\UNITS\OS2\fpmkunit\ -LH:\FP\2.6.0\UNITS\OS2\fpgtk\ -LH:\FP\2.6.0\UNITS\OS2\fcl-xml\ -LH:\FP\2.6.0\UNITS\OS2\fcl-res\ -LH:\FP\2.6.0\UNITS\OS2\fcl-registry\ -LH:\FP\2.6.0\UNITS\OS2\fcl-process\ -LH:\FP\2.6.0\UNITS\OS2\fcl-passrc\ -LH:\FP\2.6.0\UNITS\OS2\fcl-net\ -LH:\FP\2.6.0\UNITS\OS2\fcl-json\ -LH:\FP\2.6.0\UNITS\OS2\fcl-js\ -LH:\FP\2.6.0\UNITS\OS2\fcl-image\ -LH:\FP\2.6.0\UNITS\OS2\fcl-fpcunit\ -LH:\FP\2.6.0\UNITS\OS2\fcl-db\ -LH:\FP\2.6.0\UNITS\OS2\fcl-base\ -LH:\FP\2.6.0\UNITS\OS2\chm\ -LH:\FP\2.6.0\UNITS\OS2\bzip2\ -LH:\FP\2.6.0\UNITS\OS2\ -LH:\FP\2.6.0\BIN\OS2\ H:\FP\2.6.0\UNITS\OS2\RTL\prt0.o 2 h:\fpc\projects\satellite\h:\fpc\projects\satellite\satsort.o H:\FP\2.6.0\UNITS\OS2\RTL\system.o H:\FP\2.6.0\UNITS\OS2\RTL\heaptrc.o H:\FP\2.6.0\UNITS\OS2\RTL\sysutils.o H:\FP\2.6.0\UNITS\OS2\RTL\strutils.o H:\FP\2.6.0\UNITS\OS2\RTL\objects.o H:\FP\2.6.0\UNITS\OS2\RTL\math.o H:\FP\2.6.0\UNITS\OS2\RTL\crt.o H:\FP\2.6.0\UNITS\OS2\RTL\dos.o H:\FP\2.6.0\UNITS\OS2\RTL\objpas.o H:\FP\2.6.0\UNITS\OS2\RTL\sysconst.o H:\FP\2.6.0\UNITS\OS2\RTL\doscalls.o H:\FP\2.6.0\UNITS\OS2\RTL\strings.o H:\FP\2.6.0\UNITS\OS2\RTL\system.a H:\FP\2.6.0\UNITS\OS2\RTL\crt.a H:\FP\2.6.0\UNITS\OS2\RTL\doscalls.a [ fp-link.res ends ] [ fpc-link.res ] -LH:\FP\2.6.0\UNITS\OS2\RTL\ -LH:\FP\2.6.0\UNITS\OS2\zlib\ -LH:\FP\2.6.0\UNITS\OS2\x11\ -LH:\FP\2.6.0\UNITS\OS2\unzip\ -LH:\FP\2.6.0\UNITS\OS2\tcl\ -LH:\FP\2.6.0\UNITS\OS2\symbolic\ -LH:\FP\2.6.0\UNITS\OS2\rexx\ -LH:\FP\2.6.0\UNITS\OS2\regexpr\ -LH:\FP\2.6.0\UNITS\OS2\paszlib\ -LH:\FP\2.6.0\UNITS\OS2\pasjpeg\ -LH:\FP\2.6.0\UNITS\OS2\os2units\ -LH:\FP\2.6.0\UNITS\OS2\libpng\ -LH:\FP\2.6.0\UNITS\OS2\libgd\ -LH:\FP\2.6.0\UNITS\OS2\lexyacc\ -LH:\FP\2.6.0\UNITS\OS2\imlib\ -LH:\FP\2.6.0\UNITS\OS2\hermes\ -LH:\FP\2.6.0\UNITS\OS2\hash\ -LH:\FP\2.6.0\UNITS\OS2\gtk1\ -LH:\FP\2.6.0\UNITS\OS2\fv\ -LH:\FP\2.6.0\UNITS\OS2\fppkg\ -LH:\FP\2.6.0\UNITS\OS2\fpmkunit\ -LH:\FP\2.6.0\UNITS\OS2\fpgtk\ -LH:\FP\2.6.0\UNITS\OS2\fcl-xml\ -LH:\FP\2.6.0\UNITS\OS2\fcl-res\ -LH:\FP\2.6.0\UNITS\OS2\fcl-registry\ -LH:\FP\2.6.0\UNITS\OS2\fcl-process\ -LH:\FP\2.6.0\UNITS\OS2\fcl-passrc\ -LH:\FP\2.6.0\UNITS\OS2\fcl-net\ -LH:\FP\2.6.0\UNITS\OS2\fcl-json\ -LH:\FP\2.6.0\UNITS\OS2\fcl-js\ -LH:\FP\2.6.0\UNITS\OS2\fcl-image\ -LH:\FP\2.6.0\UNITS\OS2\fcl-fpcunit\ -LH:\FP\2.6.0\UNITS\OS2\fcl-db\ -LH:\FP\2.6.0\UNITS\OS2\fcl-base\ -LH:\FP\2.6.0\UNITS\OS2\chm\ -LH:\FP\2.6.0\UNITS\OS2\bzip2\ -LH:\FP\2.6.0\UNITS\OS2\ -LH:\FP\2.6.0\BIN\OS2\ H:\FP\2.6.0\UNITS\OS2\RTL\prt0.o 2 satsort.o H:\FP\2.6.0\UNITS\OS2\RTL\system.o H:\FP\2.6.0\UNITS\OS2\RTL\heaptrc.o H:\FP\2.6.0\UNITS\OS2\RTL\sysutils.o H:\FP\2.6.0\UNITS\OS2\RTL\strutils.o H:\FP\2.6.0\UNITS\OS2\RTL\objects.o H:\FP\2
Re: [fpc-pascal] installing FPC 2.6.0 on OS/2
On 1/14/2012 08:06, Tomas Hajny wrote: On 14 Jan 12, at 5:13, waldo kitty wrote: On 1/13/2012 12:24, Tomas Hajny wrote: On Fri, January 13, 2012 16:48, waldo kitty wrote: . . i use 4OS2 and both return the same path... >which as 209 rwx 1 bin 212992 Feb 23 2004 10:43:38 h:\fp\2.6.0\bin\os2\as.exe >which ld 97 rwx 1 bin 98308 Dec 19 1998 18:51:42 h:\fp\2.6.0\bin\os2\ld.exe My memory didn't serve well here, this output clearly comes from some external port of the original implementation of the 'which' tool installed on your machine and I just found that 4OS2 doesn't contain such an internal command contrary to my original belief. That doesn't change anything, it serves the intended purpose anyway. not a problem... >which which 53 rwx 1 bin 54031 Apr 21 2000 12:25:36 X:\o2progs\gnu\tools\which.exe yup, looks like i have (some of?) the gnu tools installed, also... but they are later in the path that this fpc install... fpc is at the head of the path and libpath... Alright, this indeed doesn't suggest anything weird. ok... i've also looked at fp.ini and fpc.cfg and don't find anything related that might be causing this... the only thing i have done with those files, actually, is to replace "2.6.0" with "$FPCVERSION" so that i can easily share (ie: copy) the project directory with other machines... i've initially developed this tool on w2k and then copied that directory over to the OS/2 box... i also have a copy on my vista laptop so i can work on it when i'm at work or otherwise out and about with my laptop ;) Yes, that certainly makes sense. My point was mainly - could it be that you have -FD option specified in fpc.cfg while it is missing in fp.cfg (sorry, not fp.ini) and in effect for the compilation mode selected in the IDE (NORMAL/DEBUG/RELEASE), or that you have this option in both the files but pointing to different directories? ahhh... yes, i have taken great pains to ensure that all three default "stanzas" contain identical paths no matter which "selector" is chosen... i've only got one project that needs an additional path and that's because i've kept a portion of synapse local to it... however, those are only related to finding source files... i do see where i can specify a path for tools in fpc and it is set to the default... with my $FPCVERSION change... none of my fp.cfg files have -FD in them and i don't know that i know where it should appear... but this options hasn't been in the fp.cfg file ever that i know of... have i found another bug? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing FPC 2.6.0 on OS/2
On 1/13/2012 12:24, Tomas Hajny wrote: On Fri, January 13, 2012 16:48, waldo kitty wrote: [time passes] ok, i figured out how to compile with -s and then i ran the ppas.cmd file... it apparently has completed successfully... i do have a bright shiny new exe file... now to figure out what's wrong with the normal way that fp does it as compared to the way fpc is doing it... You may want to check the differences between fp.ini and fpc.cfg. Also, if you have an OS/2 version of the tool 'which' (available e.g. from http://silk.apana.org.au/utils.html or as an internal command within 4OS2 shell if you use that one), you might want to check a possible difference in path returned for 'which as' and 'which ld'. i use 4OS2 and both return the same path... >which as 209 rwx 1 bin 212992 Feb 23 2004 10:43:38 h:\fp\2.6.0\bin\os2\as.exe >which ld 97 rwx 1 bin 98308 Dec 19 1998 18:51:42 h:\fp\2.6.0\bin\os2\ld.exe i've also looked at fp.ini and fpc.cfg and don't find anything related that might be causing this... the only thing i have done with those files, actually, is to replace "2.6.0" with "$FPCVERSION" so that i can easily share (ie: copy) the project directory with other machines... i've initially developed this tool on w2k and then copied that directory over to the OS/2 box... i also have a copy on my vista laptop so i can work on it when i'm at work or otherwise out and about with my laptop ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing FPC 2.6.0 on OS/2
On 1/13/2012 05:40, Tomas Hajny wrote: On Fri, January 13, 2012 11:27, waldo kitty wrote: i've a problem with os2260full... i bit the bullet and wiped my old os2 2.4.0(?? or 2.4.2???) install... now none of my projects compile... they complain about "Error: Can't call the assembler, error -1 switching to external assembling"... in downloaded os2260full.zip, transferred it to the os/2 box, unzipped it into a /tmp directory and then ran the install tool... after an hour or so, i came back and it was complete... then i tried to compile one of my projects and ran into the above error... HELP!! This should be easy to fix (FAQ item, in fact ;-) ). really? i haven't found a FAQ document that covered this... at least nothing that was "in your face" with this specific problem... but maybe i don't know where to look :/ Nevertheless, in order to determine the reason, please do the following: 1) Compile with the -s parameter, run the created ppas.cmd and check the error message displayed when trying to run GNU AS from this command file. compile what? my project? how is that done? i'm only running fp to load my source code and then hitting F9 or ALT-F9 to compile... i don't know how to do it any other way :/ [never mind, see below] 2) Check your PATH and LIBPATH (especially the latter) settings to contain a reference to the DLL directory in your FPC installation. ahhh... now /THIS/ might be the ticket... when the install completed, there was a box on the screen that said to make sure that the PATH and LIBPATH contained the proper text and it specifically said what that text should be... so i dutifully copy'n'pasted it into the editor i had config.sys opened in... saved and closed everything and rebooted... when i looked at it just now, the LIBPATH is set to h:\fp\2.6.0\bin\dll when it should have been set to h:\fp\2.6.0\dll... i had noted this difference when i made the edit because it should have been a simple modification of the existing 2.4.2 entries... [time passes] ok, have fixed the LIBPATH and rebooted... it takes a bit (~5 minutes) for the thing to come back up with all of its services and such ready to go and be at the point of ready for someone to interact with it... OK, so now it gets further... the error now is "Error: Error while linking"... [time passes] ok, i figured out how to compile with -s and then i ran the ppas.cmd file... it apparently has completed successfully... i do have a bright shiny new exe file... now to figure out what's wrong with the normal way that fp does it as compared to the way fpc is doing it... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] installing FPC 2.6.0 on OS/2
i've a problem with os2260full... i bit the bullet and wiped my old os2 2.4.0(?? or 2.4.2???) install... now none of my projects compile... they complain about "Error: Can't call the assembler, error -1 switching to external assembling"... in downloaded os2260full.zip, transferred it to the os/2 box, unzipped it into a /tmp directory and then ran the install tool... after an hour or so, i came back and it was complete... then i tried to compile one of my projects and ran into the above error... HELP!! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/12/2012 17:49, Tomas Hajny wrote: On 12 Jan 12, at 14:11, waldo kitty wrote: . . that's pretty close to what i did (see above) :lol: i might be able to tighten mine up a bit instead of doing the .done and then a dispose... or does that matter? I believe that there isn't a difference from a technical point of view in this case (except for the fact that decoupling the destructor from the deallocation i decoupled the destructor from the deallocation? hummm... no clue... ya got a cluex4 to smack me with, please? :( may be a bit dangerous if you forget about it later a try to do something with the object in between). in this case, that won't happen ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/12/2012 17:49, Tomas Hajny wrote: On 12 Jan 12, at 14:11, waldo kitty wrote: . . that's pretty close to what i did (see above) :lol: i might be able to tighten mine up a bit instead of doing the .done and then a dispose... or does that matter? I believe that there isn't a difference from a technical point of view in this case (except for the fact that decoupling the destructor from the deallocation may be a bit dangerous if you forget about it later a try to do something with the object in between). i'm not quite sure i understand... i kinda konw what you are speaking of, though, because the HINTs and such (i don't know which since i just enabled them) tell me something about a plain "pointer being disposed makes no sense" or some such... when i put the dispose lines back, these reports were emitted by the compiler but heaptrc didn't bitch any more... removing the dispose lines to make the compiler made heaptrc whine and cry... also, i've a problem with os2260full that i'll be changing the subject of this thread for or starting another thread... yes, i bit the bullet and wiped my old os2 2.4.0(?? or 2.4.2???) install and none of my previous projects compile... they complain about "Error: Can't call the assembler, error -1 switching to external assembling"... :/ i've manually removed all the .o and .ppu files that i may have inadvertently transferred when i scp'd everything over to my os2 box but no joy :/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/12/2012 14:11, waldo kitty wrote: but yet i find this in my debug output... 03597 5.04184917406000E+003 . ** inserting record [...] 03597 1.20109577665600E+004 . ** inserting record i was looking at the wrong compare... i had thought i'd be "smart" and use strcomp but it has bit me arse! :lol: function TTLEColl.Compare(key1, key2: pointer): sw_integer; begin if PString(key1)^ = PString(key2)^ then compare := 0 else if PString(key1)^ < PString(key2)^ then compare := -1 else compare := 1; // compare := strcomp(PChar(key1),PChar(key2)); end; i wonder why the difference?? reverting to the original code as above (note the commented out strcomp) and it is working... now, after scrolling thru a side by side diff) there are no dupes at all, YY! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/12/2012 12:42, Tomas Hajny wrote: On Thu, January 12, 2012 17:23, waldo kitty wrote: [TRIM] but the the problem still comes of how do i know if the record was inserted into the list or not? insert doesn't seem to return a true or false on success... i guess this is where it is required(?) to override the insert method? does everyone have to override the insert method if they are in duplicates := FALSE mode? how do they handle the throwing away of the unneeded data?? There are multiple options. You can search before (as suggested by you) and only call Insert if not finding the result, you can override the Insert call as suggested by me, this is what i've done and it works as per my previous message in this thread... however, i have found another problem... the program mostly works.. i mean that if a dupe catnbr with an epoch >= to the existing record is found it is thrown out but when another dupe catnbr is found it, too, is also inserted... this seems to only be happening with entries that have more than one duplicate... it doesn't make sense... i'm suspecting the compare routine to be the problem... epochs are read from the file and converted to a double by this original routine from TSKelso's SGP4-26A source code archive... Function Real_Value(buffer : string; start,length : integer) : double; Takes the segment of {buffer} beginning at {start} and having length {length} and converts it to a double precision real number. Function Real_Value(buffer : string; start,length : integer) : double; var MyResult : integer; answer : double; begin buffer := Copy(buffer,start,length); Convert_Blanks(buffer); if buffer = '' then buffer := '0'; Val(buffer,answer,MyResult); if MyResult = 0 then Real_Value := answer else Real_Value := 0.0; end; {Function Real_Value} but yet i find this in my debug output... 03597 5.04184917406000E+003 . ** inserting record [...] 03597 1.20109577665600E+004 . ** inserting record here's my compare and insert routines... i'm suspecting my use of CompareValue is in error :/ Function CompareReal(num1,num2 : double) : integer; begin CompareReal := CompareValue(num1, num2); end; procedure TTLEColl.Insert (Item: Pointer); var I: Sw_Integer; old: Pointer; foo: integer; begin If NOT Search(KeyOf(Item), I) OR Duplicates Then { Item valid } begin {$IFDEF DEBUG} write(PTLERec(Item)^.catnbr^); write(' '); write(PTLERec(Item)^.epoch); write(' '); write('.'); writeln(' ** inserting record'); {$ENDIF} AtInsert(I, Item); { Insert the item } end else // otherwise begin {$IFDEF DEBUG} write(PTLERec(At(i))^.catnbr^); write(' '); write(PTLERec(At(i))^.epoch); write(' '); write(PTLERec(Item)^.epoch); {$ENDIF} // compare the epochs foo := CompareReal(PTLERec(At(i))^.epoch,PTLERec(Item)^.epoch); case foo of -1 : begin // replace existing record {$IFDEF DEBUG} writeln(' ** replacing record'); {$ENDIF} old := At(i); // save existing pointer first! AtPut(i, Item); // now put in the new record PTLERec(old)^.Done; // time to remove the old data dispose(old); // and finally dispose it end; 0 : begin // we're tossing this one out {$IFDEF DEBUG} writeln(' ** epochs are same'); {$ENDIF} PTLERec(Item)^.Done; // so remove the data first dispose(Item);// and then dispose the item end; 1 : begin // we're tossing this one out {$IFDEF DEBUG} writeln(' ** existing is newer'); {$ENDIF} PTLERec(Item)^.Done; // so remove the data first dispose(Item);// and then dispose the item end; end; {case} end; end; [TRIM] . . yeah, that went over like a lead balloon... i'm digging into the insert method override, instead... just gotta figure out how to access the epoch in the current record and the one in the passed record for the decision making comparison... PROCEDURE TTLECollection.Insert (Item: Pointer); VAR I: Sw_Integer; BEGIN If NOT Search(KeyOf(Item), I) OR Duplicates Then { Item valid } AtInsert(I, Item){ Insert the item } else i
Re: [fpc-pascal] sorting and merging array of records
On 1/12/2012 11:23, waldo kitty wrote: On 1/12/2012 07:20, Tomas Hajny wrote: On Thu, January 12, 2012 03:34, waldo kitty wrote: [TRIM] i'll probably have broken my code by the time you read this... but i'll very likely be attempting to implement the logic in my Input_Satellite_List routine ;) OB-) Possible, but likely resulting in some useless overhead (computing performance-wise) if you still intend to use the method Insert in that case. yeah, that went over like a lead balloon... i'm digging into the insert method override, instead... just gotta figure out how to access the epoch in the current record and the one in the passed record for the decision making comparison... yeah, i know... bad form to reply to my own message but... I GOT IT!! WHOOHOO! finally... procedure TTLEColl.Insert (Item: Pointer); var I: Sw_Integer; old: Pointer; begin If NOT Search(KeyOf(Item), I) OR Duplicates Then { Item valid } AtInsert(I, Item){ Insert the item } else // otherwise // compare the epochs & replace existing record if < item^.epoch if PTLERec(At(i))^.epoch < PTLERec(Item)^.epoch then begin old := At(i); // save existing pointer first! AtPut(i, Item);// now put in the new record PTLERec(old)^.Done;// time to remove the old data dispose(old); // and finally dispose it end else begin// we're tossing this one out PTLERec(Item)^.Done; // so remove the data first dispose(Item); // and then dispose the item end; end; now the list is sorted, newer entries replace older ones and there's no more whining from heaptrc about left over fluff on the heap... yeah! and i said it before but dang this thing's fast... compared to the old tool that i've been using for eons... i mean look at it like this... we're comparing a turtle with a lightening bolt... somehow "fast" just doesn't seem to be strong enough to describe the difference in speed :P ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/12/2012 07:20, Tomas Hajny wrote: On Thu, January 12, 2012 03:34, waldo kitty wrote: [TRIM] without looking at the "code to copy" if i want to override the insert method, it almost seems that there's a bug if it just throws away the record we're trying to insert... it would seem that if the code locates a "duplicate" record, it would properly dispose of unwanted data... unless i perform the No. There are two tasks. One is dynamic allocation of the object, the other is insertion. Although you perform both tasks on one line in your program, these are two distinct tasks. The insert code cannot know whether you still may need the (previously allocated) object or not in the very general case. The insert code doesn't throw anything away - you do it by not storing the result of the "New (PTLERec, Init (..." to some variable and only send it as a parameter to a method which may or may not store it somewhere else. AHH! i think i understand this now... you are saying that instead of doing this... aTLEColl^.insert(New(PTLERec, Init(MySatName, MySatData1, MySatData2, MyCatNbr, MyEpoch))); i should do it in two steps like this... aTLERec := New(PTLERec, Init(MySatName, MySatData1, MySatData2, MyCatNbr, MyEpoch)); aTLEColl^.insert(aTLERec); but the the problem still comes of how do i know if the record was inserted into the list or not? insert doesn't seem to return a true or false on success... i guess this is where it is required(?) to override the insert method? does everyone have to override the insert method if they are in duplicates := FALSE mode? how do they handle the throwing away of the unneeded data?? [TRIM] 2. something else i'm running into is with duplicates:=FALSE, there's a whole bucket load of records that are not disposed of when i wipe out the collection... heaptrc hollers right nasty to me about'em on exit... i can only assume that these are the duplicates but i don't understand why they are still hanging around if insert or add threw them away already :/ If you already had them in the collection, they're not added again. You only dispose records added to the collection at the end, but these are lost this way. You can also sort this out in the overridden Insert method (if you don't want to use the newly created record, dispose it). i'm looking at this override of the insert method... as above, i don't know that they are /in/ the collection... i'm (currently) simply calling the insert method and leaving the work up to it... if it should be handling this gracefully, it isn't... at least not in a way that heaptrc likes ;) It behaves as specified; the responsibility for disposing the duplicates is on your side (since you allocate them in your code also). i think i see now... [TRIM] i'll probably have broken my code by the time you read this... but i'll very likely be attempting to implement the logic in my Input_Satellite_List routine ;) OB-) Possible, but likely resulting in some useless overhead (computing performance-wise) if you still intend to use the method Insert in that case. yeah, that went over like a lead balloon... i'm digging into the insert method override, instead... just gotta figure out how to access the epoch in the current record and the one in the passed record for the decision making comparison... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/11/2012 20:35, Tomas Hajny wrote: On 11 Jan 12, at 17:46, waldo kitty wrote: . . 1. right now the compare is working on the catalog number (TTLERec.catnbr) and with duplicates:=FALSE there are no duplicates... however, i need to be able to choose which record to keep when there is a duplicate catnbr but the epoch (TTLERec.epoch) is different... right now it is throwing out all but the first... how can i tell it how to decide which one to throw away? i saw earlier that one of the parent objects has neat functions like AtPut which would easily allow me to overwrite an existing record that's too old... i just don't know if i can use that in the middle of an insert or a search or just exactly where i would even put code to do this... The best solution is probably overriding the Insert method to fit your slightly modified logic. Copy the default implementation of TSortedCollection.Insert as found in objects.pp in FPC source tree and modify it according your needs (if Search returns true, perform the additional check for the epoch and depending on the result either use AtInsert (equally to the default implementation) or Dispose the previously stored record at position I ("I" returned by Search, "At (I)" used to access the previously stored record) and then use AtPut. i've been mulling this over for a few hours and i'm wondering if overriding the insert method or simply doing the lofic in my importation routine would be best... right now my code blindly inserts the record but i could do a search for a matching "key" (catnbr by keyof ??) and then if i find a match, look at the epoch of the two records, one in vars and the other in the collection... if the one in the vars is newer, then do an AtPut to overwrite the one currently stored... otherwise, just go on to read the next file record into the vars and check it from there... without looking at the "code to copy" if i want to override the insert method, it almost seems that there's a bug if it just throws away the record we're trying to insert... it would seem that if the code locates a "duplicate" record, it would properly dispose of unwanted data... unless i perform the previously mentioned logic checks manually to catch this, i don't see this happening... the number of records left in memory at the end of the program's execution is the same number as those not added because they are "dupes"... 2. something else i'm running into is with duplicates:=FALSE, there's a whole bucket load of records that are not disposed of when i wipe out the collection... heaptrc hollers right nasty to me about'em on exit... i can only assume that these are the duplicates but i don't understand why they are still hanging around if insert or add threw them away already :/ If you already had them in the collection, they're not added again. You only dispose records added to the collection at the end, but these are lost this way. You can also sort this out in the overridden Insert method (if you don't want to use the newly created record, dispose it). as above, i don't know that they are /in/ the collection... i'm (currently) simply calling the insert method and leaving the work up to it... if it should be handling this gracefully, it isn't... at least not in a way that heaptrc likes ;) [TRIM] data^.catnbr := Copy(data^.satdata[1],3,5); data^.epoch := Real_Value(data^.satdata[1],19,14); inc(sat_cnt); aTLECollection^.insert(data); dispose(data); Don't do this! You'll free the memory you allocated for your record. The collection will only contain a pointer to this data! (Many of the rules I mentioned for T(FP)List apply here as well) uh? for some reason i thought that the insert was copying the data to a place and then setting the pointer to there for the collection... i tried with and without the dispose(data) but it still looked the same... of course i was tired and might not have been looking at the right writeln debug output... . . No, Insert doesn't do any copying by default. In your current code, the copying is performed by calling the PTLERec constructor (in "New(PTLERec, Init(...") but if the pointer isn't inserted, it is thrown away currently. thrown away by the default object insert code? why doesn't it properly wipe it out since it is tossing the pointer into the bitbucket? If you use the overridden Insert method as suggested above, you can Dispose it from within the Insert call if you don't need to insert it. understood... and with an eye on the above discussion about doing the logic myself using the available routines, i could also take care of it there by deciding to AtPut, or, insert or dispose instead of blindly performing an insert and hoping for the best?? i'll probably have broken my code by the time you read thi
Re: [fpc-pascal] sorting and merging array of records
On 1/11/2012 11:11, Sven Barth wrote: Am 11.01.2012 09:27, schrieb waldo kitty: i tried this but could only get so far and then not further so i backed up and punted the ball... now i'm trying this with a sortedcollection and while i can apparently insert items, i haven't figured out how to access them and print their contents... unless their contents are garbage like the following prints out... You know that you're handling with pointer here as well? ;) yes... I never used TP's T(Sorted)Collection, so the following are mostly guesses, but I'll try. thanks... i finally got something working before reading your message... i ended up digging out my old Tom Swan "Mastering Turbo Pascal 6" book... there was a clear example that i was able to follow with a few tweaks for my data structure... it was easier to flip the pages back and forth while looking than to keep trying to jump between different windows on the screen... gimme a nice paperback book like this one any day! ;) in any case, i'm needing a touch more assistance if you or anyone else are willing to give it... code at the end... questions coming up now... 1. right now the compare is working on the catalog number (TTLERec.catnbr) and with duplicates:=FALSE there are no duplicates... however, i need to be able to choose which record to keep when there is a duplicate catnbr but the epoch (TTLERec.epoch) is different... right now it is throwing out all but the first... how can i tell it how to decide which one to throw away? i saw earlier that one of the parent objects has neat functions like AtPut which would easily allow me to overwrite an existing record that's too old... i just don't know if i can use that in the middle of an insert or a search or just exactly where i would even put code to do this... 2. something else i'm running into is with duplicates:=FALSE, there's a whole bucket load of records that are not disposed of when i wipe out the collection... heaptrc hollers right nasty to me about'em on exit... i can only assume that these are the duplicates but i don't understand why they are still hanging around if insert or add threw them away already :/ [TRIM] data^.catnbr := Copy(data^.satdata[1],3,5); data^.epoch := Real_Value(data^.satdata[1],19,14); inc(sat_cnt); aTLECollection^.insert(data); dispose(data); Don't do this! You'll free the memory you allocated for your record. The collection will only contain a pointer to this data! (Many of the rules I mentioned for T(FP)List apply here as well) uh? for some reason i thought that the insert was copying the data to a place and then setting the pointer to there for the collection... i tried with and without the dispose(data) but it still looked the same... of course i was tired and might not have been looking at the right writeln debug output... writeln(PTLERec(aTLECollection)^.catnbr); writeln(PTLERec(aTLECollection)^.epoch); {$ENDIF} Ehm... you know that it can't work if you cast a TTLECollection pointer to a TTLERec pointer? These are two different structures. No wonder why you only see garbage as you most likely see the contents of the Collection (which consists mostly of pointers). i told ya i get confused with pointers at times :lol: i know it is a pointer but what's under it and how to get to it? :laugh: and with no easily found clear examples like i was able to find in my book, well... i should mention that it was also like very early in the morning and i hadn't slept yet ;) like i wrote above, i have it working now... i just need to get the duplicates elimination to keep the right one... this thing is fast, too! one goal accomplished :P See at the top of the mail how you'd access the contents correctly. Normally I'd suggest you to simply guery the "Count - 1"th item, but in this exact case you'd need to search the item again as you're using a sorting list and the last inserted item might not be at the last position of the list (as Insert maintains the order of the list). yeah, that was a debug attempt to read what was just put in... i resorted to filling the collection and then doing a foreach on them in a later step... now i have some output files that i can compare and see what's happening... i've saved all the posts in this thread for reference... i know there's some good tidbits in them... once i get more used to my code, i might actually see more of what you were showing me :) so... here's my current batch of code... it ain't pretty, its my brother ;) program satsort; uses {$IFDEF DEBUG}heaptrc,{$ENDIF}strings,objects,math,crt,dos; type Tvector= array [1..4] of double; Tcat_nbr = pstring; Tsat_name = pstring; Tline_data = pstring; PTLERec= ^TTLERec; TTLERec= object(TObject) satname : Tsat_name;
Re: [fpc-pascal] sorting and merging array of records
On 1/10/2012 16:41, Sven Barth wrote: On 10.01.2012 22:02, waldo kitty wrote: TList? hummm... better? smaller? faster? easier to use? small memory footprint? i'm game to try things as long as it works in the end ;) TList is basically an array wrapped in a class (though I would suggest TFPList as that is faster than TList (TList is based on TFPList)). Both can be found in unit Classes. The following you need to know: T(FP)List works on pointers, thus you need to 1. declare a pointer type to your record type (e.g. Pthree_line_data = ^three_line_data) 2. allocate a Pthree_line_data variable if you want to add a new entry to the list i tried this but could only get so far and then not further so i backed up and punted the ball... now i'm trying this with a sortedcollection and while i can apparently insert items, i haven't figured out how to access them and print their contents... unless their contents are garbage like the following prints out... program satsort; uses {$IFDEF DEBUG}heaptrc,{$ENDIF}objects,math,crt,dos; type vector = array [1..4] of double; cat_nbr= string[5]; sat_name = string[25]; line_data = string[69]; two_line = array [1..2] of line_data; PTLERec= ^TTLERec; TTLERec= record satname : sat_name; satdata : two_line; catnbr : cat_nbr; epoch : double; end; TTLERecObj = object(TObject) TLEData : PTLERec; constructor Init; destructor Done; virtual; end; constructor TTLERecObj.Init; begin new(TLEData); end; destructor TTLERecObj.Done; begin dispose(TLEData); end; type PTLECollection = ^TTLECollection; TTLECollection = object(TSortedCollection) TLERec : TTLERecObj; function Compare(Key1, Key2 : Pointer): longint; virtual; end; function TTLECollection.Compare(key1, key2: pointer): longint; begin if PTLERec(key1)^.catnbr = PTLERec(key2)^.catnbr then compare := 0 else if PTLERec(key1)^.catnbr < PTLERec(key2)^.catnbr then compare := -1 else compare := 1; end; const data_type : byte = 3; // max_sats = {$IFDEF FPC}65536{$ELSE}250{$ENDIF}; var data_drive,data_dir, work_drive,work_dir : string; UTC_offset : double; DST : boolean; fsat,fobs: text; obs_name : string[25]; piss : vector; gigo : char; my_sats : word; aTLERec : PTLERec; aTLECollection : PTLECollection; [...] Function Input_Satellite_List(var aInputFile: TextFile) : word; var data: PTLERec; sat_cnt : word; i,x : longint; begin sat_cnt := 0; while not EOF(aInputFile) do begin new(data); Readln(aInputFile,data^.satname); Readln(aInputFile,data^.satdata[1]); Readln(aInputFile,data^.satdata[2]); data^.catnbr := Copy(data^.satdata[1],3,5); data^.epoch := Real_Value(data^.satdata[1],19,14); inc(sat_cnt); aTLECollection^.insert(data); dispose(data); {$IFDEF DEBUG} writeln(PTLERec(aTLECollection)^.satname); writeln(PTLERec(aTLECollection)^.satdata[1]); writeln(PTLERec(aTLECollection)^.satdata[2]); writeln(PTLERec(aTLECollection)^.catnbr); writeln(PTLERec(aTLECollection)^.epoch); {$ENDIF} end; {while not EOF} Input_Satellite_List := sat_cnt; end; {Procedure Input Satellite List} ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/10/2012 16:41, Sven Barth wrote: On 10.01.2012 22:02, waldo kitty wrote: hummm... i may not need this specialization, then... i'm not comparing the entire record but portions of the fields in the records... i've made a few changes that should make this easier for me to do... let me show an example of an input record... It's not about YOU comparing the entire record. The TFPGList uses that internally for it's own bookkeeping. ahhh! The specialization is mostly for type safety and ease of use. As I show you below a simple pointer based TList works as well (if you follow some advices). In the end it should be easier to handle than an array ;) i never did like pointers... hard to wrap my head around what was what and how to access certain things... but then again, i'm self-taught ;) ISS (Zarya) 1 25544U 98067A 11355.91136867 .00021672 0-0 28116-3 0 6701 2 25544 51.6441 296.4760 0024445 190.7247 276.2995 15.58432251750217 this breaks out like this... line columns example description 0 1-24 ISS (Zarya) common name 1 1 1 element line number 1 3-7 25545 catalog number 1 8 U elset classification 1 10-17 98067A international designator 1 19-32 11355.91136867 epoch (UTC) 1 34-43 .00021672 1st deriv of mean motion 1 45-52 0-0 2nd deriv of mean motion 1 54-61 28116-3 B* drag term 1 63 0 element set type 1 65-68 670 element number 1 69 1 checksum 2 1 2 element line number 2 3-7 25545 catalog number 2 9-16 51.6441 orbit inclination 2 18-25 296.4760 rt ascension acend node 2 27-33 0024445 eccentricity 2 35-42 190.7247 arg of perigee (degrees) 2 44-51 276.2995 mean anomaly (degrees) 2 53-63 15.58432251 mean motion (revs/day) 2 64-68 75021 rev number at epoch 2 69 3 checksum so i now have the following to define the record... since i only need the catalog number to check for duplicates and the epoch to determine which one to keep, i've added those two fields to the record and pull them during the reading of the data (see Input_Satellite_List procedure below)... Wouldn't it be easier for you to parse the complete two lines into a full blown record (just asking). in the future, i will want to do this... however, this tool is a first step into mangling^H^H^H^H^H^Hssaging TLE data... the only purpose for this tool is to merge TLE files together into one master file with /ALL/ available satellite TLEs listed... the current old DOS program simply cannot do this due to memory constraints... as such, i only need know the catalog number and the epoch of the two... once the final sorted merged list is completed, it is all going to be written back to a plain 7bit ascii text file like it all originated from... this text file is then used for my other satellite and astronomy related applications ;) Then you don't need to parse them later on and can just do a "YourRecord.MeanAnomaly" (for example). Using a TStringList with the correct parameters can also remove the burden from you to seperate the values by hand. at this time, this only needs be done with these two (sub)fields in the TLE entries... i'm only interested in these two but am storing everything to make it easier to later run thru the list or collection or array and write the three original lines to a master TLE text file... Function IsSameReal(num1,num2 : double) : integer; begin if (num1 < num2) then IsSameReal := -1 else if (num1 = num2) then IsSameReal := 0 else if (num1 > num2) then IsSameReal := 1; end; You can shorten this by using the "CompareValue" function from unit "Math": function IsSameReal(num1,num2: Double): Integer; begin IsSameReal := CompareValue(num1, num2); end; interesting! in fact, i don't really even need "IsSameReal" as i can simply use CompareValue directly with these two numbers? (though I would name that function CompareReal instead of IsSameReal ;) ) hahaha! true :) something else i need to make sure of is that this will compile on my OS/2 FPC 2.4.2 since that is the environment it will be under when it goes production... unless, of course, there's a shiney new 0s2260full.zip file for me to play with ;) [...] as i wrote in another message, my windows' boxen update from SVN and every time i've tried to update FPC and make whatever, it breaks and i'm scared to break what i currently have working... i always have to blow the directory away, then svn it all back down, and then do the make thing... the ugly part is that i also have lazarus built with and using this svn'd version of FPC so i definitely do not want to be breaking that, either... a second reason is i don't do the svn thing on the OS/2 box and so have to rely on an install package for that OS... the last time i did this, i unzipped os2242full.zip to /fpc and went from there... i recall having to manually configure a lot of stuff, though... include paths and the like... i still don't have
Re: [fpc-pascal] sorting and merging array of records
On 1/10/2012 14:41, Sven Barth wrote: On 10.01.2012 20:12, waldo kitty wrote: i don't know what this is pointing to because it is evidently not in my sources but in a unit i'm loading... the actual compiler message is (750,50) Error: Operator is not overloaded satsort.pas(434) Fatal: There were 1 errors compiling module, stopping satsort.pas(0) Fatal: Compilation aborted Oh damn it, I forgot about that. Is it possible for you to update to version 2.6? The problem is the following: the list I mentioned to you uses a equality operator ("=") of two values of the type you specialize with. Thus you need an overloaded operator in case of records. But you can't use a global overloaded operator (which you could do in FPC 2.4.5), as the specialization will only see those types, functions and operators that were visible when the generic (the TFPGList) was declared. So you'll need to use advanced records for that (which are only available from 2.6.0 on). hummm... i may not need this specialization, then... i'm not comparing the entire record but portions of the fields in the records... i've made a few changes that should make this easier for me to do... let me show an example of an input record... ISS (Zarya) 1 25544U 98067A 11355.91136867 .00021672 0-0 28116-3 0 6701 2 25544 51.6441 296.4760 0024445 190.7247 276.2995 15.58432251750217 this breaks out like this... linecolumns example description 0 1-24 ISS (Zarya) common name 1 11element line number 1 3-7 25545catalog number 1 8Uelset classification 1 10-1798067A international designator 1 19-3211355.91136867 epoch (UTC) 1 34-43 .00021672 1st deriv of mean motion 1 45-52 0-0 2nd deriv of mean motion 1 54-61 28116-3 B* drag term 1 63 0element set type 1 65-68 670 element number 1 69 1checksum 2 12element line number 2 3-7 25545catalog number 2 9-16 51.6441 orbit inclination 2 18-25296.4760 rt ascension acend node 2 27-330024445 eccentricity 2 35-42190.7247 arg of perigee (degrees) 2 44-51276.2995 mean anomaly (degrees) 2 53-6315.58432251 mean motion (revs/day) 2 64-6875021rev number at epoch 2 69 3checksum so i now have the following to define the record... since i only need the catalog number to check for duplicates and the epoch to determine which one to keep, i've added those two fields to the record and pull them during the reading of the data (see Input_Satellite_List procedure below)... type cat_nbr= string[5]; 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; catnbr : cat_nbr; epoch : double; end; var aList : TSatDataList; [...] Function IsSameReal(num1,num2 : double) : integer; begin if (num1 < num2) then IsSameReal := -1 else if (num1 = num2) then IsSameReal := 0 else if (num1 > num2) then IsSameReal := 1; end; Function IsSameStr(str1,str2 : cat_nbr) : boolean; begin IsSameStr := str1 = str2; end; Procedure Input_Satellite_List(var aInputFile: TextFile); var data : three_line_data; dupe : boolean; i,x : integer; begin if not EOF(aInputFile) then begin Readln(aInputFile,data.satname); Readln(aInputFile,data.satdata[1]); Readln(aInputFile,data.satdata[2]); data.catnbr := Copy(data.satdata[1],3,5); data.epoch := Real_Value(data.satdata[1],19,14); dupe := False; for i := 0 to aList.Count -1 do if IsSameStr(aList[i].catnbr,data.catnbr) then // make the dupe check begin// if catnbrs are the same dupe := True; // first mark dupe true x := IsSameReal(aList[i].epoch,data.epoch); // compare epochs case x of -1: begin // aList < data, replace with data aList[i] := data; end; 0 : begin // aList = data, ignore data end; 1 : begin // aList > data, ignore data end; end; {case} end; {if IsSameStr} if not dupe then aList.Add(data); // not a dupe so add it end; {if not EOF} end; {Procedure Input Satellite List} with this not working like this i just need to shove them into a list or
Re: [fpc-pascal] sorting and merging array of records
On 1/10/2012 13:13, Sven Barth wrote: On 10.01.2012 18:15, waldo kitty wrote: On 1/10/2012 05:39, Sven Barth wrote: // somewhere else: aList.Sort(@SatDataCompare); What I wrote here might not be perfect, but it should give you a start. thank you very much! it has definitely given me some ideas... one thing that concerns me, though, is that i'm using FPC 2.4.5 console mode... this fgl unit is available in this FPC for this line? > type > TSatDataList = specialize TFPGList; Yes, this feature is available in 2.4.5 (though I would nevertheless suggest to you to update to the newly released 2.6.0 :) ) yes, i've got to figure out how to do that... my windows' installations are pulled from SVN following the procedure on one of the wiki pages but i have a .bat file that is scripted for this process... the only problem is that i generally have to start clean if i want to update fpc because something goes wrong during the make but i don't recall what... i do something almost exactly the same with lazarus (from the same page) but i manually compile it from within lazarus instead of trying from the command line... i'm rather scared to mess up what is currently a working installation :/ the other thing i'm trying to figure out is if i can easily and speedily pull portions of the satdata fields for the sort and duplicate functions... i'm thinking that it would be faster to expand the record into each of its actual fields and fill them during import... i think i'd rather copy(x,y,z) to individual record field during import rather than pulling the needed fields during the sorting and merging phases... Yes, that might indeed be faster or better. i implemented it by adding two additional fields to the record and filling that data as above... then i use those two fields in the dupe finding and comparison flow... i don't know if it works due to an error i just wrote about in another message in this thread... i'm hoping you or someone else has an idea where to look as i'm completely lost :( You could also try to experiment with TFPGMap if your satellite data has a unique key. You specialize it like the following: type TYourMap = specialize TFPGMap; Where YourKeyType is the type of your key (e.g. String, Integer, etc) and YourKeyData is your data record. For more info I'd advice you to take a look at the class itself and its parent class TFPSMap, because I haven't used that class yet. i think i'll leave that alone for now ;) and one more trip through the raft of data can adjust the social name for the satellite :) Can't you adjust that when reading the data as well? yes but it is still a loop of several hundred or thousand comparisons for each item in the list... i've not updated the XRF (crossreference) files in almost a year and there have been a lot of new birds launched... the XRF files currently number 37 files (of up to 1000 entries each) containing 15194 entries in total... not all satellites are represented because their common names are fine (by my standards) or they are not flying any more... the only thing this list is really for is to fix up the common names to what i want to use... for example satellite 04321 has two common names... AO-05 and Australis-OSCAR-5... amateur radio folk likely prefer AO-05 whereas myself and others prefer the OSCAR notation... it makes it easier for grouping tasks since not all OSCAR units are the same for the first characters... AO-06 is AMSAT-OSCAR-6 so you can see that the 'A' means different things... there's all kinds of common names, too... debris for certain ones (hundreds of entries for the chinese satellite that was destroyed) with a more informative name, rocket body parts, despin weights, shields, numerous covers, etc... [/rambling talk] i'm trying to figure out how to also work out a method of deleting TLEs of birds who are down... another list to process and walk through :P Are they listed in another file? they probably will be... the XRF files have two leading spaces (i didn't design the format) and i could probably hijack the first space to put an 'X' if the satellite is no longer flying... then i could use you suggestion below to eliminate those entries from the list... If so then I suggest the following: read the file and for each record read you search in the list for that satellite and do a "YourList.Delete(Index)" where "Index" is your for-loop's counter variable (if a satellite is contained more than once in your list I'd suggest you to use a downwards counting loop from "YourList.Count - 1 downto 0" otherwise you'll get "List index out of bounds"-exceptions if you access the last elements (depending on how many you deleted). Otherwise you can cancel the loop using "Break" again. i'll try to
Re: [fpc-pascal] sorting and merging array of records
On 1/10/2012 05:39, Sven Barth wrote: // -1 if aLeft < aRight // 0 if aLeft = aRight // 1 if aLeft > aRight begin // compare the two items and return the correct value end; // somewhere else: aList.Sort(@SatDataCompare); What I wrote here might not be perfect, but it should give you a start. i've been working with what you sent and have run into a problem i don't understand or how to find and fix... Error: Operator is not overloaded You’re trying to use an overloaded operator when it is not overloaded for this type. i don't know what this is pointing to because it is evidently not in my sources but in a unit i'm loading... the actual compiler message is (750,50) Error: Operator is not overloaded satsort.pas(434) Fatal: There were 1 errors compiling module, stopping satsort.pas(0) Fatal: Compilation aborted i don't know if this is because i wrote an IsSameStr function because i could not find an IsSame one... i actually have two... one checks if two string vars have the same string and the other checks if two double vars have the same double... IsSameStr is boolean for true or false but IsSameReal returns an integer of -1 (var1 < var2), 0 (var1 = var2) or 1 (var1 > var2)... am i in the right target area? i should mention my fpc version is ╔═[■] About ═╗ ║║ ║ FreePascal IDE for Win32 for i386║ ║Target CPU: i386║ ║ Version 1.0.12 2011/06/01║ ║(Compiler Version 2.4.5)║ ║║ ║ Copyright (C) 1998-2009 by ║ ║║ ║ Bérczi Gábor ║ ║ Pierre Muller ║ ║ and ║ ║ Peter Vreman ║ ║ OK ▄ ║ ║▀ ║ ╚╝ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/10/2012 03:38, Tomas Hajny wrote: On Tue, January 10, 2012 05:14, waldo kitty wrote: 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). yes, i believe i have some hard (l)earned TP code with that... i just hunted it up and it appears that i built my own objects with TSortedCollection... i've got to try to go back over it and see if i can figure it out... it does a lot of digging message bases to assemble linkage paths for the messages' distribution... i'm also going to take a look at what sven barth has offered... i might be able to knock this out in another few hours IF i can use the specialize thing he pointed me to... thanks to both you and he for your responses ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sorting and merging array of records
On 1/10/2012 05:39, Sven Barth wrote: // somewhere else: aList.Sort(@SatDataCompare); What I wrote here might not be perfect, but it should give you a start. thank you very much! it has definitely given me some ideas... one thing that concerns me, though, is that i'm using FPC 2.4.5 console mode... this fgl unit is available in this FPC for this line? > type > TSatDataList = specialize TFPGList; the other thing i'm trying to figure out is if i can easily and speedily pull portions of the satdata fields for the sort and duplicate functions... i'm thinking that it would be faster to expand the record into each of its actual fields and fill them during import... i think i'd rather copy(x,y,z) to individual record field during import rather than pulling the needed fields during the sorting and merging phases... and one more trip through the raft of data can adjust the social name for the satellite :) i'm trying to figure out how to also work out a method of deleting TLEs of birds who are down... another list to process and walk through :P thanks again for the info! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] sorting and merging array of records
i have a li'l project i've been wanting to do for a really long time... as i'm trying to do more and more with FPC, i've experimented a bit and found that i should be able to handle this project much easier without the old DOS limitations on memory usage and without having to use special stuff like extended and expanded memory... so, the basics are that i'm also an amateur satellite observer... i keep up with the satellites via what's known as TLE (two line element) files... the ones i use are actually three lines where the first line is the satellite's common english name and the other two lines are the actual TLE element lines... there 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 :/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] inline and other modifiers
On 12/21/2011 20:27, nore...@z505.com wrote: Also delphi is more strict when it comes to PROGRAM name parsing. In freepascal the program name can mismatch the file name, whereas delphi stops compiling and tells you error. i've never known this (program name must equal filename) to be a requirement... but then again, i've never used delphi... i have, however, used TP2 thru TP/BP7 and in a world stricken with 8.3 filename limitations, being able to have something like PROGRAM TestMonitorResolutions with a filename of montest.pas was a GoodThing... why this would ever change simply because we can use long filenames is completely beyond me ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Why is Random(255) some 529x slower compared to Delphi 7?
On 12/8/2011 02:48, Graeme Geldenhuys wrote: On 8 December 2011 09:25, Felipe Monteiro de Carvalho wrote: And what about people using FPC only and depending on our Random being statistically strong, they are less important then theorical Delphi migrants? [like what was told to me numerous times before] They (FPC users) should speak up now, or forever hold your peace. And those that have spoken so far, all seem to be fine with a less statistically strong default Random(), and have the statistically strong one available in the Maths unit. i wouldn't say specifically place it in the maths unit but what's wrong with having both available via a "fastrandom" boolean parameter that is passed? if the parameter is not passed, it is defaulted to TRUE... if one wants the MT random, then they send FALSE in this parameter... seems simple enough... i think ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
On 10/21/2011 01:25, Jürgen Hestermann wrote: Florian Klämpfl schrieb: > If anybody does not see why increasing complexity without a good reason > should be avoided, I recommend: I agree wholeheartly. In the past Pascal was a simple still powerfull language but meanwhile it has become a catchment tank for all features of all other languages. This defeats the original intention of Nicholas Wirth and the reason for what I love(d) the language. It seems everybody tries to mimic Pascal into whatever he is used to do in other languages. So we should no longer call this (Object) Pascal but "Chimera". +1 (based on some of the recent stuff being posted :) ) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Format() directives
On 10/20/2011 17:47, Andrew Pennebaker wrote: In the future, could Format respect the difference between '%x' and '%X'? It's useful to use the former for lowercase hexadecimal. please forgive the stoopid question but, is there any real difference? in hex, f00 is the same as F00, isn't it?? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Why do string indices start at 1, but array indices start at 0?
On 10/20/2011 17:43, Andrew Pennebaker wrote: It's inconsistent and ripe for bugs. funny thing, that... i thought the same thing when looking at the proposals and requests :LOL: ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
On 10/20/2011 16:35, Juha Manninen wrote: 2011/10/20 Gregory M. Turner mailto:g...@malth.us>> Good point. I guess nothing's O(free lunch). Yes, the downside here is that the concept is very different from any syntax in OP. It will be difficult to learn properly. i still fight, today, with much of my LISP code... :? :( ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
On 10/20/2011 15:17, Florian Klämpfl wrote: Am 20.10.2011 21:09, schrieb Gregory M. Turner: Interesting discussion -- at least for me, I didn't know Delphi had this feature. In case anyone really doesn't see the point, consider that this thing: http://www.youtube.com/watch?v=cYw2ewoO6c4 has all the capabilities of Object Pascal (with less flowery syntactic sugar to mess up the purity of the system). If anybody does not see why increasing complexity without a good reason should be avoided, I recommend: http://www.youtube.com/watch?v=kYUrqdUyEpI +1~ ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How can I implement "thrice" in Free Pascal?
On 10/20/2011 11:08, Andrew Pennebaker wrote: 2.6, eh? Awesome. I'm using the SVN trunk, but it's not working for me for some reason. this is why the latest version of the compiler, 2.4.4 is the one supported ;) I'll just wait for v2.6 then. always another possibility... depending on the waittime, of course ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DBF Field name length and fpdbfexport
On 9/2/2011 06:00, Reinier Olislagers wrote: may only contain the letters ‘a’-‘z’ and ‘A’-‘Z’, digits ‘0’-‘9’, and the underscore ‘_’ character well, that's interesting... i was writing back to say that the above all appeared as "garbage" characters while i was reading the message... evidently they are UTF-8 or such and my message reading settings are not UTF-8 compatible... what surprised me was that they appeared correctly when i started this reply with them quoted... PS: sorry for offtopic if such... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] random numbers negative
On 8/16/2011 12:05, Felipe Monteiro de Carvalho wrote: Another idea: -1 * Random(127); this was what i was thinking of as it doesn't limit the number to any particular size as the following seems to do... random(128)-127; what would happen with this? random(4096)-127; ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] random numbers negative
On 8/16/2011 11:54, Luis Fernando Del Aguila Mejía wrote: thansk El 16/08/2011 10:36 a.m., Jonas Maebe escribió: On 16 Aug 2011, at 17:25, Luis Fernando Del Aguila Mejía wrote: I have a doubt. With the random function, Can you generate random numbers negative? Begin randomize; Writeln (random (-127)) / / 0> = n> -127 End. random(128)-127; Jonas interesting... i don't see jonas' reply in the list at all... was it private only? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] Re: RE : Re: RE : RE : RE : Assigning value to ftVariant datatype& varbytes-still stuck
On 8/9/2011 11:21, Ludo Brands wrote: line 547 or 574? the error report is 574 ;) waldo, thanks for trying to help, unfortunately, I think he meant 574 ;) My keybroad is suffering from dyslexia. mine does it all the time, too :lol: ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: RE : Re: RE : RE : RE : Assigning value to ftVariant datatype& varbytes-still stuck
On 8/9/2011 11:13, Reinier Olislagers wrote: On 9-8-2011 17:03, waldo kitty wrote: On 8/9/2011 10:42, Ludo Brands wrote: Exception: Access violation Source unit: Method name: Line number: 574 00.003 TestXSDExport_Access_NoXSD_NoDecimal Error: Line 547 is where FillTestData is called. Not very usefull. line 547 or 574? the error report is 574 ;) waldo, thanks for trying to help, unfortunately, I think he meant 574 ;) so do i but someone had to point out the possible error ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] Re: RE : RE : RE : Assigning value to ftVariant datatype& varbytes-still stuck
On 8/9/2011 10:42, Ludo Brands wrote: Exception: Access violation Source unit: Method name: Line number: 574 00.003 TestXSDExport_Access_NoXSD_NoDecimal Error: Line 547 is where FillTestData is called. Not very usefull. line 547 or 574? the error report is 574 ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Library for network calculation
On 7/26/2011 15:27, Jorge Aldo G. de F. Junior wrote: I dont like to take local variable initialization for granted. Even if the manual says that its guaranteed that a local variable will start with 0, i prefer to initialize everything to a known value myself. +1000~ this is a leson i learned way back in the TP2 days... i still use it in my TP/BP 6/7 code... either set it to zero or set it to nul(l)... An aditional Move $varaddress, 00 at startup wont slow things down noticeably when your pc is running at 2ghz... hummm... some of us still write for and work with >500Mhz machines... i still find it hard to believe that the lazarus executable with debug code is 75Meg or so... i've always prided myself on tight, fast, small code... maybe like turbo power used to do but i've even tightened some of their code in the past but that's another story for another place... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] Timezone information in a dataset datetime field?- updated
On 7/25/2011 15:53, José Mejuto wrote: Hello FPC-Pascal, Monday, July 25, 2011, 6:23:21 PM, you wrote: JH> And even if dates are correctly stored in UTC it is not easy to reliably JH> get back the "local time". Daylight savings were changed in the past JH> (and may also change in the future). If you have a date/time of JH> 2001-05-01 18:00 UTC it is not easy to predict what local time it was in JH> time zone x. You would need a history of all daylight saving algorithms JH> of the past and the future for all time zones (or even countries). This already exists, but future settings are impossible to predict, so a local time in the future is a no-no and should be avoided as much as possible. while i agree, i feel that it is also important to point out that one may easily perform future date calculations based on several different formulas with the understanding that they may not be accurate when that date arrives if the formula changes for some reason... the recent examples given are the US daylight saving time changes (note: NOT daylight savings [specifically note there is NO 's' on "daylightsaving"]) but it is easy enough to work with this... i've done it for years with TP3 and TP6 code... easier in recent years but still... i've formulas from somewhere that convert between numerous calendars... i believe i even have one for the myan calendar but like most of what i have, it is all older TP3-6 code and it is also a matter if me finding it in my library :? for general purposes, storing in local time is OK but it really needs to include the timezone info for the local time or it needs to be converted to UTC so that multi-timezone apps can properly correlate the actual events on a uniform timeline... this can be a very critical point in some applications... PoS apps, being one... database transactions being another one... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Linux: How to execute a program, but not to wait until finishes
On 7/19/2011 14:14, Sven Barth wrote: On 19.07.2011 16:52, fred f wrote: Hi, use this code, which starts itself, but when you close first started the second ends as well, what I don't want. with TProcess.Create (Application) do begin CommandLine := Application.ExeName + '&'; Execute; Free; end; If I remember correctly this is simply the way Unix behaves. If the parent process terminates all children are terminated as well. I don't know how one can circumvent this. sounds like maybe they want "detach" but that won't work if they require to interface with the app... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Redirecting input to a child process
On 5/8/2011 16:16, Anton Shepelev wrote: waldo kitty: how about sending the ^Z line the CRLF is being sent to indicate line breaks?? This I had tried even before posting the question :) i wasn't sure and the posts didn't seem to indicate this so i thought i'd ask ;) now i'll go back to reading and see what you guys come up with for the solution :) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] Redirecting input to a child process
On 5/8/2011 13:17, Anton Shepelev wrote: Ludo Brands: If you run 'more' in a cmd window you'll notice that 'more' echoes the input but only sends to stdout when a return is entered. I modified the program to send 'Anton'#10 and the program reads back 'Anton'#10 from stdout. Thank you, Ludo, this is great! But why doesn't the process finish? I thought that the clos- ing of the write end of the StdIn pipe handle should cause a EOF to be 'seen' at the read end, but this does not happen. how about sending the ^Z line the CRLF is being sent to indicate line breaks?? that should indicate the EOF which should trigger the ending of the process and closing of the pipe... shouldn't it? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Forward type not resolved
On 3/3/2011 17:15, Leonardo M. Ramé wrote: Sorry, the error was here: TOnSqueeze = procedure (AQuote: TQuote); of object; This line should be: TOnSqueeze = procedure (AQuote: TQuote) of object; amazing what a misplaced semi-colon will do, eh? ;) i would have thought that there would have been an additional error concerning the trailing "of object"... was there? did it give a clue as to the actual error of the misplaced semi-colon? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Passing objects to libraries and back
On 2/26/2011 02:12, leledumbo wrote: is it allowed ? Yes, but watch out that is/as operator might not work as expected. can i pass ansistrings ? Yes, but only if you know what you're doing. NEVER modify the passed strings (it would confuse the reference counting). Use const parameter all the time. this seems to be something that i'm learning about... it appears to be a bit(???) different than what i am used to with TP/BP 6/7... in this case, does a const parameter point to the original or a copy of the original? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] help with synapse mime routines...
On 2/19/2011 21:44, Tomas Hajny wrote: Alright. It's just a hack, but probably sufficient for your current needs. ;-) The attached files "fix" Synapse (the released version) for the OS/2 target. There are limitations related to character set conversions and time handling (timezones and daylight saving time), but I believe that it would have no impact on you. initial testing seems to show it working for my current project needs... i get the same results in my output files from the OS/2 native flavor of the exe as i get from the win32 native flavor of the exe... thanks! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] help with synapse mime routines...
On 2/19/2011 15:27, Tomas Hajny wrote: On 19 Feb 11, at 14:53, waldo kitty wrote: i was also incorrect... on the OS/2 box, in Mode: DEBUG with Target: OS/2, it is giving the following... Fatal: Can't find unit UnixUtil used by synautil i'm using synautil for the space trimming functions and the replacestring function... Yes. As it happens quite often, someone assumed that everything non- Windows must be Unix and thus tried to load some Unix specific unit. I'll see what would be possible alternatives. sounds good to me :) However, I guess that space trimming functions should be also available directly in platform independent parts of FPC RTL (strutils maybe)? yes, i went digging in there and have changed my code a bit more to use the FPC routines... i don't know if it is faster or not but it has reduced the complexity of my code somewhat... i removed a loop and three vars, altogether, as well as reducing two functions to one and use another routine to handle something i was doing via the character replacement arrays... for this i had to add sysutils and strutils... however, i still need to use synapse's synautil for the StringsTrim routine which removes empty lines from the end of the stringlist... of course none of this helps with the need for the UnixUtil unit on OS/2 because synautil is still used internally in the messpart stuff i'm using from synapse... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] help with synapse mime routines...
On 2/19/2011 08:45, Tomas Hajny wrote: On Sat, February 19, 2011 06:36, waldo kitty wrote: Fatal: Can't find unit dynlibs used by synafpc Yes - unit dynlibs (loading of DLLs on demand) is not supported under GO32v2 for obvious reasons... yep! i was also incorrect... on the OS/2 box, in Mode: DEBUG with Target: OS/2, it is giving the following... Fatal: Can't find unit UnixUtil used by synautil i'm using synautil for the space trimming functions and the replacestring function... [TRIM] i hope this is clear and understandable... i will provide another post with the necessary information for the OS/2 native side if necessary... just let me know, eh? :P I'll have a look at your sources once I get home. Having Synapse supporting the OS/2 target would be a nice side-effect. ;-) :) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] help with synapse mime routines...
On 2/19/2011 05:30, Marco van de Voort wrote: In our previous episode, waldo kitty said: Fatal: Can't find unit dynlibs used by synafpc Odd. Dos doesn't support a common dll/shared library format (though some toolchains do on their own, right... the closest would be the old OVR/OVL (overlay) files but their use is quite different... FPC doesn't atm). i can understand that ;) But OS/2 does have dlls, and afaik has unit dynlibs, so that is a bit strange. right... the above error is from the DOS242FULL install i have on my w2k dev box... had to put it on there for the LFN support so that i could install /all/ available library code ;) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] help with synapse mime routines...
On 2/18/2011 04:47, Tomas Hajny wrote: On Fri, February 18, 2011 02:24, waldo kitty wrote: I'm willing to have a look at your current version if you can upload it somewhere. Synapse has probably not been ported to the OS/2 target and it possibly uses various platform specific APIs but it should be possible to port it with reasonable effort (especially stuff like processing MIME messages should be fairly generic). First of all, you should check whether the missing units are supposed to be platform independent or not. If not, it is surely not just the matter of paths, etc. Also, if you mention concrete error messages, people may be able to advise. ok, as i wrote before, i would attempt to provide more information... here's what i'm getting with the attached source code when attempting to compile a GO32V2 (native) target on my win2k development box... this environment is from the DOS242FULL.ZIP archive with the same last synapse public release code as previously used in my i386-win32 console compilations... this is the same/only public release code available from the synapse site... i have NOT (yet) attempted to pull the SVN synapse code... yes, this synapse code appears to be "ancient" in that it is dated 2009 (IIRC!)... Fatal: Can't find unit dynlibs used by synafpc my sources, yet unmodified for more general processing, are attached... yes, it is "ugly" and i need to move at least one section to another procedure or two but here it is in all its ugliness ;) i /THINK/ this is the same initial error i get when attempting to compile on OS/2 from the OS2242FULL.ZIP archive... on each, they are set up as a separate and distinct entity and the exact same synapse sources are copied to each distinct base installation's projects directory... the only thing i've done in each case is to add the synapse sources' directory to the unit and include files sections in the FPC IDE... i hope this is clear and understandable... i will provide another post with the necessary information for the OS/2 native side if necessary... just let me know, eh? :P {$MODE DELPHI} Program ArnewsMimeExtractor; uses mimepart, synachar, synautil, classes; type Tc = class(TObject) public class procedure ph(const Sender: TMimePart); end; class procedure Tc.ph(const Sender: TMimePart); begin // Sender.Charset := 'ISO_8859_1'; // Sender.DefaultCharset := 'ISO_8859_1'; // Sender.TargetCharset := GetCPFromID('ISO_8859_1'); Sender.ConvertCharset := FALSE; Sender.DecodePart; Sender.EncodePart; end; var LineList: tstringlist; MsgIn: tmimepart; PartCount: integer; MsgWork: tmimepart; MyPart: integer; MyPartCount: integer; i: integer; cpos: integer; llen: integer; ArrayCount: integer; FindChars: array of ansistring; ReplaceChars: array of ansistring; begin // set up arrays for character string replacements ArrayCount := 14; setlength(FindChars,ArrayCount); setlength(ReplaceChars,ArrayCount); FindChars[0]:= '=20'; ReplaceChars[0] := ' '; FindChars[1]:= '=3D'; ReplaceChars[1] := '='; FindChars[2]:= '=85'; ReplaceChars[2] := '...'; FindChars[3]:= '=96'; ReplaceChars[3] := '-'; FindChars[4]:= '=99'; ReplaceChars[4] := '(tm)'; FindChars[5]:= '=A0'; ReplaceChars[5] := ' '; FindChars[6]:= '=A7'; ReplaceChars[6] := '§'; FindChars[7]:= '=AD'; ReplaceChars[7] := ' '; FindChars[8]:= '=AE'; ReplaceChars[8] := '(r)'; FindChars[9]:= '=B7'; ReplaceChars[9] := '·'; FindChars[10] := '=D8'; ReplaceChars[10] := 'Ø'; FindChars[11] := '=E1'; ReplaceChars[11] := 'á'; FindChars[12] := '=F6'; ReplaceChars[12] := ''; FindChars[13] := ' '; ReplaceChars[13] := ' '; MsgIn := tmimepart.create; LineList := TStringList.create; writeln('Processing file ',paramstr(1),'...'); try MsgIn.OnWalkPart:=tc.ph; MsgIn.Lines.LoadFromFile(paramstr(1)); writeln(' Working with ',MsgIn.Lines.Count,' lines in message file...'); MsgIn.Charset := 'ISO_8859_1'; MsgIn.DefaultCharset := 'ISO_8859_1'; MsgIn.TargetCharset := GetCPFromID('ISO_8859_1'); MsgIn.ConvertCharset := FALSE; MsgIn.DecomposeParts; MsgIn.Charset := 'ISO_8859_1'; MsgIn.DefaultCharset := 'ISO_8859_1'; MsgIn.TargetCharset := GetCPFromID('ISO_8859_1'); MsgIn.ConvertCharset := FALSE; MsgIn.WalkPart; PartCount := MsgIn.GetSubPartCount; MsgIn.Charset := 'ISO_8859_1'; MsgIn.DefaultCharset := 'ISO_8859_1'; M
Re: [fpc-pascal] help with synapse mime routines...
On 2/18/2011 04:47, Tomas Hajny wrote: On Fri, February 18, 2011 02:24, waldo kitty wrote: on my OS/2 box, i've tried targets of OS2 and OS2 with EMX but both have failed all kinds of ways... i suspect that it is simply to do with the paths to the units and include files... i have been able to get something going somewhat but then run into masses of "duplicate identifier" errors... I'm willing to have a look at your current version if you can upload it somewhere. my code is pretty small... it should easily fit the attachment limitations of this list :) i still have a few more tweaks to add to it as a few things are still specific to certain types of messages but overall, it is pretty straight forward ;) Synapse has probably not been ported to the OS/2 target and it possibly uses various platform specific APIs but it should be possible to port it with reasonable effort (especially stuff like processing MIME messages should be fairly generic). that is/was my thinking as well... First of all, you should check whether the missing units are supposed to be platform independent or not. yes, part of what i'm running into is platform dependency problems... i forget which unit it is that's triggering the platform stuff but where it is failing is when trying to bring in platform stuff like loading libraries and there's nothing in my code that needs any libraries to be loaded for any reason that i'm aware of... it is possible that "WalkParts" might want something loaded from a lib but i do not need anything like that for my immediate purposes since i'm only looking for the text/plain section(s) and extracting them to an ASCII text file... If not, it is surely not just the matter of paths, etc. Also, if you mention concrete error messages, people may be able to advise. i shall try to grab these in the future... one thing that may also be causing waves is that my OS/2 and DOS FPCs are 2.4.2 releases whereas on my development machine(s), i'm pulling FPC and lazarus from their SVNs and building them from the ground up... both of my development machines started with nothing on them until i pulled the code from SVN and the bootstrap compiler to kick it in the arse and build working environments... i'm just not sure where to turn now so out of frustration, i'm now pulling down the dos242full.zip of FPC and will be installing that to another directory on the OS/2 box... then it should be a simple matter of copying the project to another directory in there and giving it a kick in the arse to see what happens... hopefully i'll end up with a workable executable and my project with be, basically, at the end :) yeah, the above failed miserably... i didn't realize that LFNs were necessary and the DOS version on OS/2 simply cannot access OS/2 LFNs in any way shape or fashion at all... I'd recommend using the OS/2 target directly in your case; OS/2 straight? not the OS/2 w/ EMX?? it really doesn't matter to me as long as i end up with a working executable for the task at hand... there are surely areas / functionalities which are better supported on the GO32v2 target (unit graph coming to my mind as one particular example), but I don't think that your project should really need those. you are absolutely 1000+% correct on that... there's nothing visual... the tool is fired from a console command line... there's little to no output (unless i decide to add some for logging purposes)... and, lastly, the tool is doing nothing more than extracting a/the text/plain MIME section(s) from messages saved as text files... the only other thing the tool is doing is converting "characters" like the trademark symbol from their unicode(???) character back to the old DOS 8bit/7bit old school alternative... ie: the trademark symbol is located as the "= 9 9" (spaced to prevent conversion) MIME text in the message body and converted to "(tm)" which any old DOS 3.x can understand :) let me fix up a few things and i'll post another message, in the list or privately, containing my current code... i'll also try to bang up the error messages from the attempts to compile to the OS/2 (native) target... thanks for your interest and assistance! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] help with synapse mime routines...
On 2/17/2011 18:16, Kevin Jesshope wrote: [TRIM] I think I have that right. I am working from memory now as I do not have the code before me. i wanted to thank you again.. you gave me some hints that enabled me to propel myself much further than i've gone in the last week of floundering... in fact, i've reverse my flow process somewhat and now have a working win32 tool... YAY! but the real destination platform is OS/2, OS/2 EMX or "pure" DOS on OS/2... my next problem is to get it compiling on my OS/2 box with FPC 2.4.2 and so far, that is not working... complaints of missing units and include files that i just don't know where to tell the compiler to look for... my development has been on a winXP box with the FPC 2.4.3 code pulled from SVN along with Lazarus code... however, i've not been working in the Lazarus environment at all... i pulled this and compiled it by following the instructions on the FPC wiki... on my OS/2 box, i've tried targets of OS2 and OS2 with EMX but both have failed all kinds of ways... i suspect that it is simply to do with the paths to the units and include files... i have been able to get something going somewhat but then run into masses of "duplicate identifier" errors... i'm just not sure where to turn now so out of frustration, i'm now pulling down the dos242full.zip of FPC and will be installing that to another directory on the OS/2 box... then it should be a simple matter of copying the project to another directory in there and giving it a kick in the arse to see what happens... hopefully i'll end up with a workable executable and my project with be, basically, at the end :) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal