[fpc-pascal] Re: assign code to a method
El 18/02/2011 17:59, Andrew Haines escribió: From the other comments it seems like you are writing some assembly to memory at runtime then calling that code? That is right. If so then maybe the following can help you. ...code... so the usage would be like so function TTrampolineManager.GenerateCode(args: ): Pointer; begin try Result := CurrentBlock.Position; // = @Block + Block.Cursor repeat WriteData(your_data, size_of_data); until done; except on e: TrampolineBlockFullException do begin TrampolineManager.AllocateBlock; Result := GenerateCode(args); end; end; end; Hope this helps :) A lot! I understand that for purposes other than trampolining, the essence of this is the the way of building an almost contiguous list, say Block: array[0..lastCodePiece] of Pointer; of DEP executable codes inside an authorized chunk of memory, and that the call for assigning one of them, Block[i], to some function declared as otherObject.thisFunction(other args): Double; would be @otherObjectInstance.thisFunction:= Block[i]; And also the way to obtain another block when one of them has been exhausted, and the way of disposing of them, right? Many thanks, Andrew. I intend to apply this to my old programs in 32 bit Windows. I'll tell you about the outcome. -- montesin at uv dot es ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: assign code to a method
El 18/02/2011 13:46, Sven Barth escribió: I personally would say that mapping a page with the Execute flag set and storing the to-be-executed content there should be enough. After all JIT compilers must do that as well. ;) Thanks. I shall study this issue. -- montesin at uv dot es ___ 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 19 Feb 11, at 18:34, waldo kitty wrote: > 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 :) . . For information for the list - I managed to fix/hack the necessary Synapse units to allow building under OS/2. Some functionalities impose certain limitations (mostly due to stuff not available for the OS/2 target), but those should be no problem for the original poster considering his needs. The package (updated Synapse units) is too big for the list so I only sent it to the original poster privately. Tomas ___ 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] Name of the programming language used in/with FPC
On 08.02.2011 09:34, Ben wrote: > What is the programming language used in and with the Free Pascal Compiler? > > * Object Pascal > * Delphi > * Free Pascal > * Pascal How about calling it "Pascal", implicitly stating that Pascal nowadays is OO anyways, a fact that does not need to be mentioned separately, and also implicitly declaring the implementation of Free Pascal with all its features as the legitimate heir of any older Pascal and today's de-facto standard? Bernd ___ 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 19 Feb 11, at 14:53, waldo kitty wrote: > 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... 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. However, I guess that space trimming functions should be also available directly in platform independent parts of FPC RTL (strutils maybe)? Tomas ___ 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] Fingerprinting operation of a program
Tomas Hajny wrote: On Sat, February 19, 2011 15:18, Mark Morgan Lloyd wrote: Henry Vermaak wrote: On 18 February 2011 18:19, Mark Morgan Lloyd wrote: I need to trace through a program, running on two different systems which might or might not have the same OS, in order to find out where it's failing. . . Valgrind is probably what you need. It doesn't work on windows, but people use it with wine. Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up being a substantial amount of work for a one-off problem... FPP in particular since it requires Lazarus to build but I'm trying to debug part of the Lazarus build process (bug 0018600). I'm about to start inserting debug messages. I might be some time. One possible approximation may be to use the platform specific tools for tracing use of the platform APIs (I believe it's strace under Linux?) because it may provide some information even before adding the debug messages. Thanks Tomas, had occurred to me but I don't know what's available for Windows (and whether it would run on the old version I'm looking at). If I anticipated doing this regularly I think I'd look at modifying FPP to insert "entering" and "exiting" trace code. At a pinch something like kdiff3 would probably be able to make sense of a moderate-length output trace, but somewhere I've got a better text-comparison algorithm which would be more suitable. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Fingerprinting operation of a program
On Sat, February 19, 2011 15:18, Mark Morgan Lloyd wrote: > Henry Vermaak wrote: >> On 18 February 2011 18:19, Mark Morgan Lloyd >> wrote: >>> I need to trace through a program, running on two different systems >>> which >>> might or might not have the same OS, in order to find out where it's >>> failing. . . >> Valgrind is probably what you need. It doesn't work on windows, but >> people use it with wine. > > Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up > being a substantial amount of work for a one-off problem... FPP in > particular since it requires Lazarus to build but I'm trying to debug > part of the Lazarus build process (bug 0018600). > > I'm about to start inserting debug messages. I might be some time. One possible approximation may be to use the platform specific tools for tracing use of the platform APIs (I believe it's strace under Linux?) because it may provide some information even before adding the debug messages. Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Fingerprinting operation of a program
Henry Vermaak wrote: On 18 February 2011 18:19, Mark Morgan Lloyd wrote: I need to trace through a program, running on two different systems which might or might not have the same OS, in order to find out where it's failing. Before I start giving myself a gdb refresher course or manually inserting trace messages, is there any way that I can extract a trace of procedure entry/exits, preferably identified by name rather than by address, using e.g. profiling hooks? Valgrind is probably what you need. It doesn't work on windows, but people use it with wine. Thanks Henry and Sven. I suspect that both FPP and Valgrind will end up being a substantial amount of work for a one-off problem... FPP in particular since it requires Lazarus to build but I'm trying to debug part of the Lazarus build process (bug 0018600). I'm about to start inserting debug messages. I might be some time. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ 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 Sat, February 19, 2011 06:36, waldo kitty wrote: > On 2/18/2011 04:47, Tomas Hajny wrote: >> On Fri, February 18, 2011 02:24, waldo kitty wrote: . . > 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 Yes - unit dynlibs (loading of DLLs on demand) is not supported under GO32v2 for obvious reasons... > 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... Unit dynlibs is perfectly supported by the OS2 target, i.e. the error should not be the same. However, it's well possible that it fails at runtime at the same spot because it probably tries to load a library not available under OS/2. > 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. ;-) Tomas ___ 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 Sat, February 19, 2011 02:41, waldo kitty wrote: > On 2/18/2011 04:47, Tomas Hajny wrote: >> On Fri, February 18, 2011 02:24, waldo kitty wrote: >> 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 I should speculate, I'd guess for character set conversions. . . > 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 don't think that this should be a major problem in your case (you don't need any recent features probably ;-) ). >>> 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... Yes, that's a "feature" of the OS/2 virtual DOS machine (partly because this emulation is at MS DOS 5.00 level, long before W95 LFN API for DOS). >> 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... . . I mean the target 'OS2' (default with the OS/2 version of FPC 2.4.2). It still uses EMX binary format which also implies dependency on EMX.DLL, but it is based on native OS/2 APIs (as opposed to target EMX aka 'OS/2 via EMX' which is based on EMX runtime and allows building single executables running under both OS/2 and DOS natively as long as you restrict yourself to basic stuff like units System and DOS). However, target EMX does not really work at the moment, it would need some effort to make it up and running again. Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Handling recursive symlinks in Linux
On 19 Feb 2011, at 07:57, brian wrote: > I'm trying to convert a Delphi console-mode program which needs to walk > directory trees to FP **and Linux** - is there a standard way to detect and > handle recursive symlinks, if the user has been daft enough to create them? Many programs handle this by following symlinks only to a certain maximum depth. E.g., they print an error if they have followed 16 or more symlinks already. An alternative is to keep track of every directory you have traversed (or are traversing) already, and to skipping symlinks pointing to such directories. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Fingerprinting operation of a program
On 18 February 2011 18:19, Mark Morgan Lloyd wrote: > I need to trace through a program, running on two different systems which > might or might not have the same OS, in order to find out where it's > failing. > > Before I start giving myself a gdb refresher course or manually inserting > trace messages, is there any way that I can extract a trace of procedure > entry/exits, preferably identified by name rather than by address, using > e.g. profiling hooks? Valgrind is probably what you need. It doesn't work on windows, but people use it with wine. Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Fingerprinting operation of a program
On 18.02.2011 19:19, Mark Morgan Lloyd wrote: I need to trace through a program, running on two different systems which might or might not have the same OS, in order to find out where it's failing. Before I start giving myself a gdb refresher course or manually inserting trace messages, is there any way that I can extract a trace of procedure entry/exits, preferably identified by name rather than by address, using e.g. profiling hooks? You could try to compile your program using fpprofiler (it uses fpc in the background). See here: http://wiki.lazarus.freepascal.org/wiki/FPProfiler I've never used it before, but it might help you. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] help with synapse mime routines...
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, FPC doesn't atm). But OS/2 does have dlls, and afaik has unit dynlibs, so that is a bit strange. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Handling recursive symlinks in Linux
On Sat, 19 Feb 2011, brian wrote: I'm trying to convert a Delphi console-mode program which needs to walk directory trees to FP **and Linux** - is there a standard way to detect and handle recursive symlinks, if the user has been daft enough to create them? You can use faSymLink in FindFirst/FindNext to detect symbolic links (this works on windows as well) and then use fpReadLink (unit baseunix) to see where the link leads too. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal