<commit_before>/********************\
 * owl lisp runtime *
\********************/

/* todo: could be more convenient to have instructions fadd a b → hi lo, fsub a b → borrow a' */
/* todo: control gc from lisp side? */

#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <inttypes.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>

#ifdef WIN32 
#include <winsock2.h>
#include <ws2tcpip.h>
#include <conio.h>
#include <windows.h>
typedef unsigned long in_addr_t;
#define EWOULDBLOCK WSAEWOULDBLOCK
#else
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/wait.h>
#define O_BINARY 0
#endif

/* prim_sys requirements */
#include <dirent.h>  // opendir
DIR *opendir(const char *name);
DIR *fdopendir(int fd);
#include <string.h>
size_t strlen(const char *s);
/* sys_mirp */

/* possibly enable SECCOMP support if we are on newish Linux, and exit via syscall to avoid calling exit_group in some libcs */
#ifdef __gnu_linux__
#include <sys/prctl.h>
#include <sys/syscall.h>
#define EXIT(n) syscall(__NR_exit, n)
#else
#define EXIT(n) exit(n)
#endif

void set_nonblock (int sock) {
#ifdef WIN32
   unsigned long flags = 1;
   if(sock>3) { /* stdin is handled differently, out&err block */
      ioctlsocket(sock, FIONBIO, &flags);
   }
#else
   fcntl(sock, F_SETFL, O_NONBLOCK);
#endif
}

#define word uintptr_t
#define W    sizeof(word)
#define NWORDS 1024*1024*8  /* static malloc'd heap size if used as a library */

#define V(ob) *((word *) ob)
<commit_msg>avoiding compiler control complaint by exit():ing after syscalling _exit<commit_after>/********************\
 * owl lisp runtime *
\********************/

/* todo: could be more convenient to have instructions fadd a b → hi lo, fsub a b → borrow a' */
/* todo: control gc from lisp side? */

#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <inttypes.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>

#ifdef WIN32 
#include <winsock2.h>
#include <ws2tcpip.h>
#include <conio.h>
#include <windows.h>
typedef unsigned long in_addr_t;
#define EWOULDBLOCK WSAEWOULDBLOCK
#else
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/wait.h>
#define O_BINARY 0
#endif

/* prim_sys requirements */
#include <dirent.h>  // opendir
DIR *opendir(const char *name);
DIR *fdopendir(int fd);
#include <string.h>
size_t strlen(const char *s);
/* sys_mirp */

/* possibly enable SECCOMP support if we are on newish Linux, and exit via syscall to avoid calling exit_group in some libcs */
#ifdef __gnu_linux__
#include <sys/prctl.h>
#include <sys/syscall.h>
#define EXIT(n) syscall(__NR_exit, n); exit(n) /* exit only needed to avoid compiler complaints */
#else
#define EXIT(n) exit(n)
#endif

void set_nonblock (int sock) {
#ifdef WIN32
   unsigned long flags = 1;
   if(sock>3) { /* stdin is handled differently, out&err block */
      ioctlsocket(sock, FIONBIO, &flags);
   }
#else
   fcntl(sock, F_SETFL, O_NONBLOCK);
#endif
}

#define word uintptr_t
#define W    sizeof(word)
#define NWORDS 1024*1024*8  /* static malloc'd heap size if used as a library */

#define V(ob) *((word *) ob)

{'fraction_non_alphanumeric': 0.16199756394640683, 'fraction_numerical': 0.010962241169305725, 'mean_word_length': 4.465890183028286, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5569867', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1214, 'n_words': 380}