Re: [fpc-pascal] Calculating Pixels to represent 3D coordinates

2019-09-17 Thread Gustavo Enrique Jimenez
A simple transformation is:

P3D=(X,Y,Z)
P2D=(x,y)

x=X+Y*0.707
y=Y*0.707+Z

I did not tried it, but I think that this is the transformation that
you are looking for.


Gustavo

El mar., 17 sept. 2019 a las 17:37, James Richters
() escribió:
>
> >What exactly are you trying to do? Usually if you’re doing 3D this all 
> >happens on the GPU and you get back a color/depth buffer. Maybe you need to 
> >know where a 2D coordinate is in 3D space?
>
> What I'm trying to do is much simpler than rendering a 3D object..  All I'm 
> trying to do is display a 3D line drawing or wireframe on the screen.  I 
> don't need it to dynamically rotate or anything, and it doesn't need to show 
> any surfaces, textures, lighting, reflections, or shadows, just give a 
> representation of the XYZ points and lines connecting 2 pair of XYZ 
> coordinates on the screen.   The purpose of this is to show a 3D 
> representation of a CNC tool path including the Z movements.
>
> James
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] libmosquitto headers for FPC

2019-03-14 Thread Gustavo Enrique Jimenez
El jue., 14 mar. 2019 a las 13:14, Karoly Balogh (Charlie/SGR)
() escribió:
>
> Hi,
>
> Not sure if anyone have done this already, but I converted the
> libmosquitto (which is a C-written MQTT client library) header
> (mosquitto.h) to Free Pascal, so it allows using libmosquitto from Pascal
> code. I work on some IoT projects lately which transfers data over MQTT,
> and I wanted to write some of the code in Pascal (after some other
> languages failed to meet expectations, business as usual), so I just did
> it. I know some Pascal MQTT libraries exist, but all I encountered seemed
> to have some limitations, or things I didn't like (being too Delphi
> centric, or something) and libmosquitto just seems to be much more used.
>

Thank you very much!

Gustavo


> Note this is only a pure conversion of the C header file using ctypes,
> with some pascalisms added (like proper callback function types). I have
> an additional class-layer on top of it planned, but so far I only got the
> headers converted, but they work in our internal project. I want to add
> some examples later too.
>
> So in case anyone needs this:
>
> http://github.com/chainq/mosquitto-p
>
> As we hopefully will soon use this in production, I sort of committed
> to keep the headers up-to-date.
>
> I tested it on Darwin (x86_64) and Linux (x86_64 and arm), but adding
> Windows support should be trivial. (Probably only needs the right .dll
> name added as linklib, or something.)
>
> Charlie
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Raspberry Pi

2015-02-13 Thread Gustavo Enrique Jimenez
Thank you very much to all Freepascal and Lazarus developers. Today I
was able to compile all my applications within Raspberry Pi. I am
very happy. Many thanks to everyone for this amazing tool that you
gave to the world.


Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Gustavo Enrique Jimenez
Hi:

 I send cookies to the client. One of those cookies is a sessionID,
a random number generated at login.
 My sequence is something like

Login
Client: username/password -Login html button
Server: run cgi app with username/password parameters - ¿Valid user?
-  generate sessionID, store in DB. Send sessionID to the client as a
cookie.

Transaction
Client: Product - Search product html button (sessionID is also sent
to the server)
Server: run cgi app with product/username parameter. sessionID is
implicit, as any cookie. if username/sessionID from the client is the
same as in the DB, send data to the client.

The sessionID cookie will remain until logout or expire time. This
way, you don't have to store password in html. The sessionID cookie
must be random+hash, unique to every session. sessionID is sort of
temporal password.

Cliente: username  - Logout html button
Server: run cgi app with username/sessionID. Verify
username/sessionID, then send an empty sessionID cookie (this will
delete the sessionID cookie in client)

Gustavo



