move some headers & defs around

This commit is contained in:
dzaima 2021-05-25 00:51:09 +03:00
parent 899175f48b
commit 50e76c8c04
7 changed files with 29 additions and 31 deletions

View File

@ -26,10 +26,7 @@ static void gsReserve(u64 am) {
#endif
}
#ifdef GS_REALLOC
NOINLINE
#endif
static void gsReserveR(u64 am) { gsReserve(am); }
static NOINLINE void gsReserveR(u64 am) { gsReserve(am); }
static inline void gsAdd(B x) {

View File

@ -8,6 +8,28 @@ B bi_N, bi_noVar, bi_badHdr, bi_optOut, bi_noFill, bi_emptyHVec, bi_emptyIVec, b
CTR_FOR(F)
#undef F
char* format_pf(u8 u) {
switch(u) { default: return "(unknown function)";
#define F(N,X) case pf_##N: return X;
FOR_PFN(F,F,F)
#undef F
}
}
char* format_pm1(u8 u) {
switch(u) { default: return"(unknown 1-modifier)";
#define F(N,X) case pm1_##N: return X;
FOR_PM1(F,F,F)
#undef F
}
}
char* format_pm2(u8 u) {
switch(u) { default: return"(unknown 2-modifier)";
#define F(N,X) case pm2_##N: return X;
FOR_PM2(F,F,F)
#undef F
}
}
NOINLINE void arr_print(B x) { // should accept refc=0 arguments for debugging purposes
ur r = rnk(x);
BS2B xgetU = TI(x).getU;

View File

@ -1,7 +1,5 @@
extern u64 allocB; // currently allocated number of bytes
#include <sys/mman.h>
#include <unistd.h>
// memory defs
@ -130,6 +128,9 @@ NOINLINE B append_fmt(B s, char* p, ...);
// function stuff
char* format_pf(u8 u);
char* format_pm1(u8 u);
char* format_pm2(u8 u);
bool isPureFn(B x); // doesn't consume
B bqn_merge(B x); // consumes
B bqn_squeeze(B x); // consumes

25
src/h.h
View File

@ -185,35 +185,10 @@ enum PrimMd2 { pm2_none,
#undef F
};
static char* format_pf(u8 u) {
switch(u) { default: return "(unknown function)";
#define F(N,X) case pf_##N: return X;
FOR_PFN(F,F,F)
#undef F
}
}
static char* format_pm1(u8 u) {
switch(u) { default: return"(unknown 1-modifier)";
#define F(N,X) case pm1_##N: return X;
FOR_PM1(F,F,F)
#undef F
}
}
static char* format_pm2(u8 u) {
switch(u) { default: return"(unknown 2-modifier)";
#define F(N,X) case pm2_##N: return X;
FOR_PM2(F,F,F)
#undef F
}
}
#define F(N,X) extern B bi_##N;
FOR_PFN(F,F,F)
#undef F
#define F(N,X) extern B bi_##N;
FOR_PM1(F,F,F)
#undef F
#define F(N,X) extern B bi_##N;
FOR_PM2(F,F,F)
#undef F

View File

@ -1,4 +1,5 @@
#include "gc.h"
#include <sys/mman.h>
typedef struct EmptyValue EmptyValue;
struct EmptyValue { // needs set: mmInfo; type=t_empty; next; everything else can be garbage

View File

@ -1,4 +1,5 @@
#include "gc.h"
#include <sys/mman.h>
typedef struct EmptyValue EmptyValue;
struct EmptyValue { // needs set: mmInfo; type=t_empty; next; everything else can be garbage

View File

@ -1,3 +1,4 @@
#include <unistd.h>
#include "core.h"
#include "vm.h"
#include "ns.h"