mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
* feat!: move C library wrapper funtions to IO.Raw * docs: fixed doc string for (String.allocated?) * docs: removed superfluous parameter names for defns * fix: replaces IO.exit by System.exit * fix: ./test/regression.carp for (IO.read->EOF) * fix: ./test/system.carp * feat: implemented IO.fwrite! * feat!: removed IO.exit * feat!: raw character input now returns Int instead of Char * fix: removed irritating space chars * fix: repaired ./example/carp_demo.carp * fix: reverted System.exit to return an Int for SDL examples * fix: removed System.exit! Co-authored-by: guberatsie <gunnar.bernhardt@siemens.com>
42 lines
627 B
C
42 lines
627 B
C
void System_free(void *p) {
|
|
CARP_FREE(p);
|
|
}
|
|
|
|
int System_time() {
|
|
return time(0);
|
|
}
|
|
|
|
#ifdef _WIN32
|
|
void System_sleep_MINUS_seconds(int t) {
|
|
// TODO!
|
|
}
|
|
|
|
void System_sleep_MINUS_micros(int t) {
|
|
// TODO!
|
|
}
|
|
|
|
double System_nanotime() {
|
|
return 0;
|
|
}
|
|
#else
|
|
void System_sleep_MINUS_seconds(int t) {
|
|
sleep(t);
|
|
}
|
|
|
|
void System_sleep_MINUS_micros(int t) {
|
|
usleep(t);
|
|
}
|
|
|
|
double System_nanotime() {
|
|
struct timespec tv;
|
|
clock_gettime(CLOCK_REALTIME, &tv);
|
|
return 1000000000 * tv.tv_sec + tv.tv_nsec;
|
|
}
|
|
#endif
|
|
|
|
int System_system(const String *command) {
|
|
return system(*command);
|
|
}
|
|
|
|
Array System_args;
|