2011/8/1 Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com:
 Hello,

 This is kind of a theorical question, but I though I'd ask before
 starting to code =)

 Basically I have a desktop app which I need to retrofit into a
 web-app. My idea is to cut it in a visual and a non-visual part and
 implement the visual part in HTML+JavaScript and keep the non-visual
 like it is now, in Pascal.

 So, the problem is that CGI apps are started for every request, correct?

 So how should I proceed to obtain a application which will keep
 running for the entire session of a user? I don't want to simply save
 session info because the application is rather large, there are lots
 of things going on and it would be much easier for my coding if I
 could keep the program running on the web server ...

 Any ideas?

 thanks,
 --
 Felipe Monteiro de Carvalho
 ___
 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] web app and application persistency

2011-08-01 Thread Gustavo Enrique Jimenez
Hi:

  If you don't want to use cookies, you could write the sessionID in a
hidden field in every html form (cgi app must write this hidden field
in every form). Or, if you use ajax, you could attach the sessionID to
every link (cgi app must write the sessionID parameter in every link).

Gustavo


2011/8/1 Gustavo Enrique Jimenez gejime...@gmail.com:
 Hi:

  I send cookies to the client. One of those cookies is a sessionID,
 a random number generated at login.
  My sequence is something like

 Login
 Client: username/password -Login html button
 Server: run cgi app with username/password parameters - ¿Valid user?
 -  generate sessionID, store in DB. Send sessionID to the client as a
 cookie.

 Transaction
 Client: Product - Search product html button (sessionID is also sent
 to the server)
 Server: run cgi app with product/username parameter. sessionID is
 implicit, as any cookie. if username/sessionID from the client is the
 same as in the DB, send data to the client.

 The sessionID cookie will remain until logout or expire time. This
 way, you don't have to store password in html. The sessionID cookie
 must be random+hash, unique to every session. sessionID is sort of
 temporal password.

 Cliente: username  - Logout html button
 Server: run cgi app with username/sessionID. Verify
 username/sessionID, then send an empty sessionID cookie (this will
 delete the sessionID cookie in client)

 Gustavo



2011/8/1 Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com:
 Hello,

 This is kind of a theorical question, but I though I'd ask before
 starting to code =)

 Basically I have a desktop app which I need to retrofit into a
 web-app. My idea is to cut it in a visual and a non-visual part and
 implement the visual part in HTML+JavaScript and keep the non-visual
 like it is now, in Pascal.

 So, the problem is that CGI apps are started for every request, correct?

 So how should I proceed to obtain a application which will keep
 running for the entire session of a user? I don't want to simply save
 session info because the application is rather large, there are lots
 of things going on and it would be much easier for my coding if I
 could keep the program running on the web server ...

 Any ideas?

 thanks,
 --
 Felipe Monteiro de Carvalho
 ___
 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] One experience with the unit serial

2009-11-19 Thread Gustavo Enrique Jimenez

 Thank you for your answer. I played with different baud rates. The sender
 delivers a stream of bytes. The faster a transmission rate is, the less
 amount of data can be received. This leds me to two conclusions: At first,
 there must be a queue for incoming data despite I ruled out a queue with an
 inbuffer with the length 1. Secondly, a timeout error appeared, the sender
 gave up. For now, I try to solve this problem with slower baud rates. Since
 iopl is still not available to fpc in its 64-bit-version, I should move to c
 for future port programming.

Despite queues an baud rates, you must expect data loss.  You will
loss data in the physical layer. You have to implement some handshake
to prevent it. (using google translator, excuse my english).


Gustavo


 For that matter it could be interesting to know two more things: How can I
 call external executable code like setserial /dev/ttySx none and secondly,
 how can I use c functions like pascal functions?


 Are you sure you have data waiting for you?

 Yes.

 Holger

 ___
 fpc-pascal maillist  -  fpc-pas...@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] One experience with the unit serial

