2017-06-26 12:15:03 +03:00
|
|
|
#ifndef PRELUDE_H
|
|
|
|
#define PRELUDE_H
|
|
|
|
|
|
|
|
#include <assert.h>
|
2018-11-17 17:39:12 +03:00
|
|
|
#include "carp_stdbool.h"
|
2018-02-27 16:49:06 +03:00
|
|
|
#include <stddef.h>
|
2018-06-23 06:48:38 +03:00
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <signal.h>
|
2017-06-26 12:15:03 +03:00
|
|
|
|
2018-03-18 16:53:03 +03:00
|
|
|
typedef char* String;
|
|
|
|
typedef char* Pattern;
|
2017-11-22 18:25:05 +03:00
|
|
|
|
2017-10-13 13:48:18 +03:00
|
|
|
// Array
|
|
|
|
typedef struct {
|
2017-12-03 21:14:58 +03:00
|
|
|
size_t len;
|
2018-03-07 14:03:59 +03:00
|
|
|
size_t capacity;
|
2017-10-13 13:48:18 +03:00
|
|
|
void *data;
|
|
|
|
} Array;
|
|
|
|
|
2018-06-18 18:22:20 +03:00
|
|
|
// Lambdas
|
|
|
|
typedef struct {
|
|
|
|
void *callback;
|
|
|
|
void *env;
|
2018-08-29 16:10:41 +03:00
|
|
|
void *delete;
|
|
|
|
void *copy;
|
2018-06-18 18:22:20 +03:00
|
|
|
} Lambda;
|
|
|
|
|
2018-06-19 10:19:54 +03:00
|
|
|
typedef void* LambdaEnv;
|
2018-06-18 18:22:20 +03:00
|
|
|
|
2017-06-26 12:15:03 +03:00
|
|
|
bool not(bool b) {
|
|
|
|
return !b;
|
|
|
|
}
|
|
|
|
|
2017-10-24 15:13:45 +03:00
|
|
|
bool and(bool x, bool y) { return x && y; }
|
|
|
|
bool or(bool x, bool y) { return x || y; }
|
2017-06-26 12:15:03 +03:00
|
|
|
|
|
|
|
#endif
|