Commit Graph

590 Commits

Author SHA1 Message Date
Lassi Kortela 7ab81c9e56 Change some more clang-format settings to my liking 2019-08-09 13:59:27 +03:00
Lassi Kortela 0fdee2f7b8 Change clang-format to keep "} else" brace on same line 2019-08-09 13:59:18 +03:00
Lassi Kortela 0270f8628d Change clang-format AlignEscapedNewlines setting
whatstyle didn't catch that the original codebase is aligning
backslashes at the ends of lines in long preprocessor macro
definitions. The "Left" setting closely matches the original code.
2019-08-09 13:58:51 +03:00
Lassi Kortela 8c85386640 Run whatstyle to derive clang-format settings
find . -name "*.c" | xargs whatstyle --formatter clang-format
2019-08-09 13:47:35 +03:00
Lassi Kortela 32c77aefbc Add scripts/format.sh
Runs clang-format on all our C code
2019-08-09 13:47:35 +03:00
Lassi Kortela ff266c8862 Delete attic directory 2019-08-08 18:20:01 +03:00
Lassi Kortela 4a23167463 Add .mailmap file for Git 2019-08-08 18:12:32 +03:00
Pouar c753bb3e76 use _XOPEN_SOURCE instead of manually prototyping wcwidth, also avoids a
conflict in musl
2019-08-08 18:09:02 +03:00
Jeff Bezanson b04d8035c8 replace use of "TCO" in README. closes #55 2019-08-08 18:09:02 +03:00
Jeff Bezanson f3137447c8 fix part of #53, assertion failure on invalid dotted list 2019-08-08 18:09:02 +03:00
Jeff Bezanson 245d472567 fix part of #53, error check for invalid `set!` location 2019-08-08 18:09:02 +03:00
Jeff Bezanson 150a160960 fix part of #53, assertion failure in print_traverse 2019-08-08 18:09:02 +03:00
jniewerth 0b6dd2ca11 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.
2019-08-08 18:09:02 +03:00
Jeff Bezanson 54a10c2f4f add math library functions sqrt, exp, log, sin, cos, tan, asin, acos, atan 2019-08-08 18:09:02 +03:00
Jeff Bezanson fa73ead610 don't print-circle in `princ` mode 2019-08-08 18:09:02 +03:00
Jeff Bezanson 6a0a16c960 add function `char-alphabetic?` 2019-08-08 18:09:02 +03:00
Jeff Bezanson 20a768b4d7 fix bug in printing the character #\x0 2019-08-08 18:09:02 +03:00
Jeff Bezanson 654fe0576a lower `BOUNDED_COMPARE_BOUND`, allowing r7rs `equal` benchmark to complete 2019-08-08 18:09:02 +03:00
Jeff Bezanson 75455f4029 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.
2019-08-08 18:09:02 +03:00
Doug Currie 11b5964376 Eliminated caching of overconstrained array types for cvalues 2019-08-08 18:09:02 +03:00
Carlo Dapor ee74500850 Both clang and gcc define both MACOSX and ARCH_X86_64, no need to explicitly define them in the Makfiles. 2019-08-08 18:09:02 +03:00
Carlo Dapor 85e2a1b458 Argument to abs() is actually long, not int, thus use labs(). 2019-08-08 18:09:02 +03:00
Doug Currie c8cea26d61 Fix dropped GC root in fl_vector_alloc (#48) 2019-08-08 18:09:02 +03:00
Doug Currie 901621b9c5 Fix * and + to return inexact when given inexact args. 2019-08-08 18:09:02 +03:00
jniewerth 83fe48525f gc_handle buf earlier in fl_string to prevent segfaults 2019-08-08 18:09:02 +03:00
Ismael Venegas Castelló 96d31afc0a 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
2019-08-08 18:09:02 +03:00
Doug Currie 028cd4960d Fix parsetime to initialize timezone, issue #34. 2019-08-08 18:09:02 +03:00
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