2009-11-19 Thread Gustavo Enrique Jimenez
2009/11/19 Holger Bruns holger.br...@gmx.net:
 Gustavo Enrique Jimenez schrieb:

 Thank you for your answer. I played with different baud rates. The sender
 delivers a stream of bytes. The faster a transmission rate is, the less
 amount of data can be received. This leds me to two conclusions: At
 first,
 there must be a queue for incoming data despite I ruled out a queue with
 an
 inbuffer with the length 1. Secondly, a timeout error appeared, the
 sender
 gave up. For now, I try to solve this problem with slower baud rates.
 Since
 iopl is still not available to fpc in its 64-bit-version, I should move
 to c
 for future port programming.


 Despite queues an baud rates, you must expect data loss.  You will
 loss data in the physical layer. You have to implement some handshake
 to prevent it. (using google translator, excuse my english).


 Gustavo



 Which can be done through a direct port access and some lines of code in
 assembler language. The second idea I have is the use of the device files
 /dev/ttySx, but how can these files be used to get access to all of the
 registers of an uart?

 Holger

Did you try Synaser? http://www.ararat.cz/synapse/doku.php/download .
I use it on all my projects since 2006 without problems (linux,
windows, etc...).

Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] One experience with the unit serial

2009-11-19 Thread Gustavo Enrique Jimenez
2009/11/19 Marco van de Voort mar...@stack.nl:
 In our previous episode, Gustavo Enrique Jimenez said:
 Did you try Synaser? http://www.ararat.cz/synapse/doku.php/download .
 I use it on all my projects since 2006 without problems (linux,
 windows, etc...).

 How do you use it? I'm used to TComport, and it seems that synaser, like
 unit serial, only supports blocking use.

 Do you put it in a thread?

 I need it for a link that receives and sends at random, not related moments.


Well, never used it in a thread. Only with handshake or free-running
streams. I understand now why synaser could be useless in some
situations.

Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] x86.pp and oldlinux.pp

2009-11-03 Thread Gustavo Enrique Jimenez
2009/11/3 Holger Bruns holger.br...@gmx.net:
 Jonas Maebe schrieb:

 And regarding your later remark about FPC only being usable as root: it's
 the Linux kernel that only allows direct port access by root. Please stop
 blaming every single one of your problems on the compiler or the RTL.

 Under the bottom line, the result is just the same. You need to become a
 superuser on a linux system, if you want to compile source code for
 accessing ports directly, regardless of the compiler or any other tool. This
 is not blaming your software as faulty, it's just a remark on a linux
 restriction. Secondly, having problems with a programming language is not a
 sign for a bad compiler. One can misunderstand some expressions, can produce
 errors, needs to learn more about programming. I do not blame your work, I
 appreciate it instead, and I am using fpc. I am pretty sure, the longer I
 work with it, the more I shall become familiar with it. Todays pascal is far
 more advanced than turbo pascal from Borland or UCSD pascal on the old Apple
 II, and now I have to learn pascal just as a programming language, which I
 would see the first time in my life.

 Holger

If you need to be root to run or compile your program, then you don't
understand the underlying operative system. Please, take a look at how
devices works in linux, or take a look at this
http://www.linuxjournal.com/article/2114 . Linux is not DOS, you can't
just write to ports.

Accessing serial ports in linux could be as simple as to write/read
to/from /dev/ttySx . You don't need io ports. For a multiplatform
solution, use synapsis/synaser.

Gustavo

ps: Excuse my english. Helping you is very hard: you don't listen.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access to RS232 ports with fpc

2009-11-02 Thread Gustavo Enrique Jimenez
 No, the 1000 means the size of a buffer, not a part address. The port
 address I try to use is 0xEC00, which is the base address for an UART on a
 PCI card. Linux sees this UART as /dev/ttyS2. Accessing the registers
 direcly should be easy, because 3 lines of assembler code should do this
 job:

 function readport (portaddress: word): byte;
 begin
 asm
  mov %dx, portaddress
  inb %al,%dx
  mov readport, %al
 end
 end;

 As long as the pascal syntax and the assembler syntax (instruction
 destination source) are both correct for fpc, this function should return
 the value of the selected port. This is all, what I try to do.


 Best regards, Holger


