Re: [fpc-pascal] Profiller for Mac OS X

2009-09-03 Thread Graeme Geldenhuys
Jonas Maebe het geskryf: > > What do you mean? You sometimes get loads of output highlighting several memory leaks. The backtrace information doesn't always lead tot he exact location where the memory leak was caused. That's the "hit and miss" I mentioned. Sometimes the backtrace is correct and s

Re: [fpc-pascal] Profiller for Mac OS X

2009-09-03 Thread Graeme Geldenhuys
Vincent Snijders het geskryf: > > It works only for memory allocated by the fpc heap manager, so a > winapi CreateWindow call, or a gtk gtk_button_new call would create Ah OK, I see what you mean. So does profilers like valgrind detect those? Regards, - Graeme - -- fpGUI Toolkit - a cross-p

[fpc-pascal] The names of the various FPC documentation

2009-09-06 Thread Graeme Geldenhuys
Hi, Maybe it's just me (please let me know if it is), but looking at the various FPC .pdf files in a folder, I am never sure which one I should open for whatever I am looking for. We currently have: ref.pdf user.pdf rtl.pdf prog.pdf fcl.pdf fpdoc.pdf Out of those 3 seems to have logi

[fpc-pascal] Printing the FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Hi, I'm all about saving the planet and saving our trees, but currently reading documentation on-screen (no matter how hard I try), is just not as comfortable as reading from a book. I don't have these $350+ eBook readers, so I can't comment on them with there e-Ink technology screens. Does any of

[fpc-pascal] RTL Contents pages have overlapping text

2009-09-07 Thread Graeme Geldenhuys
Hi, Considering that LaTeX does a really good job about text layout and styling, I was very surprised to notice the following issue in the RTL.pdf document. See attached image. The section numbers and section headings overlap each other in the Contents pages. Can this be fixed, or is it a bug in

Re: [fpc-pascal] The names of the various FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > If there is a more or less consensus about such things, I don't see why > we couldn't rename them. Glad to hear you are willing to consider this. ;-) > The names actually stem from the TP documentation, which was divided into 3 > books: > Language Reference

Re: [fpc-pascal] Printing the FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Marco van de Voort het geskryf: > > At the uni I had a big 5SI with a duplex unit, so printing double > sided in A5 format was easy. I usually didn't cut it though, just Our company has huge printers as well — they do everything but make coffee. Apparently that's an optional extra. ;-) We often p

Re: [fpc-pascal] Printing the FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Corrado Valeri het geskryf: > > I suggest the FPC dev team to consider the option to publish on lulu.com I actually thought this was done already. I searched the lulu.com website yesterday, but couldn't find any Free Pascal specific content. The problem I have with Lulu.com is that as far as I k

Re: [fpc-pascal] Printing the FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > Well, if there is enough demand, we could definitely consider this. Does it cost anything to become a publisher on lulu.com? I thought it's free and that you only need to upload the PDF document to them. Then they get a percentage from an actual sale. I didn't

Re: [fpc-pascal] The names of the various FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > Since you now discovered what each document describes, the problem has > solved itself :-) My brain is saturated with other information. By the end of the week I would have forgotten all this already. :-) To help myself, I locally renamed the PDF documents to

Re: [fpc-pascal] Printing the FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > Also, we'd need someone to design a cover for the books. > My graphical skills are worse than horrible :-) I saw they actually have a few cover templates one can use and a small cover wizard. I do not know how good the end-result is, but it should suffice in

Re: [fpc-pascal] RTL Contents pages have overlapping text

2009-09-07 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > Like I said, the FPC docs use LaTeX to the fullest... Can the contents be multi-column like the Delphi/Kylix documentation. This allow for more information being visible at once. I also don't know if it is needed to have the section numbers in the Contents pa

Re: [fpc-pascal] The names of the various FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Jonas Maebe het geskryf: > > For the Mac OS X releases, I rename them before packing the installer. > The names I use are: Much better names. :-) I think my main problem is distinguishing between the Programmers Manual and the Users Manual. See, I am both — so I never know which PDF to view fo

