Skip to content

Commit

Permalink
🎨 no more m_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Feb 17, 2024
1 parent 90fd78b commit d7a89ce
Show file tree
Hide file tree
Showing 131 changed files with 525 additions and 604 deletions.
2 changes: 1 addition & 1 deletion ast
6 changes: 3 additions & 3 deletions include/emit.h
Expand Up @@ -82,12 +82,12 @@ ANN void* emit_localx(const Emitter emit, const Type t);
ANN m_uint emit_local_exp(const Emitter emit, Exp*);
ANN bool emit_exp_spork(const Emitter, const Exp_Unary *);

ANN void emit_object_addref(const Emitter emit, const m_int size,
ANN void emit_object_addref(const Emitter emit, const m_uint size,
const bool emit_var);
ANN void emit_struct_addref(const Emitter emit, const Type t, const m_int size,
ANN void emit_struct_addref(const Emitter emit, const Type t, const m_uint size,
const bool emit_var);
ANN static inline void emit_compound_addref(const Emitter emit, const Type t,
const m_int size,
const m_uint size,
const bool emit_var) {
return !tflag(t, tflag_struct) ? emit_object_addref(emit, size, emit_var)
: emit_struct_addref(emit, t, size, emit_var);
Expand Down
2 changes: 1 addition & 1 deletion include/env/envset.h
Expand Up @@ -19,7 +19,7 @@ ANN static inline bool envset_pushv(struct EnvSet *es, const Value v) {
es->_ctx = es->env->context;
es->_filename = es->env->name;
CHECK_B(envset_push(es, v->from->owner_class, v->from->owner));
return GW_OK;
return true;
}
ANN2(1) void envset_pop(struct EnvSet *, const Type);
#endif
2 changes: 1 addition & 1 deletion include/env/type.h
Expand Up @@ -66,7 +66,7 @@ FLAG_FUNC(Type, t)
ANN2(1, 2) ANEW Type new_type(MemPool, const m_str name, const Type);
ANEW ANN Type type_copy(MemPool, const Type type);
ANN Value find_value(const Type, const Symbol);
ANN m_bool isa(const Type, const Type) __attribute__((pure));
ANN bool isa(const Type, const Type) __attribute__((pure));
ANN bool not_reserved(const Env, const Tag); // move me
ANN Type array_type(const Env, const Type, const m_uint, const loc_t);
ANN Type find_common_anc(const Type, const Type) __attribute__((pure));
Expand Down
17 changes: 4 additions & 13 deletions include/import.h
Expand Up @@ -27,7 +27,7 @@ typedef struct Gwi_ *Gwi;
#define OP_CHECK(a) ANN Type a(const Env env NUSED, void *data NUSED)
#define OP_EMIT(a) ANN bool a(const Emitter emit NUSED, void *data NUSED)
#ifdef GWION_BUILTIN
#define GWI_BB(a) \
#define GWI_B(a) \
{ \
gwi_set_loc(gwi, __FILE__, __LINE__); \
(void)(a); \
Expand All @@ -37,28 +37,19 @@ typedef struct Gwi_ *Gwi;
gwi_set_loc(gwi, __FILE__, __LINE__); \
(void)(a); \
}
#define GWI_OB(a) \
#define GWI_B(a) \
{ \
gwi_set_loc(gwi, __FILE__, __LINE__); \
(void)(a); \
}
#define GWION_IMPORT(a) ANN bool gwimport_##a(const Gwi gwi)
#else
#define GWI_BB(a) \
{ \
gwi_set_loc(gwi, (m_str)__FILE__, __LINE__); \
CHECK_B(a); \
}
#define GWI_B(a) \
{ \
gwi_set_loc(gwi, (m_str)__FILE__, __LINE__); \
CHECK_B(a); \
}
#define GWI_OB(a) \
{ \
gwi_set_loc(gwi, (m_str)__FILE__, __LINE__); \
CHECK_B(a); \
}

#define GWION_IMPORT(a) ANN bool gwimport_##a(const Gwi gwi)
#endif
#define ALLOC_PTR(p, a, b, c) \
Expand Down Expand Up @@ -96,7 +87,7 @@ OP_EMIT(opem_new);
ANN
static inline M_Object new_object_str(const Gwion gwion, const m_str str) {
loc_t loc = {};
DECL_OO(const Type, t, = str2type(gwion, str, loc));
DECL_O(const Type, t, = str2type(gwion, str, loc));
return new_object(gwion->mp, t);
}

Expand Down
9 changes: 5 additions & 4 deletions include/import/edef.h
Expand Up @@ -2,8 +2,9 @@
#define __IMPORT_ENUM

__attribute__ ((visibility ("default")))
ANN m_int gwi_enum_ini(const Gwi gwi, const m_str type);
ANN m_int gwi_enum_add(const Gwi gwi, const m_str name, const m_uint value);
ANN Type gwi_enum_end(const Gwi gwi);
ANN void ck_clean_edef(MemPool, ImportCK *);
ANN bool gwi_enum_ini(const Gwi gwi, const m_str type);
ANN bool gwi_enum_add(const Gwi gwi, const m_str name, const m_uint value);
ANN bool gwi_enum_end(const Gwi gwi);

ANN void ck_clean_edef(MemPool, ImportCK *);
#endif
4 changes: 2 additions & 2 deletions include/import/internals.h
Expand Up @@ -6,7 +6,7 @@
#define GWI_ERR_B(a, ...) \
{ \
GWI_ERR((a), ##__VA_ARGS__); \
return GW_ERROR; \
return false; \
}
#define GWI_ERR_O(a, ...) \
{ \
Expand All @@ -29,7 +29,7 @@
#define ENV_ERR_B(pos, a, ...) \
{ \
env_err(env, pos, (a), ##__VA_ARGS__); \
return GW_ERROR; \
return false; \
}
#define ENV_ERR_O(pos, a, ...) \
{ \
Expand Down
4 changes: 2 additions & 2 deletions include/import/item.h
@@ -1,8 +1,8 @@
#ifndef __IMPORT_ITEM
#define __IMPORT_ITEM

ANN m_int gwi_item_ini(const Gwi gwi, const m_str type, const m_str name);
ANN2(1) m_int gwi_item_end(const Gwi gwi, const ae_flag flag, union value_data);
ANN bool gwi_item_ini(const Gwi gwi, const m_str type, const m_str name);
ANN2(1) bool gwi_item_end(const Gwi gwi, const ae_flag flag, union value_data);
#define gwi_item_end(a, b, member, c) \
gwi_item_end(a, (ae_flag)(b), (union value_data) {.member = c})
ANN void ck_clean_item(MemPool, ImportCK *);
Expand Down
18 changes: 4 additions & 14 deletions include/parse.h
Expand Up @@ -16,34 +16,24 @@
(node)-> poison = true; \
} while(false)

#undef ERR_b
#define ERR_b(a, b, ...) \
do { \
env_err(env, (a), (b), ##__VA_ARGS__); \
return false; \
} while(false)


#define ERR_OK_NODE(ok, a, b, c, ...) \
#define ERR_OK_NODE(ok, a, b, c, ...) \
do { \
env_err(env, (b), (c), ##__VA_ARGS__); \
POISON_NODE(ok, env, a); \
} while(false)

#define ERR_OK(ok, a, b, ...) \
#define ERR_OK(ok, a, b, ...) \
do { \
env_err(env, (a), (b), ##__VA_ARGS__); \
POISON(ok, env); \
} while(false)

#undef ERR_B
#define ERR_B(a, b, ...) \
do { \
env_err(env, (a), (b), ##__VA_ARGS__); \
return GW_ERROR; \
return false; \
} while(false)

#undef ERR_O
#define ERR_O(a, b, ...) \
do { \
env_err(env, (a), (b), ##__VA_ARGS__); \
Expand Down Expand Up @@ -157,7 +147,7 @@ static inline bool exp_is_zero(Exp* exp) {
ANN static inline bool not_upvalue(const Env env, const Value v) {
if (unlikely(is_class(env->gwion, v->type))) return true;
return GET_FLAG(v, global) || vflag(v, vflag_fglobal) ||
(v->from->owner_class && isa(v->from->owner_class, env->class_def) > 0) ||
(v->from->owner_class && isa(v->from->owner_class, env->class_def)) ||
nspc_lookup_value1(env->curr, insert_symbol(v->name));
}

Expand Down
2 changes: 1 addition & 1 deletion include/partial.h
Expand Up @@ -7,7 +7,7 @@ ANN void print_signature(const Func f);
ANN static inline bool func_match_inner(const Env env, Exp* e,
const Type t, const bool implicit,
const bool specific) {
if (specific ? e->type == t : isa(e->type, t) > 0) // match
if (specific ? e->type == t : isa(e->type, t)) // match
return true;
return !implicit ? false : check_implicit(env, e, t);
}
Expand Down
2 changes: 1 addition & 1 deletion plug
Submodule plug updated 62 files
+0 −214 Alsa/alsa.c.master
+81 −81 Analys/analys.c
+6 −6 Anna/plug.c
+173 −173 BMI/bmi.c
+53 −53 CoreUtil/plug.c
+52 −52 Cytosol/cytosol.c
+6 −6 Emoji/emoji.c
+9 −9 Evdev/absinfo.c
+21 −21 Evdev/ev.c
+122 −122 Evdev/evdev.c
+3 −3 Evdev/gw_evdev.h
+15 −15 Evdev/uinput.c
+35 −35 FFI/ffi.c
+14 −14 FMSynth/fmsynth.c
+156 −156 Fann/fann.c
+20 −20 Faust/faust.cpp
+8 −8 FileIO/fileio.c
+77 −77 Ftdi/ftdi.c
+50 −50 Ftdi/ftdi.c.save
+216 −216 Gpio/plug.c
+81 −81 I2C/plug.c
+18 −19 Jack/jack.c
+6 −6 K/gwk.c
+3 −3 LeBiniou/lebiniou.c
+33 −33 LiSa/lisa.c
+13 −13 LinuxSampler/LinuxSampler.cc
+29 −29 Lo/lo.c
+13 −13 Lsys/plug.c
+18 −18 Machine/machine.c
+17 −17 Math/math.c
+48 −48 Modules/modules.c
+21 −21 MsgPack/msgpack.c
+58 −58 Nuklear/nuklear.c
+10 −10 PausableAudio/pausableaudio.c
+9 −9 Pd/pd.c
+4 −4 Pipewire/driver.c
+25 −25 Pipewire/pw.c
+43 −43 PortMidi/portmidi.c
+11 −11 PortSmf/portsmf.cc
+8 −8 Readline/readline.c
+2 −2 Repl/repl.c
+44 −44 RtMidi/rtmidi.cc
+2,090 −2,090 STK/stk.cc
+65 −65 Sandbird/plug.c
+2 −2 SimdJSON/hydrate.cc
+63 −63 SimdJSON/simdjson.cc
+2 −2 SimdJSON/tojson.cc
+10 −10 Soundpipe/import.lua
+874 −874 Soundpipe/soundpipe.c
+25 −25 Sporth/sporth.c
+15 −15 Std/std.c
+84 −84 Term/plug.c
+4 −4 TermColor/termcolor.c
+15 −15 TinyRegex/tinyregex.c
+13 −13 TinySF/tinysf.c
+25 −29 TinySR/tinysr.c
+70 −71 Tuple/tuple.c
+123 −123 Vecx/vecx.c
+26 −26 WS2812b/ws2812b.c
+1 −1 faust2gw/gwion_faust.template.cpp
+1 −1 faust2gw/gwion_faust.template.h
+13 −13 plugin_template.sh
2 changes: 1 addition & 1 deletion scripts/embed.bash
Expand Up @@ -36,7 +36,7 @@ has_func() {
}
plugin() {
has_func "gwimport" "$1" "$2" && {
header "extern m_bool gwimport_${2}(const Gwi);"
header "extern bool gwimport_${2}(const Gwi);"
echo " plug->plugin = gwimport_${2};"
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/compile.c
Expand Up @@ -115,7 +115,7 @@ ANN static inline bool passes(struct Gwion_ *gwion, struct Compiler *c) {
for(uint32_t i = 0; i < mp_vector_len(c->values); i++) {
const Value v = *mp_vector_at(c->values, Value, i);
set_vflag(v, vflag_builtin);
if(isa(v->type, gwion->type[et_class]) > 0) {
if(isa(v->type, gwion->type[et_class])) {
const Type t = (Type)v->d.ptr;
type_addref(t);
mk_class(gwion->env, t, (loc_t) {});
Expand Down Expand Up @@ -157,7 +157,7 @@ ANN static m_uint _compile(struct Gwion_ *gwion, struct Compiler *c) {
gwion->emit->info->code = NULL;
return c->shred->tick->xid;
}
return GW_OK;
return true;
}

ANN static m_uint compile(struct Gwion_ *gwion, struct Compiler *c) {
Expand Down

0 comments on commit d7a89ce

Please sign in to comment.