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 UAA10166 for caml-redistribution; Fri, 18 Oct 1996 20:09:32 +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 FAA25203 for ; Fri, 18 Oct 1996 05:42: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 FAA03783 for ; Fri, 18 Oct 1996 05:42:02 +0200 (MET DST) Received: (from itz@localhost) by kronstadt.rahul.net (8.7.6/8.7.3) id UAA12614; Thu, 17 Oct 1996 20:40:55 -0700 Date: Thu, 17 Oct 1996 20:40:55 -0700 Message-Id: <199610180340.UAA12614@kronstadt.rahul.net> From: Ian T Zimmerman To: caml-list@inria.fr Subject: lexing__get_next_char ? Sender: weis Hello camellers --- this is a hacker question. 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: let create_lexer f = { refill_buff = lex_refill f; lex_buffer = create_string 2048; lex_abs_pos = - 2048; lex_start_pos = 2048; lex_curr_pos = 2048; lex_last_pos = 2048; lex_last_action = dummy_action } ... Shouldn't get_next_char be something like value get_next_char(lexbuf) /* ML */ value lexbuf; { mlsize_t buffer_len, curr_pos; assert(Is_block(lexbuf)); buffer_len = string_length(Field(lexbuf,1)); ... Thanks for your explanation! -- Ian T Zimmerman Days spent working only for oneself are twice wasted; it would have been better not to work at all.