Skip to content
Myr

compile.h

This file

Path

src/compile.h

105 lines · 3.6 KiB · C

Last changed by

Reject embedded NUL bytes in module import pathsitchynybefore adoption9d223f1

History of this file

Take it

The walk stopped after 200 commits: lines older than fa6a2ff point at it.

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 1–18why, one step back
1#ifndef COMPILE_H
2#define COMPILE_H3#include <stdint.h>4#include "jv.h"5#include "bytecode.h"6#include "locfile.h"78struct inst;9typedef struct inst inst;101112typedef struct block {13 inst* first;14 inst* last;15} block;1617block gen_location(location, struct locfile*, block);18

Fix warning: a function definition without a prototype is deprecated (#3259)itchynybefore adoptiona8f27cc

line 19why, one step back
19block gen_noop(void);

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 20–35why, one step back
20int block_is_noop(block b);
21block gen_op_simple(opcode op);22block gen_error(jv constant);23block gen_const(jv constant);24block gen_const_global(jv constant, const char *name);25int block_is_const(block b);26jv_kind block_const_kind(block b);27jv block_const(block b);28block gen_op_target(opcode op, block target);29block gen_op_unbound(opcode op, const char* name);30block gen_op_bound(opcode op, block binder);31block gen_op_var_fresh(opcode op, const char* name);32block gen_op_pushk_under(jv constant);3334block gen_module(block metadata);35jv block_module_meta(block b);

Reject embedded NUL bytes in module import pathsitchynybefore adoption9d223f1

line 36why, one step back
36block gen_import(jv name, jv as, int is_data);

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 37–105why, one step back
37block gen_import_meta(block import, block metadata);
38block gen_function(const char* name, block formals, block body);39block gen_param_regular(const char* name);40block gen_param(const char* name);41block gen_lambda(block body);42block gen_call(const char* name, block body);43block gen_subexp(block a);44block gen_both(block a, block b);45block gen_const_object(block expr);46block gen_collect(block expr);47block gen_reduce(block source, block matcher, block init, block body);48block gen_foreach(block source, block matcher, block init, block update, block extract);49block gen_definedor(block a, block b);50block gen_condbranch(block iftrue, block iffalse);51block gen_and(block a, block b);52block gen_or(block a, block b);53block gen_dictpair(block k, block v);5455block gen_var_binding(block var, const char* name, block body);56block gen_array_matcher(block left, block curr);57block gen_object_matcher(block name, block curr);58block gen_destructure(block var, block matcher, block body);59block gen_destructure_alt(block matcher);6061block gen_cond(block cond, block iftrue, block iffalse);62block gen_try(block exp, block handler);63block gen_label(const char *label, block exp);6465block gen_cbinding(const struct cfunction* functions, int nfunctions, block b);6667void block_append(block* b, block b2);68block block_join(block a, block b);69int block_has_only_binders_and_imports(block, int bindflags);70int block_has_only_binders(block, int bindflags);71int block_has_main(block);72int block_is_funcdef(block b);73int block_is_single(block b);74block block_bind_library(block binder, block body, int bindflags, const char* libname);75block block_bind_referenced(block binder, block body, int bindflags);76block block_bind_self(block binder, int bindflags);77block block_drop_unreferenced(block body);7879jv block_take_imports(block* body);80jv block_list_funcs(block body, int omit_underscores);8182int block_compile(block, struct bytecode**, struct locfile*, jv);8384void block_free(block);85868788// Here's some horrible preprocessor gunk so that code89// sequences can be constructed as BLOCK(block1, block2, block3)9091#define BLOCK_1(b1) (b1)92#define BLOCK_2(b1,b2) (block_join((b1),(b2)))93#define BLOCK_3(b1,b2,b3) (block_join(BLOCK_2(b1,b2),(b3)))94#define BLOCK_4(b1,b2,b3,b4) (block_join(BLOCK_3(b1,b2,b3),(b4)))95#define BLOCK_5(b1,b2,b3,b4,b5) (block_join(BLOCK_4(b1,b2,b3,b4),(b5)))96#define BLOCK_6(b1,b2,b3,b4,b5,b6) (block_join(BLOCK_5(b1,b2,b3,b4,b5),(b6)))97#define BLOCK_7(b1,b2,b3,b4,b5,b6,b7) (block_join(BLOCK_6(b1,b2,b3,b4,b5,b6),(b7)))98#define BLOCK_8(b1,b2,b3,b4,b5,b6,b7,b8) (block_join(BLOCK_7(b1,b2,b3,b4,b5,b6,b7),(b8)))99100#define BLOCK_IDX(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME101#define BLOCK(...) \102 BLOCK_IDX(__VA_ARGS__, BLOCK_8, BLOCK_7, BLOCK_6, BLOCK_5, BLOCK_4, BLOCK_3, BLOCK_2, BLOCK_1)(__VA_ARGS__)103104105#endif