Commit Graph

308 Commits

Author SHA1 Message Date
Lassi Kortela 0bf4243ae0 Use intptr_t and uintptr_t
Thanks @krytarowski
2020-03-17 11:38:32 +02:00
Lassi Kortela 1006496256 Use uint32_t instead of u_int32_t 2020-03-17 11:38:32 +02:00
Lars Brinkhoff 2bc5c43022 Make GitHub detect lisp files as Scheme. 2020-03-08 02:51:32 +02:00
Kamil Rytarowski 48ff4764a4 Add NetBSD support
$ make test
cd tests && ../flisp unittest.lsp
all tests pass
2020-03-08 02:36:54 +02:00
Lassi Kortela 956fd32a06 Use stdint.h instead of sys/types.h 2020-02-26 11:26:50 +02:00
Lassi Kortela 2abf82a0e8 Update .gitignore 2020-02-26 11:18:18 +02:00
Lassi Kortela 01890ff233 Use NUM_FORMAT in all tiny interpreters
Avoids compiler warnings about printf()
2020-02-26 11:16:19 +02:00
Lassi Kortela fe8b7a7029 Sort includes 2020-02-26 11:06:19 +02:00
Lassi Kortela dc90139bc0 Fix 64-bit builds of tiny interpreters 2020-02-26 11:00:08 +02:00
Jeff Bezanson ec7601076a
Merge pull request #54 from pouar/xopen
#define _XOPEN_SOURCE instead of prototyping wcwidth
2019-06-06 19:55:40 -04:00
Jeff Bezanson 70c805fb3f replace use of "TCO" in README. closes #55 2019-06-06 19:53:52 -04:00
Jeff Bezanson d3d3c35ffa fix part of #53, assertion failure on invalid dotted list 2019-06-06 19:48:54 -04:00
Jeff Bezanson dc62177323 fix part of #53, error check for invalid `set!` location 2019-06-06 19:42:09 -04:00
Jeff Bezanson 2d5cb51afb fix part of #53, assertion failure in print_traverse 2019-06-06 19:34:00 -04: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
Jeff Bezanson 983c8476aa Merge pull request #52 from jniewerth/patch-2
Fix "use-after-relocate" in stream_to_string
2017-08-21 11:23:36 -04:00
jniewerth 547876db1c Fix "use-after-relocate" in stream_to_string
cvalue_string() can cause a gc - this potentially makes the ios_t-pointer that is cached in the local variable "st" invalid.
2017-08-20 13:30:03 +02:00
Jeff Bezanson 643c304125 add math library functions sqrt, exp, log, sin, cos, tan, asin, acos, atan 2017-08-19 14:54:32 -04:00
Jeff Bezanson bc646bd7a1 don't print-circle in `princ` mode 2017-08-19 14:19:56 -04:00
Jeff Bezanson 74d4de6ad5 add function `char-alphabetic?` 2017-08-19 14:19:23 -04:00
Jeff Bezanson b2d6548715 fix bug in printing the character #\x0 2017-08-19 14:18:32 -04:00
Jeff Bezanson 4e5319a7dc lower `BOUNDED_COMPARE_BOUND`, allowing r7rs `equal` benchmark to complete 2017-08-19 12:38:17 -04:00
Jeff Bezanson 016b839ff4 some printing improvements
- don't print shared references to cprims, and estimate their
  size better. previously you could get output like this:

```
(#0=#\a
 #0#)
```

Now it looks like:

```
(#\a #\a)
```

- print `#\ ` and `#\newline` instead of `#\space` and `#\linefeed`.
  these seem to be more standard.