Just user synaser,  http://www.synapse.ararat.cz/ . When you get the
thing working, go back to the serial unit. I do SCADA with Modbus
through serial port. Never had a problem.
You can't write programs in linux (or windows) like in DOS.

Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Division by Zero: EDivByZero and EZeroDivide

2009-10-19 Thread Gustavo Enrique Jimenez
2009/10/18 Tom Verhoeff t.verho...@tue.nl:
 A simple example is the situation where one needs to calculate
 the replacement resistor value R for parallel resistors having
 values R1, R2, ..., Rk.  The formula is R = 1/(1/R1 + 1/R2 + ... + 1/Rk).
 The formula gives a divide-by-zero if one of the resistors has value 0.
 But in that case, the replacement value R also equals 0.  When allowing
 infinities, it just works out fine (infinity + x = infinity, 1/infty = 0).
 That is precisely why IEEE 754 has infinities.  Also see

        http://www.cs.berkeley.edu/~wkahan/ieee754status/why-ieee.pdf

 for other examples and further motivation.

Mmm... the formula R = 1/(1/R1 + 1/R2 + ... + 1/Rk) is only valid if
none of Rn=0.
Programmers can and must take care of that situation.

Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Who said Pascal isn't popular

2009-10-12 Thread Gustavo Enrique Jimenez
2009/10/12 Rainer Stratmann rainerstratm...@t-online.de:
 Am Montag, 12. Oktober 2009 11:02 schrieb Jürgen Hestermann:
  Remember, Pascal is merely a TEACHING language, unsuitable for commercial
  software development, which is why we have C.  :)

 And why should that be the case? What are the outstanding feature of C
 that make it so supperiour? It's illogical and hard to maintain syntax?
 Or is it just that it was available for free on all unix systems?

 Yes, it is available everywhere.
 And it is easier to copy unix code then.

 Remember that it is still not easy to come to freepascal.
 You have to configure a debian testing system and apt-get lazarus and so on...
 Nearly nowhere the lazarus package is preinstalled.

You don't need Debian Testing. My system is Debian Stable (i386) since
2001/2002. Never have had a serious problem installing
Lazarus/Freepascal.

Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Who said Pascal isn't popular

2009-10-12 Thread Gustavo Enrique Jimenez
2009/10/12 Rainer Stratmann rainerstratm...@t-online.de:
 Am Montag, 12. Oktober 2009 16:21 schrieb Gustavo Enrique Jimenez:
 2009/10/12 Rainer Stratmann rainerstratm...@t-online.de:
  Am Montag, 12. Oktober 2009 11:02 schrieb Jürgen Hestermann:
   Remember, Pascal is merely a TEACHING language, unsuitable for
   commercial software development, which is why we have C.  :)
 
  And why should that be the case? What are the outstanding feature of C
  that make it so supperiour? It's illogical and hard to maintain syntax?
  Or is it just that it was available for free on all unix systems?
 
  Yes, it is available everywhere.
  And it is easier to copy unix code then.
 
  Remember that it is still not easy to come to freepascal.
  You have to configure a debian testing system and apt-get lazarus and so
  on... Nearly nowhere the lazarus package is preinstalled.

 You don't need Debian Testing. My system is Debian Stable (i386) since
 2001/2002. Never have had a serious problem installing
 Lazarus/Freepascal.

 How do you install Lazarus/Freepascal with apt or else?
 I am a friend of userfriendly software...


Download fpc-2.2.4-3.i386.deb.tar and lazarus_0.9.28-0.i386.deb.tar

tar -xf *.tar
dpkg -i *.deb  - as root

Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] A question or two regarding the FPC

2009-05-08 Thread Gustavo Enrique Jimenez
Hi Nino:

 I am using FPC since 2000-2001. I use it for data aquisition and
temperature control. Console programs compiled with FPC 1.x work for
days, even weeks. In the Laboratorio de Física del Sólido, Tucumán -
Argentina (Solid state physics laboratory) we have used programs
compiled with FPC to grow YBACuO superconductor crystals. This process
take weeks.
 This heat treatment is the only mission critical application that I
know well, and FPC works reliably, even for weeks, on linux machines.

Gustavo

