Carp/core/core.h

38 lines
547 B
C
Raw Normal View History

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"
#include <stddef.h>
#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-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;
// Lambdas
typedef struct {
void *callback;
void *env;
void *delete;
void *copy;
} Lambda;
2018-06-19 10:19:54 +03:00
typedef void* LambdaEnv;
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