Commit Graph

263 Commits

Author SHA1 Message Date
Doug Currie 7f48b4d370 fix issue #33 Negating most-negative-fixnum doesn't. (#35)
* fix issue #33 Negating most-negative-fixnum doesn't.

* Add unit test for issue #33 Negating most-negative-fixnum doesn't.
2019-08-08 18:09:02 +03:00
Rick Hanson 130518cdc9 get_exename() for OpenBSD. (#17)
get_exename() for OpenBSD.

Issue

`get_exename()` gets the pathname of the current process.  In
femtolisp, this is used to set the top-level `*install-dir*` which in
turn is used as the location of the system image, `flisp.boot`.

There is only a trivial implementation of `get_exename()` for OpenBSD
that simply returns `NULL`.  A minor consequence is that the unit test
will fail for the default build (make) because the system image cannot
be found.

Fix

This commit provides an implementation of `get_exename()` for OpenBSD,
so that the system image can be found.

Unlike, say, Linux or FreeBSD, OpenBSD doesn't have a system call to
get the path of the current (or any, for that matter) process.  The
present code contains some logic that was put together to emulate the
behavior of the Linux and FreeBSD variants of `get_exename()` as best
as possible.  It works as described by the following.

(1) Call `sysctl(3)` (with `CTL_KERN` -> `KERN_PROC_ARGS` ->
    `KERN_PROC_ARGV`) to get the "`argv[0]`" of the current process.
    If the program (flisp) was called in "`basename` form" (i.e. as
    "flisp"), then go to (2).  Otherwise, return the value from
    `sysctl(3)` which will be an absolute or relative pathname,
    e.g. "/usr/local/bin/flisp" or  "../flisp".

    The code for (1) was adapted from old OpenBSD-specific `tmux` code
    that has since been abandoned by the author only because he deemed
    it "too expensive".  For that code, see

    8c259f562b/tree/osdep-openbsd.c

(2) Since we now only have "flisp", we need to find out where it is
    located on the system.  We assume that a program like the shell
    had to crawl `PATH` to find "flisp"; hence we do the same.

    The code for (2) was adapted from the `which` utility in OpenBSD.
    See

    http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.bin/which/which.c?rev=1.20&content-type=text/plain

Finally, any error condition returns `NULL`, which is the same
behavior of the other `get_exename()` variants.

* Resolve relative pathnames to absolute, for OpenBSD get_exename().
2019-08-08 18:09:02 +03:00
Jeff Bezanson 28af35b9fd update README: `map` is now built in. fixes #26 2019-08-08 18:09:02 +03:00
Mark Probst 3c10ecc0be get_exename() for OSX >= 10.9 2019-08-08 18:09:02 +03:00
Jeff Bezanson bc0b56be76 fix #24, make `<=` and `>=` work on strings 2019-08-08 18:09:02 +03:00
Jeff Bezanson 55368f1e48 fix #22
segfault printing stack trace for error during evaluation of argument
default values
2019-08-08 18:09:02 +03:00
Rick Hanson fe6948e421 Make FreeBSD a "first class citizen" among femtolisp's build OSes.
It looks like FreeBSD should do what OpenBSD does in femtolisp's code.
The biggest change here (I think) is that of determining the correct
value of CC in the Makefile(s).  As of version 10, FreeBSD's base
compiler is clang; so there is now some logic in the Makefile(s) to
determine if the build is occurring on a FreeBSD system >= 10.0.  If
so, then the value of CC will be "clang"; otherwise, it will be "gcc",
as before.
2019-08-08 18:09:02 +03:00
Jeff Bezanson 5f3e92a99a fix a small bug in quasiquote 2019-08-08 18:09:02 +03:00
Jeff Bezanson 1ca42ea732 fix bug in file-not-found due to incomplete init of the ios_t 2019-08-08 18:09:02 +03:00
tycho luyben 8dba83c8cd Femtolisp works now on modern macs (fix from Julia) 2019-08-08 18:09:02 +03:00
Jeff Bezanson a127d46c41 fix a use-after-free memory bug 2019-08-08 18:09:02 +03:00
Jeff Bezanson eccc0513fc fix lack of error when calling builtins with the wrong number of args 2019-08-08 18:09:02 +03:00
Jeff Bezanson c81f21fdc0 remove more unused stuff 2019-08-08 18:09:02 +03:00
Jeff Bezanson a5ae9c356a simpler proxy function for list builtin 2019-08-08 18:09:02 +03:00
Jeff Bezanson 59e1bd0643 gitignore flisp.boot.bak 2019-08-08 18:09:02 +03:00
Jeff Bezanson 8334039090 remove and clean up some old files 2019-08-08 18:09:02 +03:00
James Turner 55750ca929 Allow the defining of an init file at build time
Since OpenBSD is unable to determine the pathname of a running process,
this allows us to specify the full path to flisp.boot. This will also
come in handy for system wide installs where you want flisp to live in
bin and flisp.boot to live in share or a similar location.
2019-08-08 18:09:02 +03:00
James Turner 088ea8f194 Add support for OpenBSD 2019-08-08 18:09:02 +03:00
Jon Distad c222226f43 Updated carbon path and pointer size check 2019-08-08 18:09:02 +03:00
Jeff Bezanson 2950c453c6 several minor changes and additions:
- add io.ungetc and string.isutf8
- maintain input order in delete-duplicates
- error for unicode escapes greater than 0x10ffff
- make more builtins constant (use setc instead of set)
- use prog1 in begin0 macro
- array-ref was incorrectly called array-ref! in aliases.scm
- use (void) instead of () in 0-arg C functions
- don't do arithmetic with void*
2019-08-08 18:09:02 +03:00
Jeff Bezanson 687cf8fdb5 fix bug printing custom cvalue types that lack print methods 2019-08-08 18:09:02 +03:00
Jeff Bezanson 2eef9d5a5d fix argument handling bug in fl_map1
need to pop after _applyn; functions might rewrite the stack to
contain non-values.
2019-08-08 18:09:02 +03:00
Jeff Bezanson 3ebbcbc353 add wcwidth.c for windows 2019-08-08 18:09:02 +03:00
Jeff Bezanson 25718958be change wcwidth detection
fix some compiler warnings
2019-08-08 18:09:02 +03:00
Neil d35a5d87aa adding /llt/*.a to .gitignore 2013-03-19 20:04:19 -04:00
Neil b6623413b9 added /llt/*.o to .gitignore 2013-03-19 20:01:40 -04:00
Neil 7b771097fc trying some preprocessor platform detection 2013-03-17 15:02:33 -04:00
Jeff Bezanson ee807a2cf3 fix a bug in map
faster delete-duplicates for long lists
2013-02-11 04:48:21 -05:00
Jeff Bezanson 71a1cb6f09 update tiny/lisp.c for 64-bit 2012-10-11 23:00:29 -04:00
Jeff Bezanson 2bc8ab38fd some fixes to macosx makefiles 2012-10-11 22:36:02 -04:00
Jeff Bezanson 72d1ee7522 fixing large int64 comparison bug 2012-03-15 00:21:39 -04:00
Jeff Bezanson c019b3bf2d portability improvements 2012-02-26 23:00:47 -05:00
Jeff Bezanson a7c0396a2f setting numeric locale to "C" to make sure literals are parsed correctly 2012-02-21 12:33:35 -05:00
Jeff Bezanson a39e4f366d removing leading/trailing underscores from preprocessor symbols 2012-02-20 17:43:53 -05:00
Jeff Bezanson 6ed61e66ac moving some flisp-specific code out of library 2012-02-17 23:59:45 -05:00
Jeff Bezanson 689ec946d8 removing some unused stuff 2012-02-17 19:08:50 -05:00
Jeff Bezanson bcd381bf90 a rename 2012-02-17 18:36:19 -05:00
Jeff Bezanson 2f9d6593d4 makefile updates 2012-02-17 17:58:21 -05:00
Jeff Bezanson 2b34bcfbd3 moving stuff around some more 2012-02-17 17:53:34 -05:00
Jeff Bezanson 6afa9c998f small readme fix 2012-02-17 17:42:03 -05:00
Jeff Bezanson dca4cd41d4 adding readme 2012-02-17 17:41:11 -05:00
Jeff Bezanson f1fe3edd47 some more renaming 2012-02-17 17:39:41 -05:00
Jeff Bezanson ed2b11a8ac some cleanup 2012-02-17 17:38:10 -05:00
JeffBezanson 21dd640454 some fixes to ios 2012-01-17 04:31:08 +00:00
JeffBezanson 3d25a1a672 fixing a bug in character-number comparison 2011-12-14 06:57:25 +00:00
JeffBezanson 3f4b26a46f checking for overflow in integer literals
fixing FLT_EPSILON
2011-08-16 19:59:46 +00:00
JeffBezanson 0bbfb48b9c improved implementation of backquote 2011-04-11 03:24:30 +00:00
JeffBezanson 4cd78cb562 getting rid of label
adding optional, faster built-in map
checking in soon-to-be code for quasiquote
a couple library bug fixes
2010-12-23 06:49:37 +00:00
JeffBezanson 9e07001ae0 adding \e character escape
calling GC_init when appropriate
fixing some ios bugs
adding ios_static_buffer
2010-08-28 05:07:02 +00:00
JeffBezanson 0d643a05fe fixing small exception bug 2010-08-17 02:03:11 +00:00