unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Marius Vollmer <mvo@zagadka.de>
Cc: guile development <guile-devel@gnu.org>
Subject: Re: [PATCH] for strports.c: scm_c_eval_string_from_file_line
Date: 01 Jun 2003 22:00:31 +0200	[thread overview]
Message-ID: <87el2dlg9s.fsf@zagadka.ping.de> (raw)
In-Reply-To: <3ECFDA48.309D0F5@veritas.com>

Bruce Korb <bkorb@veritas.com> writes:

> 2003-05-24  Bruce Korb  <bkorb@gnu.org>
> 
> 	* guile-core/libguile/strports.c(scm_c_eval_string_from_file_line):
> 	new procedure.  Facilitate error messages for applications that
> 	extract scheme code from their input files.

Hmm, I'm not sure whether we should provide such a function as a ready
made unit.  Evaluation from strings (maybe with embedded new lines,
maybe more than one string, etc) while maintaining the line number,
the current module, etc, might come in several variations, I think.

We should provide the building blocks so that people can easily
implement what they want cleanly so that
scm_c_eval_string_from_file_line is very easy to implement.

What you can do right now is, for example (and untested, sorry):

  void
  scm_c_primitive_load_from_string (const char *str,
                                    const char *filename, int line)
  {  
    SCM port, exp;

    port = scm_open_input_string (scm_str2string (str));
    scm_set_port_file_name_x (port, scm_str2string (filename));
    scm_set_port_line_x (port, scm_int2num (line));

    while (!SCM_EOF_OBJECT_P (exp = scm_read (port)))
      scm_primitive_eval_x (exp);
  }

I think this quite straightforward, no?  But we might want to offer it
ready-made, anyway.  Opinions?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-06-01 20:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-24 20:47 [PATCH] for strports.c: scm_c_eval_string_from_file_line Bruce Korb
2003-06-01 20:00 ` Marius Vollmer [this message]
2003-06-01 20:38   ` Bruce Korb
2003-06-09 19:53     ` Marius Vollmer

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=87el2dlg9s.fsf@zagadka.ping.de \
    --to=mvo@zagadka.de \
    --cc=guile-devel@gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).