sogaiu
33c9395d79
Tweak file docs
2021-01-14 08:33:04 +09:00
Calvin Rose
61cca10cf6
Allow iterating through the properties of core abstract types.
2021-01-11 23:14:07 -06:00
Calvin Rose
d457aa5951
Deprecate file/popen.
...
os/spawn is the prefered way of creating a subprocess and
communicating with it.
2020-12-30 10:22:45 -06:00
Calvin Rose
1092013c2b
Merge branch 'master' into ev
2020-11-07 14:36:25 -06:00
Matthew Carter
4dffd662f0
Fix function doc to match that of C POPEN
...
It may be misleading to some user to believe it is taking a path to a
file, when it is executing an arbitrary shell command for the first argument.
2020-11-03 20:52:02 -05:00
Calvin Rose
95f4bd8e23
Merge branch 'master' into ev
2020-09-13 11:24:27 -05:00
Calvin Rose
d3147b661b
Add :pipe to os/spawn for piping to subprocess.
...
Similar to Python's subprocess.PIPE, this creates and manages pipes
automatically for the caller.
2020-09-12 19:48:12 -05:00
Calvin Rose
babfe50550
Merge branch 'master' into ev
...
Also add poll implementation for ev.
2020-09-07 12:52:50 -05:00
Calvin Rose
e7fca0051e
Add :a option to os/execute, and allow redirecting stdio.
...
This should help cover a number of common cases for
use of subprocesses. This should also eventually work well
with the ev branch via
2020-09-01 20:06:35 -05:00
Calvin Rose
6273e56886
Add janet_getjfile to C API.
2020-08-29 17:36:14 -05:00
Calvin Rose
a31e079f93
Fix import macro to not coerce everything to string.
2020-08-27 08:19:41 -05:00
Calvin Rose
30522bbf7d
Merge branch 'master' into ev
2020-08-16 17:52:36 -05:00
Calvin Rose
7b42ed66f2
Add xprint, xprin, xprintf, and xprinf.
2020-08-09 09:30:58 -05:00
Calvin Rose
1213990b7d
Merge branch 'master' into ev
2020-08-07 19:51:37 -05:00
Calvin Rose
c3af30d520
Fix broken links in README.md
2020-08-07 19:48:06 -05:00
Calvin Rose
0403e306ed
Silence warnings from some compilers.
2020-07-26 08:48:22 -05:00
Calvin Rose
409a8a3a43
Fix #452 - Bad file marshal
...
We forgot a call to janet_marshal_abstract, which corrupted the output.
2020-07-25 08:09:22 -05:00
Calvin Rose
2b36ed967c
Address some windows issues.
2020-07-03 20:13:49 -05:00
Calvin Rose
617ec7f565
Threading improvements.
...
- Add thread/exit to kill the current thread.
- Add global lock aroung custom getline and add atexit handler
- to prevent any possible issues when exiting program.
- Allow sending stderr, stdout, and stdin over thread.
2020-07-03 16:28:07 -05:00
Matthew Carter
ee94828355
Fix for double free on fclose due to GC not knowing it failed
2020-05-28 15:35:09 -04:00
Calvin Rose
e013381e72
Conditionally ignore pclose as well as popen.
2020-05-10 21:06:52 -05:00
Calvin Rose
b1f76139a7
Add several configurable options - #379
2020-05-09 12:00:01 -05:00
Andrew Chambers
057486cf56
Avoid setting O_CLOEXEC on stdin/stdout/stderr.
2020-05-09 22:26:50 +12:00
Andrew Chambers
1498fdb7b0
Tweak comment, remove extra include.
2020-05-07 20:44:04 +12:00
Calvin Rose
bdd64f5656
Merge branch 'master' of github.com:janet-lang/janet
2020-05-06 18:52:57 -05:00
Calvin Rose
dc3e9fb77c
Add CLOEXECs when getting file descriptors ( #374 )
...
This should help address leaking file descriptors in multithreaded
programs. There are a few cases where a race can occur though, as
some apis (fopen and mktemp).
2020-05-06 18:33:25 -05:00
Andrew Chambers
06c28f3a4d
Set the CLOEXEC flag on file/temp files.
2020-05-06 11:16:08 +12:00
Calvin Rose
71882475d6
janet_formatb -> janet_formatbv, new janet_formatb
...
The old function was not very useable. In the likely
case that there is no external code using this
(not well documented/janet_formatc is more convenient), we
can change this.
2020-04-14 07:38:41 -05:00
Calvin Rose
6a3a983f43
Expose abstract type definitions in janet.h
...
This makes certain operations easier, and allows
more access to built in APIs.
2020-03-14 10:12:47 -05:00
Calvin Rose
3fdc053d6c
Add flush and eflush ( #278 )
...
These functions interact with Janet's dynamically scoped
IO functions in a manner that is more useful the file/flush.
We can still redirect to a buffer without changing our code.
2020-02-03 18:14:32 -06:00
Calvin Rose
b8d530da36
Remove file/fileno and file/fdopen.
...
Also fully add call function pointer to
abstract types, including in methods, etc.
2020-01-23 09:01:33 -06:00
Andrew Chambers
46f57f5c38
Make file/close idempotent.
...
It is easier to use constructs like defer
with complex control flow if it is safe to close
a file twice.
2020-01-21 22:03:57 +13:00
Calvin Rose
2dd852da54
Use ATEND macros to add fields to abstract types.
...
This means we can add new properties to abstract types without
breaking old code. We can also make simple abstract types without
needing to add many NULL fields to the type.
2020-01-20 13:06:50 -06:00
Calvin Rose
f4077b678a
Allow calling next on abstracts.
...
This will allow the creation of infinte
streams, low cost generators, etc.
2020-01-18 18:09:20 -06:00
Calvin Rose
a68ee7aac6
Update Copyright 2020.
2020-01-12 10:50:37 -06:00
Calvin Rose
f361830cb2
Update feature test macro in line.c
2019-12-30 20:24:40 -05:00
Calvin Rose
9dd152dc28
Add features.h for feature test macros.
...
Because we use an amalgated build, feature
test macros should be set in a single file that
is included before any other headers, and is placed
at the top of the amalgamated build.
2019-12-30 19:06:15 -05:00
Calvin Rose
d0570b55b1
Merge pull request #231 from andrewchambers/tempfile
...
Add file/temp.
2019-12-29 20:00:17 -05:00
Calvin Rose
a964a95c1e
Fix warnings on BSDs.
2019-12-29 19:53:35 -05:00
Andrew Chambers
c2f8441572
Add file/temp.
2019-12-30 12:00:35 +13:00
Andrew Chambers
2bebace8eb
Extend file api to allow creating and checking.
2019-12-30 04:02:46 +13:00
Calvin Rose
022be217a2
Remove ==, not==, and order[<,<=,>,>=].
...
This unifies equality and comparison checking. Before, we had
separate functions and vm opcodes for comparing general values vs.
for comparing numbers, where the numberic functions were polymorphic and
had special cases for handling NaNs. By unfiying them, abstract types
can now better integrate with other number types and behave as keys.
For now, the old functions are aliased but will eventually be removed.
2019-12-28 16:04:15 -05:00
Andrew Chambers
ddc4274314
Expand docs to explain pclose semantics.
2019-12-28 15:24:10 +13:00
Calvin Rose
b8004555ea
Start cleaning up defines in janet.h
2019-12-15 15:41:58 -06:00
Calvin Rose
56784a34a1
Address #224 - Exposed file flags in janet.h
...
A caller can check if a file is closed with
if (flags & JANET_FILE_CLOSED) ...
2019-12-14 09:03:56 -06:00
Calvin Rose
8700a407ce
Update janet_getmethod to better match new get api.
2019-12-09 18:45:05 -06:00
Andrew Chambers
57ccfb692c
Abstract type getters can indicate key absence.
...
This change to the c api allows abstract types to indicate
to the runtime if a key was absent, or if it meant to return nil.
2019-12-09 16:50:33 +13:00
Calvin Rose
e5fbe5c557
Change printf to add trailing newlines.
...
Also add prinf and eprinf for old behavior. This
is consistent with the naming of print and prin.
2019-12-02 04:45:03 -06:00
Andrew Chambers
88f28773da
Add missing fileno method to file, sort method list.
2019-11-28 14:47:16 +13:00
Calvin Rose
c9521e093e
Fix windows issue with (file/read file :all)
...
When file was created with file/popen, the current optimization
of using fseek on windows fails due to windows not properly returning
and error code and just returning 0. Windows :(.
2019-11-11 20:05:00 -05:00