with_config:
bash scripts/embed.bash gwion.config.json
- touch src/main.c
+ touch src/main.c touch src/arg.c
${MAKE} USE_CONFIG=1
- touch src/main.c
+ touch src/main.c touch src/arg.c
almost_gwion: ${almost_obj} ${ALMOST_LIBS}
done
}
-
embed() {
array_is_ok "$scripts" || array_is_ok "$libraries" || return
echo "ANN void gwion_embed(const Gwion gwion) {" >> embed/embed_foot
echo "static const int config_argc = $count;"
cat << EOF
ANN const char** config_args(int *argc, char **const argv) {
+#ifdef GWION_NO_UARGS
+ *argc = 0;
+#endif
const int nargs = config_argc + *argc;
const char ** args = malloc(nargs * SZ_INT);
for(int i = 0; i < config_argc; i++) {
args[i] = config_argv[i];
}
-#ifndef GWION_STANDALONE
for(int i = 0; i < *argc; i++) {
args[i + config_argc] = argv[i];
}
- *argc = nargs;
-#else
*argc = config_argc;
-#endif
return args;
}
EOF
} >> embed/embed.c
-[ "$libraries" != "null" ] || [ "$scripts" != "null" ] &&
+not_null "$libraries" || not_null "$scripts" &&
config "CFLAGS += -DGWION_EMBED"
cflags=$(jq -rc '.cflags' <<< "$json")
done
}
-standalone=$(jq -rc '.standalone' <<< "$json")
-[ "$standalone" = "true" ] && {
- array_is_ok "$args" || config "CFLAGS += -DGWION_CONFIG_ARGS"
- config "CFLAGS += -DGWION_STANDALONE"
-}
-:
+rc=$(jq -rc '.urc' <<< "$json")
+[ "$rc" = "false" ] && config "CFLAGS += -DGWION_NO_URC"
+ulib=$(jq -rc '.ulib' <<< "$json")
+[ "$ulib" = "false" ] && config "CFLAGS += -DGWION_NO_ULIB"
+uargs=$(jq -rc '.uargs' <<< "$json")
+[ "$uargs" = "false" ] && config "CFLAGS += -DGWION_NO_UARGS"
}
}
-#ifndef GWION_STANDALONE
+#ifndef GWION_NO_ULIB
ANN static m_str plug_dir(void) {
const m_str home = getenv("HOME");
const size_t sz = strlen(home);
vector_init(&arg->add);
vector_init(&arg->lib);
vector_init(&arg->config);
-#ifndef GWION_STANDALONE
+#ifndef GWION_NO_ULIB
vector_add(&arg->lib, (vtype)plug_dir());
#endif
arg->color = COLOR_AUTO;
return GW_OK;
}
-#ifndef GWION_STANDALONE
+#ifndef GWION_NO_URC
ANN static void config_default(struct ArgInternal *arg) {
char *home = getenv("HOME");
char c[strlen(home) + strlen(GWIONRC) + 2];
#ifdef __FUZZING
return;
#endif
-#ifndef GWION_STANDALONE
+#ifndef GWION_NO_URC
config_default(&arg);
#endif
return _arg_parse(&arg);
int main(int argc, char **argv) {
#ifndef GWION_CONFIG_ARGS
- CliArg arg = {.arg = {.argc = argc, .argv = argv}, .loop = false};
+ CliArg arg = {.arg = {.argc = argc, .argv = argv} };
#else
char **config_argv = config_args(&argc, argv);
- CliArg arg = {.arg = {.argc = argc, .argv = config_argv}, .loop = false};
+ CliArg arg = {.arg = {.argc = argc, .argv = config_argv} };
#endif
signal(SIGINT, sig);
signal(SIGTERM, sig);