Commit graph

2099 commits

Author SHA1 Message Date
Justine Tunney
6b90ff60cd Add preliminary lua support to redbean
This change only implements enough Lua support to send a Hello World
response. The redbean executable size increases from ~128kb to 260kb
and the requests per second decreases from 1000k to 600k. That's the
fastest it can go and that's extremely impressive compared to Python

See #97
2021-03-21 17:27:53 -07:00
fabriziobertocci
2f41b4dcc6
Add prototype for srandom() (#132) 2021-03-21 07:33:33 -07:00
fabriziobertocci
5af25f687a
Rename eai2str to gai_strerror (#131) 2021-03-20 20:48:40 -07:00
Alison Winters
9c81729008
Remove unused variable in fflush (#129) 2021-03-17 20:15:00 -07:00
dosisod
8a236433a2
Add more math functions (#128) 2021-03-17 20:05:12 -07:00
Justine Tunney
ab64ef7364 Make fflush() return 0 on success (#114) 2021-03-17 13:02:15 -07:00
Justine Tunney
4177489762 Perform fine-tuning of socketpair and pipe
- removed unneeded share parameter from pipe on nt
- socktpair(type | SOCK_CLOEXEC) is now polyfilled
- use textwindows for linker micro-optimization
- apologies for auto clang-format diff noise :(
- improve socketpair docstring

See #122
2021-03-16 22:44:54 -07:00
Justine Tunney
4e93750afd Perform some minor fixups 2021-03-16 22:19:51 -07:00
fabriziobertocci
ca88ce5026
Add socketpair (#122) 2021-03-16 22:05:59 -07:00
dosisod
6388ef21f8
Add noreturn macro (#118) 2021-03-13 20:46:12 -08:00
dosisod
7ffeb29bfc
Add missing functions to tgmath (#124) 2021-03-13 20:43:57 -08:00
Justine Tunney
da4dffccc5 Add random() and srandom()
Closes #123
2021-03-13 20:24:29 -08:00
Justine Tunney
807706a099 Perform minor fixups
One of those fixups is making sure that AF_LOCAL is equal to AF_UNIX on
the New Technology. See #122
2021-03-13 19:40:04 -08:00
Justine Tunney
83d0c3b870 Fix writev() on the New Technology (#117) 2021-03-09 11:33:48 -08:00
Alison Winters
6cd1037692
Get VSCode working with Linux and WSL (#116) 2021-03-09 10:12:39 -08:00
Justine Tunney
e0566c9675 Fix Lua build config 2021-03-08 17:51:26 -08:00
Justine Tunney
3f35b37b68 Remove nonstandard defines from limits.h (#115) 2021-03-08 17:34:44 -08:00
Justine Tunney
67c27d9e6e Add Hello World example for LUA C API (#97) 2021-03-08 14:15:59 -08:00
Justine Tunney
2a3037d4e8 Delete Duktape (#97) 2021-03-08 13:17:52 -08:00
Justine Tunney
0a61fe4ea0 Add smoke test for timezone loading (#114) 2021-03-08 11:46:04 -08:00
Justine Tunney
33e8fc8687 Expose public garbage collector API for C language
You can now do epic things like this:

    puts(_gc(xasprintf("%d", 123)));

The _gc() API is shorthand for _defer() which works like Go's keyword:

    const char *s = xasprintf("%d", 123);
    _defer(free, s);
    puts(s);

Be sure to always use -fno-omit-frame-pointer which makes code fast too.

Enjoy! See also #114
2021-03-08 10:59:34 -08:00
Justine Tunney
0ad609268f Improve system call polyfills
- Polyfill open() w/ O_CLOEXEC on RHEL5
- Remove old workaround from rmdir() on the New Technology
- preadv() and pwritev() are now smarter about demodernization
- preadv() and pwritev() are now available on the New Technology
2021-03-08 10:07:02 -08:00
Justine Tunney
816b0e1851 Improve tmpfile api (#114) 2021-03-07 21:08:27 -08:00
Justine Tunney
2bd1e72d5a Remove garbage collector macro from header (#114)
We can put this back the moment someone requests it. Pain-free garbage
collection for the C language is pretty cool. All it does is overwrite
the return address with a trampoline that calls free(). It's not clear
what it should be named if it's made a public API.
2021-03-07 20:23:29 -08:00
Justine Tunney
5ce83b08c8 Add posix_spawn (#114) 2021-03-07 20:14:07 -08:00
Justine Tunney
5f088cec23 Rename Lua test folder 2021-03-07 18:22:53 -08:00
Justine Tunney
a8945714e8 Make gdtoa less tunable (#104)
The -fno-math-errno flag shouldn't impact libraries since it's mostly
intended for permitting the compiler to generate sqrt() instructions.
2021-03-07 16:41:59 -08:00
Alison Winters
8a6ac6dd63
Set errno when out of range in strtoimax (#111) 2021-03-07 14:38:56 -08:00
Alison Winters
f5da4efcaf
Set errno in strtol family of functions (#110) 2021-03-07 14:18:08 -08:00
Justine Tunney
b16b332539 Get Lua to build with all tests passing
Fixes #61
2021-03-07 13:31:09 -08:00
Justine Tunney
4d3195f57a Add Lua 2021-03-07 12:50:34 -08:00
Justine Tunney
aad841610e Fix freopen so it resets stream buffer (#61) 2021-03-07 12:12:02 -08:00
Justine Tunney
7583b3accc Show better error on bind() error
See #51
2021-03-07 11:31:44 -08:00
Justine Tunney
06a4e2d29b Disable Travis emails 2021-03-07 08:29:43 -08:00
dosisod
67b9675c81
Make tgmath.h available (#109) 2021-03-06 22:40:18 -08:00
Justine Tunney
4d4aa9e791 Add automatic tests for pull requests
Now when you send a pull request Travis CI will build the entire
repository and run all the tests for you automatically. It takes
approximately two minutes to finish so you can get fast feedback
2021-03-06 21:39:03 -08:00
Alison Winters
813e11b90b
Fix int parsing with base 2 and 16 (#107) 2021-03-06 21:12:32 -08:00
dosisod
fb7b7c6e21
Fix isystem headers including wrong files (#108) 2021-03-06 21:06:29 -08:00
Justine Tunney
d769df3482 Fix issues with stdio needed for Lua
See #61
2021-03-06 19:04:26 -08:00
Justine Tunney
c3ed8d6c7f Make %p consistent with glibc and musl
See #61
2021-03-06 14:36:44 -08:00
Justine Tunney
937d921018 Add tests for the greatest of all libm functions 2021-03-06 12:59:35 -08:00
Justine Tunney
bfef17eb6d Add more math fixes 2021-03-06 11:44:40 -08:00
Justine Tunney
11ec99931b Add Musl multibyte functions
These are standard functions that are needed to help support the Skull
language. Note that normally this codebase uses libc/str/thompike.h

See #105
2021-03-06 09:53:16 -08:00
Justine Tunney
cfd453d125 Add more real formatting tests
See #61
2021-03-06 08:45:44 -08:00
dosisod
6fa049c9c7
Add macro for static_assert (#106) 2021-03-05 20:32:25 -08:00
Justine Tunney
3364fc5b03 Add modf(), modff(), and modfl()
See #104
2021-03-05 10:47:14 -08:00
Justine Tunney
f064183646 Support proper %g, %f, and %a float formatting
See #61
See #104
2021-03-05 10:31:16 -08:00
Justine Tunney
e26bdbec52 Make examples folder somewhat more focused 2021-03-05 06:09:12 -08:00
Justine Tunney
5141d00992 Perform some minor code cleanup 2021-03-04 13:22:32 -08:00
Justine Tunney
b9f73e6a4d Clarify APE self-modifying behavior in README
See #102
2021-03-04 07:54:41 -08:00