John Klein | 9 Nov 05:36 2003
Picon

changing default directory


Hello,

This might be an obvious question, but I haven't found an answer
in the docs or the source code.  How does one change the default 
working directory in sbcl?

In cmucl, it is (setf (ext:default-directory) "/new/directory")
but in sbcl, default-directory does not exist.

A solution using 

(sb-alien:define-alien-routine ("chdir" unix-chdir) sb-alien:int
  (dir-name sb-alien:c-string))

changes the directory as seen by sb-unix:posix-getcwd but
not as seen by the rest of sbcl - eg, not by (directory ".")

Regards,
John

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
(Continue reading)

Daniel Barlow | 9 Nov 05:58 2003
Picon

Re: changing default directory

John Klein <jk271828 <at> yahoo.com> writes:

> This might be an obvious question, but I haven't found an answer
> in the docs or the source code.  How does one change the default 
> working directory in sbcl?

All pathnames in SBCL are merged against *default-pathname-defaults*
before the filesystem is accessed.  Note that this should be a
_pathname_, not merely a pathname designator

(setf *default-pathname-defaults* #p"/tmp/")

See also 

http://groups.google.com/groups?q=pitman+default-pathname-defaults&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=sfwr995y5zc.fsf%40world.std.com&rnum=4

-dan

--

-- 

   http://web.metacircles.com/cirCLe_CD - Free Software Lisp/Linux distro
Milan Zamazal | 11 Nov 09:19 2003
X-Face

Re: changing default directory

BTW, is there a way to set a default directory for a program run through
RUN-PROGRAM?  Or do I have to alien-call `chdir' before calling
RUN-PROGRAM?

Milan Zamazal

--

-- 
Free software is about freedom, not about free beer.  If you care only about
the latter, you'll end up with no freedom and no free beer.

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
Daniel Barlow | 11 Nov 11:23 2003
Picon

Re: Re: changing default directory

Milan Zamazal <pdm <at> zamazal.org> writes:

> BTW, is there a way to set a default directory for a program run through
> RUN-PROGRAM?  Or do I have to alien-call `chdir' before calling
> RUN-PROGRAM?

No, there isn't, and I wonder if we should chdir to the
(pathname-directory) of *default-pathname-defaults* as part of the
run-program call.  Of course, that may or may not DTRT if
*default-pathname-defaults* is logical.  Discuss, with particular
reference to logical hosts that translate *.foo into one directory and
*.bar into another ...

-dan

--

-- 

   http://web.metacircles.com/cirCLe_CD - Free Software Lisp/Linux distro
Milan Zamazal | 11 Nov 12:14 2003
X-Face

Re: changing default directory

>>>>> "DB" == Daniel Barlow <dan <at> telent.net> writes:

    DB> Milan Zamazal <pdm <at> zamazal.org> writes:
    >> BTW, is there a way to set a default directory for a program run
    >> through RUN-PROGRAM?  Or do I have to alien-call `chdir' before
    >> calling RUN-PROGRAM?

    DB> No, there isn't, and I wonder if we should chdir to the
    DB> (pathname-directory) of *default-pathname-defaults* as part of
    DB> the run-program call.

How about just adding a :DIRECTORY argument to RUN-PROGRAM?

Milan Zamazal

--

-- 
http://www.zamazal.org

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
Henrik Motakef | 17 Nov 20:50 2003
Picon

ftype declarations for generic functions

Hi,

Is it possible and/or meaningfull to declare the ftype of a generic
function? It looks like in sbcl (0.8.5), a form like

(defgeneric foo (x y))

automatically implies a declaration like

(ftype (function (t t) *) foo)

overriding any previous explicit declaration, and issuing a style
warning about it if they don't match (which they usually don't). Is
there a way to declare a more strict type for a gf, so that ideally I
would get neat warning for methods that obviously don't conform to it
like I would get for ordinary functions?

A related question: If I want to express "this function returns only
one value, a string", do I really have to write '(function (...)
(values string &optional))'? Apparently, both '(function (...)
string)' and '(function (...) (values string))' are automagically
converted to '(function (...) (values &optional string &rest t))'.

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
Christophe Rhodes | 17 Nov 23:06 2003
Picon
Picon

Re: ftype declarations for generic functions

Henrik Motakef <usenet-reply <at> henrik-motakef.de> writes:

> A related question: If I want to express "this function returns only
> one value, a string", do I really have to write '(function (...)
> (values string &optional))'? Apparently, both '(function (...)
> string)' and '(function (...) (values string))' are automagically
> converted to '(function (...) (values &optional string &rest t))'.

This second would appear to be mandated behaviour by the ANSI
specification, in at least one reading.  At least the page for THE
says that missing values in the type specifier default to anything, so
the only way to enforce what you want, portably, would appear to be by
adding the &optional, since FTYPE declarations are equivalent to
wrappping things by equivalent THE forms.

Cheers,

Christophe
--

-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
Alexey Dejneka | 18 Nov 06:29 2003
X-Face
Picon

Re: ftype declarations for generic functions

Henrik Motakef <usenet-reply <at> henrik-motakef.de> writes:

> A related question: If I want to express "this function returns only
                                                                 ^^^^^^
                                                                = "exactly"?
> one value, a string", do I really have to write '(function (...)
> (values string &optional))'?

Yes.

> Apparently, both '(function (...)
> string)' and '(function (...) (values string))' are automagically
> converted to '(function (...) (values &optional string &rest t))'.
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I hope you mean (VALUES STRING &REST T): (THE STRING (VALUES)) should
signal a type error.

--

-- 
Regards,
Alexey Dejneka

"Alas, the spheres of truth are less transparent than those of
illusion." -- L.E.J. Brouwer

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
(Continue reading)

Nicolas Neuss | 18 Nov 10:11 2003
Picon

Re: ftype declarations for generic functions

Henrik Motakef <usenet-reply <at> henrik-motakef.de> writes:

> Hi,
> 
> Is it possible and/or meaningfull to declare the ftype of a generic
> function? It looks like in sbcl (0.8.5), a form like
> 
> (defgeneric foo (x y))
> 
> automatically implies a declaration like
> 
> (ftype (function (t t) *) foo)
> 
> overriding any previous explicit declaration, and issuing a style
> warning about it if they don't match (which they usually don't). Is
> there a way to declare a more strict type for a gf, so that ideally I
> would get neat warning for methods that obviously don't conform to it
> like I would get for ordinary functions?

I think for gfs a combination of types would be the most reasonable type
declaration, e.g. (or (function (string) fixnum) (function (list) fixnum)).
To be practically usable, this should probably adapt dynamically to new
method definitions...

Nicolas.

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
(Continue reading)

John Klein | 23 Nov 09:09 2003
Picon

loading foreign object files under Darwin


I'm having some  problems loading foreign code into SBCL 0.8.5
on Darwin (OS X 10.3)

Essentially I'm trying to load the library libcpgplot.a,
which I've broken down into an object file cpgplot.o 
using:
  ar -x libcpgplot.a
  ld -r *.o -o cpgplot.o

I do it this way because simply loading a .a file did not work
under Linux, but this variant did work.   I also tried other
variants (see below)

I load the library with:

(sb-alien:load-alien '("cpgplot.o")
  :libraries  '("/data/Software/lib/libpgplot.a" 
                "/data/Software/lib/libcpgplot.a" 
                "-lc" "-lz"
                "/sw/lib/libpng.a"  "/usr/X11R6/lib/libX11.a"
                 ;; prevent undefined dyld_stub_binding_helper
                 "/usr/lib/bundle1.o"
                 ;; prevent undefined _G77_getenv_0
                 "/sw/lib/libg2c.a"
                  ;; other stuff that g77 seems  to want
                  "/usr/lib/libcc_kext.a" "/sw/lib/libf2c.a"))

the above mess came from a long round of experimention to
ensure all the symbols resolved during the load-alien call.
(Continue reading)


Gmane