From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: William Morgan Newsgroups: gmane.lisp.guile.devel Subject: vports from c questions Date: Fri, 10 Jan 2003 15:31:50 -0500 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <20030110203150.GA17757@masanjin.net> References: <20021230013149.GB25056@masanjin.net> <20030105035742.GA29985@masanjin.net> <20030107054232.GA10760@masanjin.net> <20030108223847.GA6983@masanjin.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042230597 26002 80.91.224.249 (10 Jan 2003 20:29:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 10 Jan 2003 20:29:57 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18X5mh-0006ka-00 for ; Fri, 10 Jan 2003 21:29:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18X5ms-0002pA-00 for guile-devel@m.gmane.org; Fri, 10 Jan 2003 15:29:54 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18X5mG-0002MV-00 for guile-devel@gnu.org; Fri, 10 Jan 2003 15:29:16 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18X5m5-0001s5-00 for guile-devel@gnu.org; Fri, 10 Jan 2003 15:29:08 -0500 Original-Received: from h0060976e2b56.ne.client2.attbi.com ([65.96.180.211] helo=lux) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18X5ly-0001XS-00 for guile-devel@gnu.org; Fri, 10 Jan 2003 15:28:58 -0500 Original-Received: from wmorgan by lux with local (Exim 3.35 #1 (Debian)) id 18X5ok-0005FL-00 for ; Fri, 10 Jan 2003 15:31:50 -0500 Original-To: guile-devel@gnu.org Mail-Followup-To: guile-devel@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:1865 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1865 Dear Guile gurus, I am now at the point in my application where I would like Guile to be able to read from and write to a vport under my control. There is no scm_c_make_soft_port, so what I'm doing is the following (for an output-only port): SCM vec = scm_c_make_vector(5, SCM_BOOL_F); scm_vector_set_x(vec, scm_int2num(0), scm_c_make_gsubr("write a char", 1, 0, 0, (SCM (*)())handle_write_char); scm_vector_set_x(vec, scm_int2num(1), scm_c_make_gsubr("write a string", 1, 0, 0, (SCM (*)())handle_write_string); However, in the case of multiple vports, each of which references my handle_write_char and handle_write_string functions, these two functions have no way of telling which port is calling them, and thus where in my application to send the output. Questions: 1) Is there a nice way of specifying some kind of closure, from the C side, such that I can provide additional arguments to my handle_write_* functions? (I can think of two ways, one involving a scm_eval_string("(lambda (char) (...") in the above code, and one one involving a table of function pointers---but neither of these seems pretty.) 2) If not #1, do people see this as an API issue? 3) If #2, any suggestions on what you'd like the API to be if I were to submit a patch? Thank you, -- William _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel