Commit Graph

81 Commits

Author SHA1 Message Date
Doug Currie 028cd4960d Fix parsetime to initialize timezone, issue #34. 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
Mark Probst 3c10ecc0be get_exename() for OSX >= 10.9 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 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 c81f21fdc0 remove more unused stuff 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 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 7b771097fc trying some preprocessor platform detection 2013-03-17 15:02:33 -04:00
Jeff Bezanson 2bc8ab38fd some fixes to macosx makefiles 2012-10-11 22:36:02 -04:00
Jeff Bezanson c019b3bf2d portability improvements 2012-02-26 23:00:47 -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
JeffBezanson 21dd640454 some fixes to ios 2012-01-17 04:31:08 +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 eaac150672 misc. updates, mostly about portability and warnings
removing some unnecessary #includes
2010-08-04 19:03:19 +00:00
JeffBezanson 8ea6157c15 some LLT fixes
improve portability of byte order test
2010-05-14 21:01:00 +00:00
JeffBezanson 46009027c2 fixing a 64-bit issue and a nan issue 2010-05-09 00:42:37 +00:00
JeffBezanson a2b57453cb adding interoperability with boehm gc if BOEHM_GC is defined 2010-05-02 20:36:39 +00:00
JeffBezanson 8d7576250d porting over some minor changes to LLT 2010-05-02 18:28:53 +00:00
JeffBezanson 45c11c944b porting over some small LLT fixes 2010-04-10 04:25:59 +00:00
JeffBezanson 716a6447f9 adding arraylist to LLT 2010-03-05 18:08:31 +00:00
JeffBezanson 7d652f9c5a some LLT cleanup:
making allocation functions customizable
  adding ios_vprintf
  simplifying config variables for mac
2010-02-25 04:37:33 +00:00
JeffBezanson 1649e64ad3 putting llt_init in a separate file 2010-01-06 20:27:04 +00:00
JeffBezanson 219ffb7e63 clarifying which values are unspecified, and making the unspecified value
true, since only #f should be false.
removing not-really-used definitions of true and false, which just seem to
  be asking for conflicts
2010-01-06 18:27:28 +00:00
JeffBezanson be453f2ed5 improving portability to Mac OS
fixes for big endian architectures (PowerPC)
renaming exported symbol raise to fl_raise
fixing some bugs and oversights discovered in the process
2009-08-29 00:54:51 +00:00
JeffBezanson 12b9013744 changes to support mac compilation better. patches from Stefan. 2009-08-24 01:11:36 +00:00
JeffBezanson 37a23afb3c adding io.peekc, top-level-bound? (alias)
fixing behavior of number?
fixing bugs in get-output-string, setting eof
2009-08-23 05:07:46 +00:00
JeffBezanson 626801fd1f adding => form of cond clauses
adding path.exists?
R6RS psyntax simple example now works
2009-08-14 03:17:21 +00:00
JeffBezanson 9ed9a51786 adding *print-level* and *print-length*
fixing open-string-output-port (R6RS)
making io.tostring! more consistent
adding newlines to boot file; wastes space but will allow more
  efficient diffing
2009-08-13 04:09:35 +00:00
JeffBezanson db94d6ef1f adding offset and count arguments to io.write
making io.write output chars as utf8;
  suddenly switching to UTF32 was not intuitive
adding stream argument to newline (R6RS)
adding several more scheme compatibility procedures
2009-08-09 04:04:31 +00:00
JeffBezanson 3fbd5e7da6 adding functions io.copy, io.readall, time.fromstring
adding srfi-6 (string ports) functions
removing unnecessary behavior of sometimes printing int32s and int64s in
  hexadecimal
2009-08-08 23:43:12 +00:00
JeffBezanson 08787a01cd fixing use of an undefined behavior that was breaking compiles occasionally 2009-07-29 02:32:23 +00:00
JeffBezanson 88d08edecc adding io.pos, io.readlines, read-all
fixing a small ios bug
2009-07-22 03:50:57 +00:00
JeffBezanson 943c0d71d1 tiny performance tweaks: removing some variables, making some static 2009-06-09 18:46:02 +00:00
JeffBezanson 27a3e413d3 adding opcodes loada0, loada1, loadc00, loadc01
adding offset and count arguments to dump
2009-06-08 03:22:32 +00:00
JeffBezanson c42ee12d4c allowing multiple expressions in lambda
making cond a macro
increasing size limit for cvalues on the managed heap, and inline
  allocated hashtables
2009-05-29 04:38:50 +00:00
JeffBezanson c38c47d264 adding R6RS div, mod, div0, mod0
small improvement to cmp_eq
explicit -fomit-frame-pointer was causing test failures with gcc4.3.2
2009-05-14 17:54:59 +00:00
JeffBezanson ae2a4dd156 adding integer division function div
changing / to do real division always
fixing equal? to distinguish -0.0 and 0.0
making equal? and eqv? false on numbers of different exactness
2009-05-14 01:30:25 +00:00
JeffBezanson ad4a086790 converting for to a special form
adding loadi8 instruction
cleaning up numeric comparison, reducing repeated code
2009-04-16 03:05:38 +00:00
JeffBezanson 36a209cd5f making = a builtin
fixing = and eqv? to work properly on NaNs
fixing other comparison predicates to be consistent
2009-04-15 23:54:43 +00:00
JeffBezanson 8e78e4cdbb making some utf8 routines more robust against invalid data
implementing tail position in compiler
adding arg count checking for instructionized builtins
2009-04-02 02:22:38 +00:00
JeffBezanson 2ddbac400a fixing bug in hash table. growth schedule made it possible for
maxprobe to decrease, causing growth during rehashing, which leaks
the table.
2009-03-28 23:46:02 +00:00