Commit Graph

306 Commits

Author SHA1 Message Date
Lassi Kortela d69e40aa3a Delete unused C file 2019-08-09 18:22:10 +03:00
Lassi Kortela 1caa8f9cf3 Update copyright statement in LICENSE file 2019-08-09 18:10:54 +03:00
Lassi Kortela 85efbbc7ce Sort C file names in build.sh 2019-08-09 17:30:49 +03:00
Lassi Kortela b4c3c64f94 Generate new boot image after tabs-to-spaces conversion 2019-08-09 17:25:13 +03:00
Lassi Kortela 04b3c3b292 Replace tabs with spaces in Lisp printer 2019-08-09 17:25:13 +03:00
Lassi Kortela be9b2b364e Clean up whitespace
- Tabs to spaces
- Remove invisible whitespace at ends of lines
- Break or shorten long lines (not for all files)
2019-08-09 17:25:13 +03:00
Lassi Kortela 09c6368668 Run renamed .inc files by clang-format for the first time 2019-08-09 17:25:13 +03:00
Lassi Kortela 4128fbc535 Rename .inc files to use .h extension 2019-08-09 17:18:21 +03:00
Lassi Kortela 8e35d98142 Move bootstrap images into a scheme-boot directory 2019-08-09 15:53:31 +03:00
Lassi Kortela aaf73c8439 Consolidate all Lisp files into scheme-* with .scm extension 2019-08-09 15:21:56 +03:00
Lassi Kortela d6f54bc13c Consolidate all C files into a "c" subdirectory 2019-08-09 15:02:58 +03:00
Lassi Kortela 53e6421ce1 Remove curiosity files from tree 2019-08-09 15:02:04 +03:00
Lassi Kortela 349a42510f Replace makefiles with a simple shell script
Build, bootstrap and test everything in one go. Put build artifacts in a
separate subdirectory which is emptied at the start of every build.
2019-08-09 14:56:16 +03:00
Lassi Kortela 82e09fa92b Avoid clang warnings about undefined signed shift behavior
Calls to fixnum(-1) would cause them.
2019-08-09 14:06:36 +03:00
Lassi Kortela b128aee83d Add .editorconfig file to match clang-format 2019-08-09 14:03:13 +03:00
Lassi Kortela 6a6a7071a9 Run clang-format on all C code for the first time 2019-08-09 14:02:02 +03:00
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