Re: [fpc-pascal] The names of the various FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Jonas Maebe het geskryf: > For the Mac OS X releases, I rename them before packing the installer. > The names I use are: > > Code Documenter.pdf > Compiler Switches.pdf > Free Component Library.pdf > Language Reference Guide.pdf > Programmer's Manual.pdf > Units Reference Guide.pdf > User's Manu

Re: [fpc-pascal] The names of the various FPC documentation

2009-09-07 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > Spaces and quotes are vetoed as a general rule :) Such an "old" file-system limitation does not apply in newer OS versions anymore. I must say, old habits die hard! :) I often find myself naming eBooks, TV series or music with underscores instead of spaces. Bu

[fpc-pascal] OS/2 INF help support

2009-09-08 Thread Graeme Geldenhuys
Hi, I know that the FP IDE (text mode) has support for reading OS/2 INF help files. This is pretty cool and it works with just about any INF file I threw at it. :-) I read my old VisualAge for C++ for OS/2 docs and it says that to generate a INF you need to create the help markup (similar to HTML

Re: [fpc-pascal] OS/2 INF help support

2009-09-08 Thread Graeme Geldenhuys
Marco van de Voort het geskryf: > > Or maybe because it cached the search index to disk, like most helpfiles. As far as I can see, from reading various INF docs is that the IFP Compiler generates the index and keywords at compile-time and are built into the single .INF files. Also every single wo

Re: [fpc-pascal] OS/2 INF help support

2009-09-08 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > I suppose you'd need the INF specs in order to make a compiler for it. The spec was never released by IBM as far as I know. But I see the Open Watcom project (actually one guy only - Lawrence Haynes) reverse engineered the IPFC compiler and rewrote a clean-roo

Re: [fpc-pascal] OS/2 INF help support

2009-09-08 Thread Graeme Geldenhuys
Tomas Hajny het geskryf: > I'm not aware of any IPF compiler apart from that one produced by IBM and Actually Lawrence Haynes, from the Open Watcom project re-engineered a clean-room implementation for the Open Watcom project. It is called 'wipfc' and source code is available. There now exists nat

Re: [fpc-pascal] OS/2 INF help support

2009-09-08 Thread Graeme Geldenhuys
Marco van de Voort het geskryf: > > That's something that CHM does too, and nearly any format. I'm talking about > when you press F1 in the IDE and those indexes must be combined in the IDE, With OS/2's help viewer I can do the following... view.exe lcl.inf rtl.inf fcl.inf It will then combin

Re: [fpc-pascal] OS/2 INF help support

2009-09-08 Thread Graeme Geldenhuys
Tomas Hajny het geskryf: > interesting/better than CHM nowadays (except for the fact that I'm not > aware of a CHM viewer for OS/2, which is an important downside for me Doesn't the 'lhelp' project, which is included with Lazarus IDE, compile under OS/2? Then again, does Lazarus actually run unde

Re: [fpc-pascal] OS/2 INF help support

2009-09-09 Thread Graeme Geldenhuys
Tomas Hajny het geskryf: > remembered it wrongly. I'm happy to be proven wrong. http://owbuilder.malakovi.cz/snapshot/ I downloaded the Linux IPF compiler from here... I don't know how recent that copy is though. > Simple pictures are certainly no problem (although I believe that the INF > form

Re: [fpc-pascal] OS/2 INF help support

2009-09-09 Thread Graeme Geldenhuys
Tomas Hajny het geskryf: > > Probably clear from the previous discussion in the meantime, but anyway - > neither LCL nor Lazarus itself have been ported to OS/2. Yup, sorry to hear that. I'll add OS/2 support as a feature request for fpGUI Toolkit. It's relatively easy to add new backends to fpGU

[fpc-pascal] Multi-Threading and usage of Semaphors under FPC

2009-09-11 Thread Graeme Geldenhuys
Hi, I had a previous discussion about Semaphores. Apparently my usage of them was not very good, because they were specific to the Linux system and Posix. Anyway, I was told it is better to use the ThreadManager. So how do I translate code as show below to using the FPC ThreadManager? I can see w

[fpc-pascal] Text IDE under Linux FrameBuffer

2009-09-13 Thread Graeme Geldenhuys
Hi, When I run the Text IDE under the Linux Framebuffer (fbdev), then the box drawing characters do not display correctly. Anybody know if there is a solution for this. The FPC Text IDE is not the only application with this problem. Midnight Commander does the same thing -- though the window / di

Re: [fpc-pascal] Text IDE under Linux FrameBuffer

2009-09-13 Thread Graeme Geldenhuys
2009/9/13 Nikolay Nikolov : > > Could you provide some more information? Which distro are you using? What's > your locale (i.e. the value of the LANG environment variable)? And which I'm using Ubuntu 8.04 and Ubuntu 9.04 on x86 hardware. If I run the Text IDE inside gnome-terminal, everything look

[fpc-pascal] GetLastOSError return values?

2009-09-14 Thread Graeme Geldenhuys
Hi, I'm using Linux. The online (html) help doesn't give any clue as to what the return values are for GetLastOSError(). Where can I find this information? Running out of options in the FPC code, I looked at MSEgui code. I found MSEgui uses the value 4 as an error and anything else as success. St

[fpc-pascal] $IF documentation - missing help

2009-09-15 Thread Graeme Geldenhuys
Hi, Where is the extended $IF directive documented. The prog.pdf has 2 paragraphs on $if and then referes you to the "conditionals" section. But the Conditionals section is incomplete. I look through all these docs... prog.pdf ref.pdf user.pdf What I am looking for is something I used years ag

Re: [fpc-pascal] $IF documentation - missing help

2009-09-15 Thread Graeme Geldenhuys
Marco van de Voort het geskryf: > > How to do this depends on how far back you want to support (1.0.x don't even > support $IF), and far into the future. FPC is free, so I only support up to the previous release. There should be no excuse not to upgrade (this is very different from Delphi). tiOPF

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Graeme Geldenhuys
Luca Olivetti het geskryf: > > There are some cross-platform synchronization classes in syncobjs > > http://www.freepascal.org/docs-html/fcl/syncobjs/index.html And I'm working on cross-platform semaphore classes / methods because the current ones in FPC are totally useless. Regards, - Graem

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Graeme Geldenhuys
Jonas Maebe het geskryf: > > I guess you mean that there aren't any :) True and False. :) It was recommended to me that I use the methods directly from the thread manager, then later it was not recommended. Plus the methods available from the thread manager doesn't support initial max values for

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Graeme Geldenhuys
Florian Klaempfl het geskryf: > > Hope you find a good cross platform solution :) So far I have single interface for create/destroy/lock/unlock of semaphores for Windows, Linux, *BSD. The latter two is actually for all unix with posix systems. So no more IFDEF's and specific uses clauses units in

Re: [fpc-pascal] Re: getting started with threads

2009-09-19 Thread Graeme Geldenhuys
2009/9/19 Micha Nelissen : > > A semaphore is not "locked" and "unlocked", it is posted and waited for. True, and to let it make even more sense (technically correct) one might have to use method names like deccount() / inccount() or grabitem() / releaseitem() etc etc... Either way, internal impl

Re: [fpc-pascal] Checking Linux process existence (child or not) without OS command ?

2009-09-21 Thread Graeme Geldenhuys
2009/9/21 Marco van de Voort : > > While it might work, it won't port well to other unices. Well, the original poster did mention a "Linux process", so there is probably no reason to port it to other unixes. Not all programs need to be portable to other OS's. Regards, - Graeme -

Re: [fpc-pascal] Compiling FPC itself with optimization

2009-09-24 Thread Graeme Geldenhuys
2009/9/24 Reimar Grabowski : > > Sometimes you are just too funny, Graeme. :-) Does FPC actually differentiate optimization between Core2 vs i7 vs Phenom etc? Or does it group those into something like optimization level 3 (just an example) and detect currently used CPU itself (if not specified l

Re: [fpc-pascal] How to build Nice and Convenient Console Menu ?

2009-09-28 Thread Graeme Geldenhuys
Tom__G het geskryf: > > Does anyone know how to build console menu, eg with highlight keys and > arrows navigations, like images below ? I agree with what Jonas said. I would also suggest the Free Vision classes (include with FPC) - same as what the textmode Free Pascal IDE is written in. I also

Re: [fpc-pascal] How to build Nice and Convenient Console Menu ?

2009-09-28 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > But they will not work on a secure shell session from one server to another > :-) I don't know, and actually don't care. :-) What I want to use it for is purely for installation/config style applications. The user will be in-front of that machine - in our scen

[fpc-pascal] String to PString assignment?

2009-09-29 Thread Graeme Geldenhuys
Hi, I'm converting a project from Sibyl (a old OS/2 IDE implement in SpeedSoft Pascal). Below is the code I'm trying to convert to Free Pascal. I see FPC has a PString type, but not FreePString() or NewPString(). Searching the FPC source code, I found the FP Text IDE using PString all over. The F

Re: [fpc-pascal] String to PString assignment?

2009-09-29 Thread Graeme Geldenhuys
No worries, I solved my problem by using AnsiString across the board. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist -

Re: [fpc-pascal] String to PString assignment?

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Marco van de Voort : > > If you want to ansistringify, assume that pstring as a whole is ansistring, > and remove all pointers and let ansistrings automatic maintenance work. Thanks Marco. That's what I did. I read bit more about PString and it seems pretty safe for me to simply replace

[fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
Hi, I'm still porting code from SpeedSoft's Pascal compiler. The code I am porting often uses MemCopy(), but Free Pascal doesn't seem to have such an implementation. So I looked at the next best thing... Move() But as the name suggests (...Move()...), I would have expected it to actually move the

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Marco van de Voort : > > No. So why is the function called MOVE instead of COPY? :-) I grep searched the *full* FPC source and found a implementation of MemCopy() in the packages/pasjpeg/* directory... So it seems to confirm what you (Marco) said. MOVE = MEMCOPY.It that case, M

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Michael Van Canneyt : > > Because move predates memcopy. memcopy is a windows function. > Move existed in the system unit of TP even before windows existed. Windows has 'memcpy()', not 'memcopy()' ;-) As for the origins of Move(), I can't comment except to say that the original au

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Florian Klaempfl : > > Because it doesn't copy your ram modules ;) Well, if I move something (no matter what it is), it doesn't exist in the original location any more. Hence my confusion about the Move() procedure. Regards, - Graeme - __

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Florian Klaempfl : > > Indeed, the serious answer is: > move handles overlapping memory blocks correctly (so the data might not > existing anymore at the old location), memcpy doesn't do this and screws > things up when handling overlapping blocks. This is why e.g. C++ has > memmove as we

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Graeme Geldenhuys : > > Could this "alias" procedure be applied somewhere in FPC?  This was > done before - the case of AssignFile() vs Assign() > > procedure MemCopy(src, dest: pointer; size: SizeInt); > begin >  Move(src^, dest^, size); > end; here

Re: [fpc-pascal] Move() vs MemCopy()

2009-09-29 Thread Graeme Geldenhuys
2009/9/29 Vincent Snijders : > > I never thought that > mov ax, bx (8086 assembler) > would clear the register after the move. If you put it like that, it never (for some strange reason) confused be either. :-) I guess that's probably because everything in assembler confused me, so nothing stood o

[fpc-pascal] X, Y co-ordinate system under OS/2

2009-10-07 Thread Graeme Geldenhuys
Hi, I'm porting an OS/2 application to Linux & Windows. From what I can see in the code, it looks like co-ordinates (0,0) is in the bottom left corner of the screen. Whereas Windows and Linux, co-ordinates (0,0) is in the Top Left of the screen. Is my assumption correct? If so, DAMN! This is go

Re: [fpc-pascal] X, Y co-ordinate system under OS/2

2009-10-08 Thread Graeme Geldenhuys
2009/10/7 Tomas Hajny : > > Yes, this is the case as far as I know (I haven't done any GUI programming > under OS/2 myself, but I know that this has always been one of the main > porting obstacles between Win32 and OS/2 at least). I suppose I can see the merits for using each of the co-ordinate sy

[fpc-pascal] Object instance is suddenly corrupt or of unknown type?

2009-10-08 Thread Graeme Geldenhuys
Hi, I'm using FPC 2.3.1 on a 64bit Linux system. I have a field variable which is an class instance. Many methods use this field variable and it's properties. I suddenly started getting Access Violations in my application. Adding that field variable to the Watch Window and stepping through my pro

[fpc-pascal] Re: Object instance is suddenly corrupt or of unknown type?

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Graeme Geldenhuys : > > Anyway what is the correct way of passing a class instance (object) to > methods? Maybe this is my problem? Actually, I don't think this is the issue. There was only two places in my code where I pass the FLayout instance to external procedures.

[fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
Hi, I enabled heaptrc and it reported on block of memory not being freed. I tracked it down to the following method in my code. I have tried everything I can think of, but the memory leak still persists. Could anybody help me please. A quick description of what this code does. I'm reading content

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Jonas Maebe : >>  SetLength(tocarray, _Header.ntoc); >>  p := _Data + _Header.tocoffsetsstart; >>  Move(p, tocarray, SizeOf(tocarray)); > > This has to be > > move(p^, tocarray^, length(tocarray)*sizeof(tocarray[0])); ^ This gives a compiler error. Illegal

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Jonas Maebe : > Also, as you can see the program does not really depend on the data being > actually stored in a dynamic array. So you could just as well use "tocarray: > ^Int32" and assign it the value of p (as you pretty much did until now). Ah! That is what I wanted to do in the first

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Vincent Snijders : > > Working with pointers, if you don't get it, maybe just use a loop. I have to admit. After working for so long with RDBMS API's, I got quite rusty with the more low level file reading, record structures and pointer arithmetic. Database desktop applications clearly

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Jonas Maebe : > > Also with understanding how dynamic arrays and/or move work. Dynamic arrays > are reference counted pointers to data blobs. sizeof(dynamic_array_var) = > sizeof(pointer), always, and regardless of the length of the array. It's > like sizeof(class) = sizeof(ansistring) =

Re: [fpc-pascal] Illogical automatic dereferencing

2009-10-10 Thread Graeme Geldenhuys
2009/10/10 Jürgen Hestermann : > > It is illogical that I am able to enumerate a pointer as if it was an array. > So the brackets do the dereferencing automatically. When I write X[1] it > assumes I meant X^[1]. To the user it behaves the same as if X was an array > instead of a pointer to an array

[fpc-pascal] Why use pointers to arrays?

2009-10-11 Thread Graeme Geldenhuys
Hi, The other "arrays" discussion got me thinking, and after working so long with only desktop type applications that talk to database API's, I long some knowledge of the lower lever Pascal features that was so often used in Turbo Pascal days. Anyway, I'm port an application that was written for

Re: [fpc-pascal] Illogical automatic dereferencing

2009-10-11 Thread Graeme Geldenhuys
On 11/10/2009, Henry Vermaak wrote: > > > > Sizeof(X) is 10 bytes. > > Sizeof(PX) is 4 bytes. > > > > Still you can use X[1] and PX[1]. That's illogical. > > > I've tested this now and could only get this behaviour with {$mode delphi}. So what did the other modes return? objfpc? -- Regar

Re: [fpc-pascal] Why use pointers to arrays?

2009-10-11 Thread Graeme Geldenhuys
On 11/10/2009, Andrew Brunner wrote: > FPC forces the ^ operator while accessing structures as pointers. > Delphi didn't force it and I even suspect that memory leaks can result > in NOT using the ^ to denote the reference to the pointer rather than > the pointer itself. This was just discuss

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

2009-10-11 Thread Graeme Geldenhuys
I came across this link by chance. Wow, I never knew there was that many Pascal Compiler implementations. A lot! http://pascaland.org/pascall.htm -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net

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

2009-10-12 Thread Graeme Geldenhuys
2009/10/12 Rainer Stratmann : > > Which editor do you use? I'm not the one you replied to, but I can answer based on my experience. I never use APT for FPC or Lazarus because they update packages to slowly. I work directly from the Git mirror repositories. * If I'm at work or home, I use Lazarus

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

2009-10-12 Thread Graeme Geldenhuys
2009/10/12 Marco van de Voort : >> >> Yes, it is available everywhere. > > Try compiling some Unix C code on Windows. > > Give me Free Pascal any time :-) +1 ...and Try compiling some Unix C code on Unix/Linux/etc. I always battle. Give me Free Pascal too! :-) PS: Wow, did this message thread

[fpc-pascal] Code conversion question - alloc and dealloc memory

2009-10-15 Thread Graeme Geldenhuys
Hi, I'm am having problems allocating memory and then populating that memory with a TFileStream.Read() call. So I thought, maybe my GetMem() call is incorrect. I then looked at the original code I am porting from, which had these methods instead. If I get this memory allocation correct, I'll see i

[fpc-pascal] New/Dispose vs GetMem/FreeMem

2009-10-15 Thread Graeme Geldenhuys
Hi, Which of these should I use in new projects? I read somewhere that GetMem/FreeMem is actually compatibility methods from Turbo Pascal days, yet I have seen lots of new code that uses it, so I guess it's still ok to use? I have various complex structured types and pointers to those types. Will

[fpc-pascal] Re: Code conversion question - alloc and dealloc memory

2009-10-15 Thread Graeme Geldenhuys
On 15/10/2009, Graeme Geldenhuys wrote: > > > function AllocateMemory( const Size: longint ): pointer; > > procedure DeallocateMemory( Var P: pointer ); OK, I managed to convert those two functions to the following.. it now compiles und

Re: [fpc-pascal] Code conversion question - alloc and dealloc memory

2009-10-15 Thread Graeme Geldenhuys
On 15/10/2009, Florian Klaempfl wrote: > > Yes (as long as you don't mess with internal heap structures ;)). OK, thanks. So that means I don't need to use the custom AllocateMemory() and DeallocateMemory() functions - no need to track the original size of memory allocated. -- Regards, - Gr

[fpc-pascal] What does TFileStream.Seek() return?

2009-10-15 Thread Graeme Geldenhuys
Based on the documentation shown here, it doesn't mention what the return value is. Anybody have a clue? http://www.freepascal.org/docs-html/rtl/classes/thandlestream.seek.html -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI to

Re: [fpc-pascal] What does TFileStream.Seek() return?

2009-10-15 Thread Graeme Geldenhuys
On 15/10/2009, Michael Van Canneyt wrote: > > The return value should be the new - absolute - position in the stream. > Ah, thanks Michael. Could the documentation be update with this information...? -- Regards, - Graeme - ___ fpGUI - a cross-

Re: [fpc-pascal] What does TFileStream.Seek() return?

2009-10-15 Thread Graeme Geldenhuys
On 15/10/2009, Michael Van Canneyt wrote: > > I already have put it in my queue... :-) Thanks. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ __

[fpc-pascal] pointer arithmetic help required

2009-10-15 Thread Graeme Geldenhuys
Hi, Sorry, I suck at this pointers think. Currently I am reading one record in correctly and from there is all corrupted data. :-( Seeing that the first block of data (pEntry^ below) is correct, it seems my problem is incrementing to the next block of data. Here are the various variables I am wor

Re: [fpc-pascal] pointer arithmetic help required

2009-10-15 Thread Graeme Geldenhuys
By the way, I am reading in the Table of Contents data for an OS/2 INF file. Martin wrote: >> > if pentry is > TEntry = record .. end; > pentry = ^ TEntry Yes, pEntry is a pointer to a structured type. pEntry: pTTOCEntryStart; The actual structure is as follows... -

Re: [fpc-pascal] pointer arithmetic help required

2009-10-15 Thread Graeme Geldenhuys
Martin wrote: > Graeme Geldenhuys wrote: >> By the way, I am reading in the Table of Contents data for an OS/2 INF file. >> >> >> >>>> // now increment pEntry to point to next data structure >>>> // below, .Length is in bytes >>>&

Re: [fpc-pascal] BNF grammar for fpc

2009-10-16 Thread Graeme Geldenhuys
2009/10/15 Marc Santhoff : > > is a complete grammar for fpc written in some variant of BNF available > somewhere? About 2 weeks ago, I had no clue what BNF was. Funny that you mention it, because I am working on a LaTeX converter to IPF. I was google'ing for a BNF for LaTeX, as a starting point.

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

2009-10-16 Thread Graeme Geldenhuys
2009/10/16 Jeff Wormsley : > > Its also a manpower issue, and the number one reason I make my living > writing C nowadays rather than Pascal.  You can post an ad for a C > programmer and get 1,000 applicants, if you post an ad for a Pascal Any programmer worth hiring should find it relatively easy

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

2009-10-17 Thread Graeme Geldenhuys
On 17/10/2009, Vinzent Hoefler wrote: > > Absolutely. But there's also the catch: With people only knowing C where > should this knowledge come from? Documentation. I have been programming solely in Object Pascal for the last 9 years. I dab in Java every now and again (but not for any productio

Re: [fpc-pascal] Thread Priorities - Linux

2009-10-20 Thread Graeme Geldenhuys
2009/10/20 : > > The comment on line 54 should perhaps be reworded to reflect that although > it's not implemented in the current release, the user is free to use the > values if he so wishes. It's not stupid, one never knows what the next guy > will do with ones code. It is mentioned in the docu

[fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
Compiling the project works fine under FPC 2.3.1 (linux 64bit), but running it, i get a EConvertError and I don't know why. I am telling sysutils what LongDateFormat is like, but it still fails. Any ideas? --- program project1; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDE

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > You make a common assumption, which is mistaken: > StrToDate(DateToStr(date)) generally does not work. Crap! And that is pretty much what the tiOPF unit test is testing for. So why is StrToDate() so different to Delphi? In Delphi, the above mentio

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt > > 1. StrToDate uses shortdateformat. > > 2. StrToDate DOES NOT use shortdateformat to check the actual format; >because it accepts only dates of the form N1/N2/N3 >- it uses ShortDateFormat ONLY to determine the order of y,m,d >- it uses DateSepar

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > It is documented: and the documented example "ex19.pp" causes the same error! -- $ cp /opt/fpcdocs_svn/sysutex/ex19.pp ex19.pas $ fpc ex19.pas Free Pascal Compiler version 2.3.1 [2009/10/08] for x86_64 Copyright (c) 1993-2009

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > Strip the time part. > > You are feeding a date/time pair to something that expects ONLY a date. Surely it must be able to handle that? Delphi does. Extract what it needs and leave/ignore the rest? -- Regards, - Graeme -

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > - > Call StrToDate to parse a string that specifies a date. If S does [...] > First lines say it all. "dd/mm/yyy hh:nn" is not supposed to work. That's up for discussion! :-) It says t

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > The error is correct, since 05/05/1999 is not a valid date. > It should use - instead of / . I've adapted the example. But couldn't you simply have forced DateSeparator to "-". Also could we try not to have such an obscure example - using day and

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Graeme Geldenhuys wrote: > PS: > Oh and a nice hidden little features (I couldn't find documentation > for). When you specify a date format as '/mm/dd' or dd/mm/yy > etc... The '/' character is NOT the separator! Correction, t

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > It is mentioned in topic 'Date and time formatting characters' of the FPC > docs. I blame my mistake on the broken IPF output generated from 'fpdoc'. My new INF help viewer, 'docview', did not find any help on "formatting characters", so I thought i

Re: [fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > Only the relative order of y,m,d is needed from shortdateformat. > So the actual number, 1,2 or 4 ys is not relevant. You are still thinking > that it uses the actual dateformat, when it does not. Ah, I get it now! Sorry, I'm was a bit slow there. :

[fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
Hi, How do you create plain text file output with TFileStream? Or is TFileStream reserved for binary output only? I'm using TFileStream as follows; // helper function to simply things procedure writef(AText: string); begin AOut.WriteAnsiString(AText + LineEnding); end; where AOut is

Re: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Gerard N/A : > > Could it be that the length indicator bytes of the string are written > to the stream? Ah, looking at the .WriteAnsiString() implementation, you seem to be 100% correct. Procedure TStream.WriteAnsiString (const S : String); Var L : Longint; begin L:=Length(S)

Re: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Marco van de Voort : > >  if length(atext)>0 then >>WriteBuffer(Atext[1], length(AText)? I always add a LineEnding character to AText, so the 'if length()' check is not strictly needed. Sometimes I would like to write a "blank" line in my text output. Equivalent of writeln(''); -- R

Re: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Graeme Geldenhuys : > >> Did you try writing with WriteBuffer(Atext[1], length(AText)? > > That works exactly like I intended. Thanks Gerard. I spoke to soon! :-( I can view the resulting output.txt file with Midnight Commander (Linux console file manager), but if I tr

Re: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Vincent Snijders : > > Otherwise you cannot read it back. :-) But using .WriteAnsiString() doesn't create a plain text file, so the result is useless. And as my last post says, the method Gerard suggested is also not 100%. It seems extra hard to create a normal, plain, standard text f

Re: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Henry Vermaak : > > Maybe you need to put the line endings in manually? What do you mean? I already append LineEnding to AText, and send that to WriteAnsiString() call. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal G

Re: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Aleksa Todorovic : > constructor Create...; > procedure WriteStr(const fmt: String; const args: array of const); > procedure WriteStr(const s: String); OK, I managed to solve the problem. I have two units that write to the output text file. The one unit I fixed by using "AOut.WriteBuff

Re: Re[2]: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 JoshyFun : > > Since Delphi first streams I had never used pascal "files" anymore, > they are a lot of restrictive, not thread safe and are very tied to > which they expect to read/write. That's kind-of why I wanted to use TFileStream. I use it for reading binary data, and thought to us

[fpc-pascal] WORD (2 bytes) to String conversion

2009-10-23 Thread Graeme Geldenhuys
Hi, I'm reading in a WORD (2 bytes) from a binary file. I can display the Hex format of that value without a problem, but I would also like to display the String value of that WORD variable. It's the first 2 bytes of a file, which contains the "magic number" of the file. I would like my program t

[fpc-pascal] Re: WORD (2 bytes) to String conversion

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Graeme Geldenhuys : > Hi, > > I'm reading in a WORD (2 bytes) from a binary file. I can display the As I pressed the Send button, I thought about trying the following. And it worked! But is this the best way of doing what I want? type TWord = record b1: Char

Re: [fpc-pascal] WORD (2 bytes) to String conversion

2009-10-23 Thread Graeme Geldenhuys
2009/10/23 Aleksa Todorovic : > > w: WORD > ... > YourString := Chr(Lo(w)) + Chr(Hi(w)) > or > YourString := Chr(Hi(w)) + Chr(Lo(w)) Ah, thanks. I was close, I used High() and Low() instead. :-( Dope! -- Regards, - Graeme - ___ fpGUI - a cross-p

Re: [fpc-pascal] WORD (2 bytes) to String conversion

2009-10-23 Thread Graeme Geldenhuys
On 23/10/2009, Jeff Wormsley wrote: > > That's dangerous, though, if your magic number's two bytes aren't printable That should never be a problem for my tool though. The tool I am writing is specific to the INF help format. The tool dumps the file structure to a text file. (I need this for debu

Re: [fpc-pascal] WORD (2 bytes) to String conversion

2009-10-23 Thread Graeme Geldenhuys
On 23/10/2009, Jeff Wormsley wrote: > Oh, I was fairly certain of that. Its just these little routines tend to > end up in libraries of handy code. I tend to be overly cautious with some > of these because of that. Point taken. :-) This code is purposely rewritten and totally standalone so I

<    3   4   5   6   7   8   9   10   11   12   >