From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Shann Newsgroups: gmane.lisp.guile.user Subject: Re: scm_defined_p(sym, env) Date: Tue, 23 Aug 2011 14:26:31 +0100 Message-ID: <1314105991.2188.4.camel@debian2.myhost> References: <1314099404.2168.6.camel@debian2.myhost> <20110823115400.GA596@seid-online.de> Reply-To: richard.shann@virgin.net NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1314105887 10338 80.91.229.12 (23 Aug 2011 13:24:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 23 Aug 2011 13:24:47 +0000 (UTC) Cc: guile-user@gnu.org To: rm@tuxteam.de Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Aug 23 15:24:43 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 1Qvqy9-0004wP-OI for guile-user@m.gmane.org; Tue, 23 Aug 2011 15:24:41 +0200 Original-Received: from localhost ([::1]:54933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvqy8-0006z8-O7 for guile-user@m.gmane.org; Tue, 23 Aug 2011 09:24:40 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:59033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvqy0-0006nM-UT for guile-user@gnu.org; Tue, 23 Aug 2011 09:24:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qvqxu-0007eh-GM for guile-user@gnu.org; Tue, 23 Aug 2011 09:24:32 -0400 Original-Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]:26550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvqxu-0007dF-83 for guile-user@gnu.org; Tue, 23 Aug 2011 09:24:26 -0400 Original-Received: from know-smtpout-4.server.virginmedia.net ([62.254.123.2]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20110823132413.HCHI2720.mtaout01-winn.ispmail.ntl.com@know-smtpout-4.server.virginmedia.net>; Tue, 23 Aug 2011 14:24:13 +0100 Original-Received: from [46.208.135.91] (helo=[192.168.2.3]) by know-smtpout-4.server.virginmedia.net with esmtpa (Exim 4.63) (envelope-from ) id 1Qvqxh-0006Za-PE; Tue, 23 Aug 2011 14:24:13 +0100 In-Reply-To: <20110823115400.GA596@seid-online.de> X-Mailer: Evolution 2.30.3 X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=bqaeD2Tb9gYA:10 a=F9S3lJeE8MMA:10 a=tOnwS5-cS8YA:10 a=IkcTkHD0fZMA:10 a=5TymCYJT7da3kbgQzdgA:9 a=5llI1pRjDvwG2-M9HmAA:7 a=QEXdDO2ut3YA:10 a=POTBI71HzLoA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 81.103.221.47 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:8728 Archived-At: I didn't find the SCM_UNBNDP() that you mention but since mailing the list I stumbled on SCM_UNDEFINED and tried if(opt==SCM_UNDEFINED) ... and that seems to work. So (unless I am doing something bad) I think I am back on course - thanks! Richard On Tue, 2011-08-23 at 13:54 +0200, rm@tuxteam.de wrote: > 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 > > > > >