ps:excuse my english


2009/5/8  fpcl...@silvermono.co.za:
 Hi guys,

 Over the last few years, I have written hundreds of thousands of lines of
 object pascal code that compiles successfully using the FPC and Delphi. To
 date, I have not encountered any problems with the code generated by the
 FP Linux compiler. I don't have much experience with FPC within the MS Windows
 environment as my current interest lies in developing console Linux apps.

 Like most developers, I strive to write code that is as bug free as possible
 and at the end of each day, I'm left with a feeling of great satisfaction and
 achievment.

 IMO and experience, the code generated by the FPC is as resilient as the
 operating system it runs on.

 My question is directed to the FPC team and in particular, to those involved
 in the development of the compiler and more specific, the Linux compiler. (I
 would expect that Florian would have a say here).

 In your opinion, how would you rate the suitability of the FPC generated code
 for use in an environment where there is near zero tolorance to failure?
 Consider the question assuming that the ideal condition where that the source
 code is as close to being perfect as possible, (and I'm not suggesting that
 this perfect code would be written by me. I'm not that good).

 Where am I going with this question you might ask? Well, what is the
 difference with say, the code generated by an ADA95 compiler and that
 generated by the FPC. Perhaps someone out there might know. What determines
 the robustness of the generated code? Could the FPC be rated by some
 authority as being able to generate code of some world defined standard?

 I know that if I were to manufacture a device or appliance that was controlled
 by FPC code and the device, say a home alarm system, functioned as designed
 and as specified, then the fact that the device is controlled by code
 generated by the FPC would be irrelevant. However, if the device were designed
 to control the laser beam that reshapes a human cornea (eye), then the
 compiler and operating system is of relevance. (The possibility of someone
 using MS Windows CE and Micro .NET comes to mind).

 In conclusion, perhaps somebody has already had similar thoughs with regards
 to the above question(s) and has some answers. Would be cool to have the FPC
 team's sincere thoughs on the above.

 Keep up the good work guys and thanks for a superb compiler (and RTL - of
 course).

 Regards,
 Nino

 ___
 fpc-pascal maillist  -  fpc-pas...@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] XML files and the ext4 bug

2009-03-12 Thread Gustavo Enrique Jimenez
Ok, thanks for all your replys !

I will take more care with my xml files.

Gustavo



2009/3/12 Jonas Maebe jonas.ma...@elis.ugent.be:
 Michael Van Canneyt wrote on do, 12 mrt 2009:

 On Thu, 12 Mar 2009, Florian Klaempfl wrote:

 Journaling means only: the file system is always in an internally
 consistent state It does not mean that it doesn't lose data!

 In this definition, yes.

 Well, that is the only definition of file system journaling I know of.

 But I find that rather limited :-)

 It is much better than the previous situation where losing power could mean
 that your entire partition would become unreadable (due to a corruption of
 the inode indexes/file allocation tables/b-trees/...).

 It's of course not a substitute for backups or versioned file systems.


 Jonas

 
 This message was sent using IMP, the Internet Messaging Program.

 ___
 fpc-pascal maillist  -  fpc-pas...@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] XML files and the ext4 bug

2009-03-11 Thread Gustavo Enrique Jimenez
Hi

Seems like the ext4 file system has a bug or some issue with files
updated often :

https://bugs.edge.launchpad.net/ubuntu/+source/linux/+bug/317781

I use XML files heavily. It is great, XML units save me a lot of work
! My programs update de xml files quite often.

I am concerned about this particular ext4 bug. Could you say if
freepascal's XML units are affected by this bug ? ext4 developers
recomend this :

https://bugs.edge.launchpad.net/ubuntu/+source/linux/+bug/317781/comments/54

Thanks in advance

Gustavo

