[fpc-pascal] AggPas / PTCGraph dynamic memory allocation
I've been trying to figure out how to dynamically allocate memory to be used as a screen buffer to display AggPas generated images with PTCGraph. I don't want it hard coded because I do not know what resolution monitor is going to be used. Here is where I am at: I can define a static variable like this: Const RGB_Width = 2; Buffer_Width=1920; Buffer_Height=1280; Type TGraphBitmapBuffer=packed record width, height, reserved: LongInt; data: array[0.. (Buffer_Width+1) * (Buffer_Height+1)] of word; // I don't know why I need the +1's but it won't work without them End; Var graph_buffer: TGraphBitmapBuffer; Then I attach it to AggPas with: agg^.attach(@graph_buffer.data, graph_buffer.width, graph_buffer.height, - graph_buffer.width * RGB_Width); Then I put it on the screen with: PutImage(0,0,graph_buffer,NormalPut); I should point out that I like to do this: Original_screen:=graph_buffer; to save my screen then put new stuff on it, then just copy back the original and putimage it back when I'm done. So I need a solution that will allow me to do this. I also don't always use the whole screen, sometimes I just want to getimage a little area, and putimage that back... but I don't know the size of these areas... they are calculated based on the resolution of the monitor and various settings and configurations. Here is where I am at with my attempt to make the memory dynamically allocated: I can use a dynamic method with PTCGraph with getimage and putimage But if I allocate memory this way, while it works fine with getimage and putimage, I can't figure out how to use it with AggPas because the first 3 words are not part of the bitmap data... It seems like there should be a way to make this work but the solution eludes me. I've been trying to come up with a way to do *something* like this: Var graph_buffer: Pointer; Max_X, Max_Y: Word; Max_X:=1920; //these will be detected by PTCGraph... Max_Y:=1280; Size := ImageSize(0, 0, Max_X-1, Max_Y-1); GetMem(graph_buffer, Size); GetImage(0, 0, Max_X-1, Max_Y-1, graph_buffer^); agg^.attach(@graph_buffer[12], Max_X-1,Max_Y-1, -(Max_X-1) * RGB_Width); //graph_buffer[12] is to skip over the 3 longints 4 bytes each PutImage(0,0,graph_buffer^,NormalPut); The problem is with Agg^.attac() of course now graph_buffer isn't an array anymore... so what I have won't work and I haven' figured out how to attach AggPas at a position where the bitmap data is so I can use PutImage and still have the Longints that were put in by GetImage. Any advice is greatly appreciated James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MINIX 3 support
On 2017-11-10 09:36, Mark Morgan Lloyd wrote: Interesting question, particularly now that it's being factory-installed:-) Yeah. :) I've been reading the Wikipedia page about MINIX 3 and it sounds quite impressive, and some really interesting design choices (self-healing, lower priority of infinite loop code etc). Sounds like it can be a very stable platform. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
In our previous episode, Marco van de Voort said: > > > fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64. > > > > Besides the language - fpc and lazarus are so cool tools! > > and fpc -V-1.0 calls ppc386-1.0 etc etc :-) Whoops, that should be -V1.0 of course. The idea is that you can give releases suffixes, though that is mainly useful for different versions (since then you can each version share a fpc.cfg using version #ifdefs) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
In our previous episode, Marc Santhoff said: > > fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64. > > Besides the language - fpc and lazarus are so cool tools! and fpc -V-1.0 calls ppc386-1.0 etc etc :-) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
On Fr, 2017-11-10 at 19:07 +0100, Mattias Gaertner wrote: > On Fri, 10 Nov 2017 18:57:19 +0100 > Marc Santhoffwrote: > > >[...] > > > You can either use fpc and switch the target OS and /or processor. > > > > That solution isnt't doable, that would require a compiler for X86_64 > > and ARM. > > fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64. Besides the language - fpc and lazarus are so cool tools! Thank you, Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
Am 10.11.2017 18:59 schrieb "Marc Santhoff": On Fr, 2017-11-10 at 18:22 +0100, Karoly Balogh (Charlie/SGR) wrote: > Hi, > > On Fri, 10 Nov 2017, Marc Santhoff wrote: > > > What is that, is ppc used for bootstrapping the cross compiler > > regardless of any other fpc maybe installed? > > Yes. First that ppc gets built with the "other FPC" installed. Or you can > specify a startup compiler explicitly with FPC= argument to the make. It > doesn't even need the rtl or anything, just the "ppcXXX" native compiler. > > During the first round it builds this new native compiler + rtl which will > be used to bootstrap the actual crosscompiler then. Ok. So I have a newer compiler for the base system built on the fly, nice. Not really, because only the compiler and RTL are rebuild for the native system when cross building FPC, all the packages are still missing. So you nevertheless need to do a complete build for your host life you had done for your cross compilation target. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
On Fri, 10 Nov 2017 18:57:19 +0100 Marc Santhoffwrote: >[...] > > You can either use fpc and switch the target OS and /or processor. > > That solution isnt't doable, that would require a compiler for X86_64 > and ARM. fpc -Parm calls ppcarm, fpc -Px86_64 calls ppcx64. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
On Fr, 2017-11-10 at 18:22 +0100, Karoly Balogh (Charlie/SGR) wrote: > Hi, > > On Fri, 10 Nov 2017, Marc Santhoff wrote: > > > What is that, is ppc used for bootstrapping the cross compiler > > regardless of any other fpc maybe installed? > > Yes. First that ppc gets built with the "other FPC" installed. Or you can > specify a startup compiler explicitly with FPC= argument to the make. It > doesn't even need the rtl or anything, just the "ppcXXX" native compiler. > > During the first round it builds this new native compiler + rtl which will > be used to bootstrap the actual crosscompiler then. Ok. So I have a newer compiler for the base system built on the fly, nice. Thanks, Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
On Fr, 2017-11-10 at 18:25 +0100, Mattias Gaertner wrote: > On Fri, 10 Nov 2017 17:47:11 +0100 > Marc Santhoffwrote: > > > Hi again, > > > > (too many sub threads, answering here - thanks to all helpers!) > > > > OK, "$FPC -va | grep CPU" does the trick. If using the ppcrossarm: > > > > marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppcrossarm > > -va|grep CPU > > [0.004] Macro defined: CPUARMEL > > [0.004] Macro defined: FPC_CPUCROSSCOMPILING > > [0.004] Macro defined: CPUARM > > [0.004] Macro defined: CPU32 > > [0.004] Macro defined: CPUINT32 > > [0.020] interpreting file option "#IFNDEF CPUI386" > > [0.020] interpreting file option "#IFNDEF CPUAMD64" > > > > See, an arm compiler. But when using the ppc binary in the same dir it > > looks different. Here we go: > > > > marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppc -va | grep > > CPU > > What is ppc? > Where is fpc? That happens in the directory of a built but not yet installed cross compiler. The build command following those instructions: http://j-software.dk/stm32f103.php was: gmake clean buildbase installbase CROSSINSTALL=1 CROSSOPT="-XParm-elf-" OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m PREFIX=../../fpc-arm IIRC. But actually the path from the PREFIX does not exist. Sth. to investigate or redo for me. > > > Next question is how to get started with lazarus and multiple compilers. > > How do you do it, using configuration files for lazarus and starting > > like "lazarus --primary-config-path= "? Or are there other > > possibilities to try? > > Lazarus supports multiple compilers. > You can either use fpc and switch the target OS and /or processor. That solution isnt't doable, that would require a compiler for X86_64 and ARM. > Or you can switch the compiler binary: Project / Project Options / > Compiler Options / Compiler Command. Replace the default > value '$(CompPath)' with the path. Aha, OK. > You can use build modes to switch with a mouse click between various > sets of compiler options. Beautiful, may take a while to get there, but very handy. :) Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
On Fri, 10 Nov 2017 17:47:11 +0100 Marc Santhoffwrote: > Hi again, > > (too many sub threads, answering here - thanks to all helpers!) > > OK, "$FPC -va | grep CPU" does the trick. If using the ppcrossarm: > > marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppcrossarm > -va|grep CPU > [0.004] Macro defined: CPUARMEL > [0.004] Macro defined: FPC_CPUCROSSCOMPILING > [0.004] Macro defined: CPUARM > [0.004] Macro defined: CPU32 > [0.004] Macro defined: CPUINT32 > [0.020] interpreting file option "#IFNDEF CPUI386" > [0.020] interpreting file option "#IFNDEF CPUAMD64" > > See, an arm compiler. But when using the ppc binary in the same dir it > looks different. Here we go: > > marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppc -va | grep CPU What is ppc? Where is fpc? > Next question is how to get started with lazarus and multiple compilers. > How do you do it, using configuration files for lazarus and starting > like "lazarus --primary-config-path= "? Or are there other > possibilities to try? Lazarus supports multiple compilers. You can either use fpc and switch the target OS and /or processor. Or you can switch the compiler binary: Project / Project Options / Compiler Options / Compiler Command. Replace the default value '$(CompPath)' with the path. You can use build modes to switch with a mouse click between various sets of compiler options. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
Hi, On Fri, 10 Nov 2017, Marc Santhoff wrote: > What is that, is ppc used for bootstrapping the cross compiler > regardless of any other fpc maybe installed? Yes. First that ppc gets built with the "other FPC" installed. Or you can specify a startup compiler explicitly with FPC= argument to the make. It doesn't even need the rtl or anything, just the "ppcXXX" native compiler. During the first round it builds this new native compiler + rtl which will be used to bootstrap the actual crosscompiler then. Charlie ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
Hi again, (too many sub threads, answering here - thanks to all helpers!) OK, "$FPC -va | grep CPU" does the trick. If using the ppcrossarm: marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppcrossarm -va|grep CPU [0.004] Macro defined: CPUARMEL [0.004] Macro defined: FPC_CPUCROSSCOMPILING [0.004] Macro defined: CPUARM [0.004] Macro defined: CPU32 [0.004] Macro defined: CPUINT32 [0.020] interpreting file option "#IFNDEF CPUI386" [0.020] interpreting file option "#IFNDEF CPUAMD64" See, an arm compiler. But when using the ppc binary in the same dir it looks different. Here we go: marc@puma:/home/marc/program/fpc-cross/src/fpc/compiler > ./ppc -va | grep CPU [0.008] Macro defined: CPUX86_64 [0.008] Macro defined: CPUAMD64 [0.008] Macro defined: CPU64 [0.008] Macro defined: CPUX64 [0.008] Macro defined: CPUINT64 [0.023] interpreting file option "#IFNDEF CPUI386" [0.023] interpreting file option "#IFNDEF CPUAMD64" What is that, is ppc used for bootstrapping the cross compiler regardless of any other fpc maybe installed? Next question is how to get started with lazarus and multiple compilers. How do you do it, using configuration files for lazarus and starting like "lazarus --primary-config-path= "? Or are there other possibilities to try? Marc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] WinHTTP.h Translation
2017-11-10 4:48 GMT-02:00 Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org>: > > Yes, unit WinHTTP in packages/winunits-base. > > This unit is missing in Lazarus setup. Thanks for the feedback. Regards ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MINIX 3 support
On 09/11/17 23:15, Graeme Geldenhuys wrote: Does FPC support the MINIX 3 target platform? Or has somebody attempted to port FPC to that platform? Interesting question, particularly now that it's being factory-installed :-) -- 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/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] installing cross fpc in parallel to systems fpc
In our previous episode, Marc Santhoff said: > > #ENDIF > > I see, so when using fpc for ARM these define is automatically set? > And would that be CPUAVR for Atmels chips? (easiest is to just fpc -va some dummy source and then grep for CPU, or look in the compiler sources (options.pas or systems/ iirc) You can select a different cpu then the default using fpc -P So if you have a x86 compiled fpc.exe, you can get it to select ppcx64 using fpc -Px86_64 and then e.g. -Twin64 for the target. Then all the relevant directives (CPU64, cpux86_64, win64, mswindows etc) are defined. (I use windows now because I know those defines by heart, for arm it is the same). The buildfaq (document section on the FPC site), though somewhat outdated, has some info and examples on this. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal