[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

Re: [fpc-pascal] Linux IPC (SHM) : Getting Strange Value for shm_nattch (# of attachements)

2009-10-15 Thread Tom__G
No idea ? :-(( -- View this message in context: http://www.nabble.com/Linux-IPC-%28SHM%29-%3A-Getting-Strange-Value-for-shm_nattch-%28--of-attachements%29-tp25874304p25905043.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___

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

2009-10-15 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > What if I don't pass in a size to > FreeMem(), will it know how much to free? Yes (as long as you don't mess with internal heap structures ;)). ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepasc

[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 under my 64bit FPC. ---

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

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

2009-10-15 Thread Michael Van Canneyt
On Thu, 15 Oct 2009, Graeme Geldenhuys wrote: 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

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

2009-10-15 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > 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? GetMem/FreeMem are lower level tha

Re: [fpc-pascal] Linux IPC (SHM) : Getting Strange Value for shm_nattch (# of attachements)

2009-10-15 Thread Henry Vermaak
2009/10/13 Tom__G : > > Hi, > > I try to get number of processes attached to a specific shared memory > segment. > So I read the shmctl record to retrieve this into shared memory : > > type TShmid_ds = record >  shm_perm: TIPC_Perm; Permissions >  shm_segsz: cint; Segment size >  shm_atime: time_t;

[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] Video4Linux access

2009-10-15 Thread James Buren
> Hi Everybody, > > I need video4linux support for my new project. I tried vfp unit > I found in the contribute units website. > But it seems very outdated. Itried all things menitioned in the > forum, but I'm not able to get the things up. the code is hard > to read and I found not one comment li

Re: [fpc-pascal] More OS X problems

2009-10-15 Thread Paul Davidson
Thank you Changing the mode in the project fixed all problems. System now compiles correctly. pd On 2009-10-13, at 4:14 PM, Jonas Maebe wrote: Paul Davidson wrote on Tue, 13 Oct 2009: OS X 10.6.1 FPC 2.2.4 Xcode 3.2 (64 bit) Using code base that has complied correctly since 2004 Fi

[fpc-pascal] MySQL

2009-10-15 Thread Paul Davidson
FPC 2.2.4 OS X 10.6.1 Xcode 3.2 All references to MySQL function are unresolved by linker. libMySQLclient.a is copied to .pas directory. Using FPC test code for MySQL as template. Any hints please? ___ fpc-pascal maillist - fpc-pascal@lists.f

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

2009-10-15 Thread Michael Van Canneyt
On Wed, 14 Oct 2009, Graeme Geldenhuys wrote: 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 The return value should be the new - absolute - position in the stre

Re: [fpc-pascal] Linux IPC (SHM) : Getting Strange Value for shm_nattch (# of attachements)

2009-10-15 Thread Tom__G
Henry Vermaak wrote: > > 2009/10/13 Tom__G : >> >> Hi, >> >> I try to get number of processes attached to a specific shared memory >> segment. >> So I read the shmctl record to retrieve this into shared memory : >> >> type TShmid_ds = record >>  shm_perm: TIPC_Perm; Permissions >>  shm_segsz: ci

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] Problems to compile FPC 2.3.0

2009-10-15 Thread Jonas Maebe
On 12 Oct 2009, at 17:03, Matthias Klumpp wrote: On Mon, 12 Oct 2009 12:49:03 +0200, Jonas Maebe > wrote: On 11 Oct 2009, at 18:37, Matthias Klumpp wrote: I decided to use this version of FPC for now. Thank you for your help! But now I have problems to compile the compiler: First I got th

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

2009-10-15 Thread Michael Van Canneyt
On Thu, 15 Oct 2009, Graeme Geldenhuys wrote: 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...? I already have put it in my queue... Michae

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/ __

Re: [fpc-pascal] MySQL

2009-10-15 Thread Jonas Maebe
On 14 Oct 2009, at 18:14, Paul Davidson wrote: FPC 2.2.4 OS X 10.6.1 Xcode 3.2 All references to MySQL function are unresolved by linker. libMySQLclient.a is copied to .pas directory. Using FPC test code for MySQL as template. When you use Xcode, you have to use the Xcode way to link

[fpc-pascal] open arrays as parameters (why packed not allowed)?

2009-10-15 Thread Bruce Bauman
I am translating some Pascal code from MetaWare Professional Pascal to Free Pascal. The MetaWare code uses conformant arrays, which are not supported within Free Pascal. We are thus translating these to use Free Pascal open arrays. However, Free Pascal does not allow the "packed" qualifier on the

[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 Martin
Graeme Geldenhuys wrote: _pContentsData = a generic Pointer type that points to a block of data (containing multiples of various structures). XXX bytes of information. pEntry = this is a pointer to a specific starting structure type and will increment in blocks of data to point to the various st

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 Martin
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 inc( pEntry, pEntry^.Length); inc(PEntry, 1) since it increments by the size of the t

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 inc( pEntry, pEntry^.Length); >>> inc(P

Re: [fpc-pascal] MySQL

2009-10-15 Thread Paul Davidson
Added libmysqlclient.a to the project and it gets automatically included in Tagets/cape96/Link Binary With Libraries. Again same linker errors: Symbols not found. Also tried libmysqlclient.la. Same result. When looking at examples and tests in FPC for MySQL they do not contain any refe

Re: [fpc-pascal] MySQL

2009-10-15 Thread Jonas Maebe
On 15 Oct 2009, at 16:03, Paul Davidson wrote: On 2009-10-15, at 7:13 AM, Jonas Maebe wrote: On 14 Oct 2009, at 18:14, Paul Davidson wrote: FPC 2.2.4 OS X 10.6.1 Xcode 3.2 All references to MySQL function are unresolved by linker. libMySQLclient.a is copied to .pas directory. Using FP

Re: [fpc-pascal] open arrays as parameters (why packed not allowed)?

2009-10-15 Thread Jonas Maebe
On 15 Oct 2009, at 14:49, Bruce Bauman wrote: [packed for open array parameters] Is there a reason why "packed" is not allowed in this context? I think it's simply because I forgot to add it when adding support for packed arrays. Please file a bug report. Jonas __

RE: [fpc-pascal] open arrays as parameters (why packed not allowed)?

2009-10-15 Thread Bruce Bauman
Thanks. Will do. -Original Message- From: fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Jonas Maebe Sent: Thursday, October 15, 2009 10:28 AM To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] open arrays as parameters (why pa

Re: [fpc-pascal] MySQL

2009-10-15 Thread Paul Davidson
Here is the head of the unit: { cMySQL.pas cape61 Created by Paul Davidson on 2005/01/18. Copyright (c) 2005 Corax Networks.Inc.. All rights reserved. } unit cMySQL; {$I Directives.inc} interface {$linklib libmysqlclient.a} uses cBase, cKey, cStack, mysql4;

[fpc-pascal] BNF grammar for fpc

2009-10-15 Thread Marc Santhoff
Hi everyone, is a complete grammar for fpc written in some variant of BNF available somewhere? I searched the website and the wiki, to no avail. TIA, Marc -- Marc Santhoff ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.free

Re: [fpc-pascal] pointer arithmetic help required

2009-10-15 Thread Vinzent Höfler
Graeme Geldenhuys : > Now I know why vendors of newer languages (Dephi, Java etc) are trying > to hide pointers from programmers. They are very tricky to work with - > and give errors without warning! Especially when compiler and programmer are both trying to outsmart each other. :D Vinzent. -

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

2009-10-15 Thread 章宏九
Hmm, currently I am also learning Oberon. No any language requires an IDE. I use vim. Others might use emacs. These are enough. What we need is a simple editor (if you like, GNU nano or simply "cat > 1.pas" is okay) and a compiler. They can make the world, although not that efficiently. Not the b

Re: [fpc-pascal] BNF grammar for fpc

2009-10-15 Thread leledumbo
> is a complete grammar for fpc written in some variant of BNF available > somewhere? > > I searched the website and the wiki, to no avail. AFAIK, there's none. The developers adding language features by directly modifying the code. Even there's a bounty for it. See: http://wiki.lazarus.freepasc