Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Ian T Zimmerman <itz@rahul.net>
To: caml-list@inria.fr
Subject: lexing__get_next_char ?
Date: Thu, 17 Oct 1996 20:40:55 -0700	[thread overview]
Message-ID: <199610180340.UAA12614@kronstadt.rahul.net> (raw)



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                        <itz@rahul.net>
Days spent working only for oneself are twice wasted; 
it would have been better not to work at all.





             reply	other threads:[~1996-10-18 18:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-18  3:40 Ian T Zimmerman [this message]
1996-10-21 14:30 ` Xavier Leroy
1996-10-21 16:55   ` Ian T Zimmerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199610180340.UAA12614@kronstadt.rahul.net \
    --to=itz@rahul.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox