[fpc-pascal] Setting bit in array of byte

2005-10-01 Thread Koenraad Lelong
Hi, I have following code (almost literally translated from C) : //-- // Bit utility to read and write a bit in the buffer 'buf'. // // 'op'- operation (1) to set and (0) to read // 'state' - set (1) or clear (0) if operat

Re: [fpc-pascal] Setting bit in array of byte

2005-10-01 Thread Michalis Kamburelis
Koenraad Lelong wrote: Hi, I have following code (almost literally translated from C) : //-- // Bit utility to read and write a bit in the buffer 'buf'. // // 'op'- operation (1) to set and (0) to read // 'state' - set

Re: [fpc-pascal] Setting bit in array of byte

2005-10-01 Thread Koenraad Lelong
Michalis Kamburelis wrote: Koenraad Lelong wrote: ... "array of byte" is a dynamic array. It's a pointer, to data and to some internal fields. "^array of byte" is a pointer to a pointer to data. You don't want this. What you probably want is something like type TByteArray = array[0..Max

Re: [fpc-pascal] What is the portable approach?

2005-10-01 Thread L505
>Is one of them the right/accepted/guru way to do it? Or am I missing >an alternative? Should I be thinking of extending the TStringList >class? I would think inventing a TStrIntPairList (name can be changed to something else maybe) would be a good idea if it has not already been invented. If

Re: [fpc-pascal] What is the portable approach?

2005-10-01 Thread L505
> dynamic array of integers and strings wrapped in a class. > of course I meant reals not integers ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] What is the portable approach?

2005-10-01 Thread Marco van de Voort
> I have data that would fit an associative array if they really > existed in Pascal, but while the key is a string, the values are > reals [0,1]. So, I have been using a TStringList and something like > (from memory): > > MyList.AddObjects('key1',pointer(round(value1*maxint)); (effectively mak