2017-08-19 12:27:27 -04:00
Jeff Bezanson 44f7d8fd25 Merge pull request #51 from dcurrie/type-artype-overconstrained
Eliminated caching of over-constrained array types for cvalues
2017-08-19 02:21:18 -04:00
Jeff Bezanson 2ee81ef43e Merge pull request #50 from catull/fix-warnings
Fix warnings
2017-08-18 18:46:54 -04:00
Doug Currie 0418c645cf Eliminated caching of overconstrained array types for cvalues 2017-08-18 13:48:32 -04: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
Carlo Dapor 9f2575ce5e Argument to abs() is actually long, not int, thus use labs(). 2017-08-13 20:03:13 +02:00
Doug Currie 19cecdac20 Fix dropped GC root in fl_vector_alloc (#48) 2017-08-09 16:59:04 -04:00
Jeff Bezanson 2afeb42f92 Merge pull request #49 from dcurrie/fl_add_any-and-fl_mul_any_should-not-inexact-
Fix * and + to return inexact when given inexact args.
2017-08-09 15:22:04 -04:00
Doug Currie 2bb1c980e2 Fix * and + to return inexact when given inexact args. 2017-08-09 14:21:29 -04:00
Jeff Bezanson db4982b0ed Merge pull request #47 from jniewerth/patch-1
gc_handle buf earlier in fl_string to prevent segfaults
2017-07-13 15:43:18 -04:00
jniewerth d49122bb81 gc_handle buf earlier in fl_string to prevent segfaults 2017-07-12 15:10:19 +02:00
Jeff Bezanson d96227948b Merge pull request #40 from Ismael-VC/patch-1
Add Gitter badge.
2017-01-03 01:18:34 -05:00
Ismael Venegas Castelló 89310f69ea Add Gitter badge.
I've just opened a Gitter chat room with the hopes, that I can learn femtolisp and contribute to the Julia parser.

> # Welcome fellow femto lispers!

> Welcome @/all you have all been invited to this chat room because I noticed your interest of FemtoLisp, either by chatting directly, forking, staring, watching the femtolisp repository or one of the repositories from FemtoEmacs!  

> I hope we can meet, learn and teach this programming language together, please let anyone know who might me interested about this chat room, below are some common resources that I have just recently found:

> * FemtoLisp: https://github.com/JeffBezanson/femtolisp
> * FemtoEmacs: https://github.com/FemtoEmacs/Femto-Emacs
> * FemtoDocs: https://github.com/FemtoEmacs/femtodocs

> I want to learn flisp primary in order to understand the Julia programming language parser, I hope I can contribute documenting, proof reading raising issues and pull requests.

> I wish happy new year to everyone from Mexico!

> Bless the `femtolisp` maker! - AKA @JeffBezanson :D
2017-01-02 09:22:41 -06:00
Jeff Bezanson 4087d6af96 Merge pull request #37 from dcurrie/issue-#34
Fix parsetime to initialize timezone, issue #34.
2016-11-16 11:31:16 -05:00
Doug Currie b36d4fbf5d Fix parsetime to initialize timezone, issue #34. 2016-11-16 10:52:58 -05:00
Doug Currie 8342f9a1e9 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.
2016-11-15 17:49:18 -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
Jeff Bezanson 47b3876d57 update README: `map` is now built in. fixes #26 2016-09-23 16:06:44 -04:00
Jeff Bezanson bf5e0d2210 Merge pull request #18 from schani/master
get_exename() for OSX >= 10.9
2016-09-17 14:43:59 -04:00
Jeff Bezanson 41504aa58b fix #24, make `<=` and `>=` work on strings 2016-09-17 14:30:05 -04:00
Jeff Bezanson 68c5b12255 fix #22
segfault printing stack trace for error during evaluation of argument
default values
2016-08-09 22:58:44 -04:00
Mark Probst 49ec8cf379 get_exename() for OSX >= 10.9 2015-05-06 15:36:41 -07:00
Jeff Bezanson 2923137ef0 Merge pull request #16 from cryptorick/freebsd-first-class
Make FreeBSD a "first class citizen" among femtolisp's build OSes.
2015-04-19 19:04:32 -04: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 ff34b09a3c fix a small bug in quasiquote 2015-02-15 17:09:40 -05: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
Jeff Bezanson 27b18d04d0 Merge pull request #12 from tluyben/master
Femtolisp works now on modern macs (fix from Julia)
2014-02-26 13:11:16 -05:00
tycho luyben 54c441e29b Femtolisp works now on modern macs (fix from Julia) 2014-02-26 18:45:02 +01:00