From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rm@tuxteam.de Newsgroups: gmane.lisp.guile.user Subject: Re: scm_defined_p(sym, env) Date: Tue, 23 Aug 2011 13:54:00 +0200 Message-ID: <20110823115400.GA596@seid-online.de> References: <1314099404.2168.6.camel@debian2.myhost> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1314100392 6378 80.91.229.12 (23 Aug 2011 11:53:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 23 Aug 2011 11:53:12 +0000 (UTC) Cc: guile-user@gnu.org To: Richard Shann Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Aug 23 13:53:08 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QvpXY-0006tx-3A for guile-user@m.gmane.org; Tue, 23 Aug 2011 13:53:08 +0200 Original-Received: from localhost ([::1]:34092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvpXX-0001kr-MX for guile-user@m.gmane.org; Tue, 23 Aug 2011 07:53:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvpXV-0001kk-CA for guile-user@gnu.org; Tue, 23 Aug 2011 07:53:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvpXU-0003kA-H3 for guile-user@gnu.org; Tue, 23 Aug 2011 07:53:05 -0400 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:56762 helo=www.elogos.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvpXU-0003js-Bm for guile-user@gnu.org; Tue, 23 Aug 2011 07:53:04 -0400 Original-Received: by www.elogos.de (Postfix, from userid 1001) id 8FD9E9004B; Tue, 23 Aug 2011 13:54:00 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1314099404.2168.6.camel@debian2.myhost> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 217.22.192.104 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8727 Archived-At: On Tue, Aug 23, 2011 at 12:36:44PM +0100, Richard Shann wrote: > I have defined a function with one needed and one optional arg, using > > scm_c_define_gsubr (name, 2, 0, 0, callback); > > in my function I need to test if the second argument is present, it > looks like I need > > scm_defined_p(sym, env) > > but, if so, how do I find the value of env for the top-level > environment? Not shure I understand you here, Richard. Where would sym come from? If your function looks like this: (richards-function required-param an-optional-param) thane your c function needs exactly two parameters: ricks_c_func(SCM req, SCM opt) { ... if (!SCM_UNBNDP (opt)) { /* opt wasn't provided, so do something here */ } ... } Does that help? Cheers, Ralf Mattes > Richard Shann > >