ps: excuse my english
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-05 Thread Gustavo Enrique Jimenez
2008/10/4 Antal [EMAIL PROTECTED]:
 You might use the CSV, which can be easily open with Office and to generate
 by your application.
 I am using this way to handle data to/from excel
 It is a plain text file, each row is separated with CRLF (#13#10), each cell
 separated with tab (#9)
 Also, if you'r data has no comma or  then you can use the real CSV, because
 CSV means Comma Separated Values :)
 But the tab separated one can be easily pasted to/from Excel, by using let's
 say notepad.
 You can experience this, since each Office behaves differently with the CSV.


CSV works. HTML also works. With HTML you could set colors and sizes
to the cell. But this method does not have the same behavior among
Excels and Open Office.

I will try Felipe's unit.

Gustavo





 2008/10/4 Francisco Reyes [EMAIL PROTECTED]

 Searched, but could not find, a library/unit for creating spreadsheets.
 XLS, open doc.. or anything that would allow to create spreadsheet tabs to
 later on open with Excel.

 Trying to see if there is one before trying to create one.
 ___
 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] Binary compatibility between Intel CPU and PowerPC CPU

2008-09-16 Thread Gustavo Enrique Jimenez
2008/9/16 Adriaan van Os [EMAIL PROTECTED]:
 Roland Turcan wrote:

 Hello FPC-Pascal users discussions!

 What is the best way to keep the binary compatibility among different
 CPU architectures.

 I need to make our own database engine compatible and other binary
 files, that user still can use our data from i386 or PowerPC computer.

 I really don't like the idea to change the order of all numeric
 variables on PowerPC, because it costs time of CPU.

 There must be easier way how to keep the compatibility.

 Could you give me some hints for better solution.

 Whether you like the idea or not, the best way is as follows:

 - add a byte to the header of source data that indicates the endianness,
 high-endian for PowerPC, low-endian for i386
 - perform byte swapping if the endianness of source data is different from
 the endianness of the current CPU

 With source data I mean
 - reading files
 - reading data over a network

 This is best built-into a streaming toolbox, so that it happens
 automatically.

 Adriaan van Os

Don't forget to use packed records (see the Free Pascal Language
Reference Guide). I've used binary files in that way across linux and
windows machines (x86).

Gustavo
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] writeln in fpc 2.0.2

2006-05-30 Thread Gustavo Enrique Jimenez

I use Lazarus. So, I've upgraded fpc from 1.0.10  to 2.0.2  .

I've recompiled my cgi apps, and now something is wrong: lines with
more than 80 char writed with writeln seems to be truncated at
position 80. A #10 char follows, an then the rest of the line.

If I send the output to a text file, calling my app within a console,
lines seems to be ok (they are not truncated). But when I see the
source code of the html page returned by my cgi app, they are
truncated.

is it possible tha writeln is truncating lines with more than 80
chars, adding an extra #10 char in byte 80 ?

My system is : fpc 2.0.2, Debian Sarge on pentium.

Thanks in advance !! (excuse my english)


Gustavo Enrique Jiménez

ps: Deep in the code, it is possible that crt unit is still linked
(the cgi app comes from an old turbopascal console app). Also, I use
oldlinux unit instead of baseunix, unix, linux units .
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] writeln in fpc 2.0.2

2006-05-30 Thread Gustavo Enrique Jimenez

You MUST remove the CRT unit.
It's mentioned explicitly in the documentation that you are not allowed to use 
it for CGI.



ok !

I will remove crt references.

Sorry for not read the docs 

Thank you very much (Marco and Michael)... 

Gustavo Enrique Jiménez
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] writeln in fpc 2.0.2

2006-05-30 Thread Gustavo Enrique Jimenez

 You MUST remove the CRT unit.
 It's mentioned explicitly in the documentation that you are not allowed to 
use it for CGI.




I've removed all crt references. My cgi app works perfectly now. As an
unexpected  side effect, this app works perfectly also with Apache for
windows.

Thank you, thank you, thank you. I am VERY HAPPY with freepascal... !

Gustavo Enrique Jiménez

ps: every time I change the compiler, my apps get better and better.
Bugs shows up, and I have to split my units in core functions, gui
functions and OS specific functions. This is very good for
multiplatform programming.

FreePascal is not only a great programming tool. It is a also a great
LEARNING tool !!!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal