[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Ian T Zimmerman <itz@r...> |
| Subject: | Re: lexing__get_next_char ? |
In article <199610211430.QAA11843@pauillac.inria.fr> Xavier Leroy
<Xavier.Leroy@inria.fr> writes:
>
> > In the caml-light sources, in src/runtime/lexing.c, the primitive
> > get_next_char is defined as follows:
> >
> > struct lexer_buffer {
> > value refill_buff;
> > value lex_buffer;
> > value lex_abs_pos;
> > value lex_start_pos;
> > value lex_curr_pos;
> > value lex_last_pos;
> > value lex_last_action;
> > };
> >
> > value get_next_char(lexbuf) /* ML */
> > struct lexer_buffer * lexbuf;
> > {
> > mlsize_t buffer_len, curr_pos;
> >
> > buffer_len = string_length(lexbuf->lex_buffer);
> > ...
> >
> > How can this work, when lexer buffers are ML records on the heap, as
> > the following piece of src/lib/lexing.ml seems to show
>
> Viewed from C, Caml records are arrays of elements of type "value".
> So, we're basically casting a pointer to a "value" array to a pointer
> to a struct with all fields having type "value".
But don't they have the header word in front??
--
Ian T Zimmerman <itz@rahul.net>
Days spent working only for oneself are twice wasted;
it would have been better not to work at all.