From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id QAA07602 for caml-redistribution; Tue, 22 Oct 1996 16:31:04 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id SAA14700 for ; Mon, 21 Oct 1996 18:56:07 +0200 Received: from kronstadt.rahul.net (kronstadt.rahul.net [204.95.70.128]) by nez-perce.inria.fr (8.7.6/8.7.1) with ESMTP id SAA27368 for ; Mon, 21 Oct 1996 18:56:01 +0200 (MET DST) Received: (from itz@localhost) by kronstadt.rahul.net (8.7.6/8.7.3) id JAA26218; Mon, 21 Oct 1996 09:55:53 -0700 Date: Mon, 21 Oct 1996 09:55:53 -0700 Message-Id: <199610211655.JAA26218@kronstadt.rahul.net> From: Ian T Zimmerman To: caml-list@inria.fr In-reply-to: Xavier Leroy's message of Mon, 21 Oct 1996 16:30:50 +0200 (MET DST) Subject: Re: lexing__get_next_char ? References: <199610180340.UAA12614@kronstadt.rahul.net> <199610211430.QAA11843@pauillac.inria.fr> Sender: weis In article <199610211430.QAA11843@pauillac.inria.fr> Xavier Leroy 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 Days spent working only for oneself are twice wasted; it would have been better not to work at all.