Am Sonntag, den 24.09.2006, 11:37 -0300 schrieb Felipe Monteiro de Carvalho:
Show quoted text 12 lines
This is what almost works:
var
hw_handlers: array[0..1] of handler_rec =
(
(content_type: 'hw_app'; handler: @DefaultHandler),
nil
);
But the compiler will complain on the nil:
mod_hello.lpr(108,5) Fatal: Syntax error, "(" expected but "NIL" found
That's why I suggested making it an array of pointers. A pointer can be NIL. The main question is if apache can still access it in the right way ...
Have you tried something stupid, like:
hw_handlers: array[0..1] of handler_rec =
(
(content_type: 'hw_app'; handler: @DefaultHandler), (,)
)
Show quoted text 8 lines
On 9/23/06, Marc Santhoff wrote:
> Think of hardware detection, one driver may know different models it
> supports. When detection is active it simply iterates over the model
> describing struct and checks presence until the item read from the
> struct is NULL.
I still don't know how what is the inner working of this. Does that c
statement really means a static array with size two?
Yes it does.
Show quoted text 5 lines
A record cannot
be null. When you access a static record you go directly to it's
memory position of Initial_Pos + X * Record_Size, where X is the
record number. Then you cannot have a null record. The best you can
have is record whose content is null.
There is the problem, pascal is sort of stronger typed than C.
Or NULL could represent that the array is of size 1 not 2.
It is an element that can have a NULL value, however the compiler interprets it. Mostly variables in C do not have anything attached but can be viewed as a block of memory. You can do with it what you like. Pascal is lacking some common base type compatible with any record. One solution for a few cases would be to use an array of byte and do the housekeeping yourself.
How is the source using this array defined, can you get any hints from that C code? Is it happy with a record having a NIL string and a NIL pointer in it?
HTH,
Marc