Commit Graph

84 Commits

Author SHA1 Message Date
Kamil Rytarowski 48ff4764a4 Add NetBSD support
$ make test
cd tests && ../flisp unittest.lsp
all tests pass
2020-03-08 02:36:54 +02:00
Pouar 8964eb4f8d use _XOPEN_SOURCE instead of manually prototyping wcwidth, also avoids a
conflict in musl
2018-01-01 20:15:17 -06:00
Carlo Dapor 5d480a2944 Both clang and gcc define both MACOSX and ARCH_X86_64, no need to explicitly define them in the Makfiles. 2017-08-13 20:15:45 +02:00
Doug Currie b36d4fbf5d Fix parsetime to initialize timezone, issue #34. 2016-11-16 10:52:58 -05:00
Rick Hanson 6bc3fe5f11 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().
2016-11-15 15:12:14 -05:00
Mark Probst 49ec8cf379 get_exename() for OSX >= 10.9 2015-05-06 15:36:41 -07:00
Rick Hanson 74041edf56 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.
2015-04-11 15:21:02 -04:00
Jeff Bezanson 8f04eea847 fix bug in file-not-found due to incomplete init of the ios_t 2014-05-22 18:09:49 -04:00
tycho luyben 54c441e29b Femtolisp works now on modern macs (fix from Julia) 2014-02-26 18:45:02 +01:00
Jeff Bezanson 1e6c71f655 fix a use-after-free memory bug 2013-10-22 00:25:25 -04:00
Jeff Bezanson 518415febf remove more unused stuff 2013-06-11 18:15:48 -04:00
James Turner 19a835847c Add support for OpenBSD 2013-06-03 21:40:14 -04:00
Jon Distad 3707cc21ab Updated carbon path and pointer size check 2013-05-08 19:41:21 -04:00
Jeff Bezanson a0707331b8 add wcwidth.c for windows 2013-03-29 00:43:52 -04:00
Jeff Bezanson 2b105a5212 change wcwidth detection
fix some compiler warnings
2013-03-29 00:35:42 -04: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