summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-07-28 14:09:57 +0200
committerJo-Philipp Wich <jo@mein.io>2022-07-30 13:46:27 +0200
commit156d584e4d0af46c39234ee68a98a16ab4cbe225 (patch)
treeb73977b8e71445de9e5947d2db3bf941cc174f42 /include
parent10e056d3744384a029f05de5903c489898722fc3 (diff)
treewide: unexport libucode internal functions
Trim down the libucode.so size somewhat by marking purely internal, non-public API functions hidden. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'include')
-rw-r--r--include/ucode/chunk.h14
-rw-r--r--include/ucode/lexer.h13
-rw-r--r--include/ucode/lib.h4
-rw-r--r--include/ucode/program.h18
-rw-r--r--include/ucode/source.h14
-rw-r--r--include/ucode/types.h11
-rw-r--r--include/ucode/util.h5
-rw-r--r--include/ucode/vallist.h14
8 files changed, 48 insertions, 45 deletions
diff --git a/include/ucode/chunk.h b/include/ucode/chunk.h
index 78d5ec6..a5f0b1c 100644
--- a/include/ucode/chunk.h
+++ b/include/ucode/chunk.h
@@ -24,14 +24,14 @@
#include "util.h"
#include "types.h"
-void uc_chunk_init(uc_chunk_t *chunk);
-void uc_chunk_free(uc_chunk_t *chunk);
-size_t uc_chunk_add(uc_chunk_t *chunk, uint8_t byte, size_t line);
+__hidden void uc_chunk_init(uc_chunk_t *chunk);
+__hidden void uc_chunk_free(uc_chunk_t *chunk);
+__hidden size_t uc_chunk_add(uc_chunk_t *chunk, uint8_t byte, size_t line);
-void uc_chunk_pop(uc_chunk_t *chunk);
+__hidden void uc_chunk_pop(uc_chunk_t *chunk);
-size_t uc_chunk_debug_get_srcpos(uc_chunk_t *chunk, size_t off);
-void uc_chunk_debug_add_variable(uc_chunk_t *chunk, size_t from, size_t to, size_t slot, bool upval, uc_value_t *name);
-uc_value_t *uc_chunk_debug_get_variable(uc_chunk_t *chunk, size_t off, size_t slot, bool upval);
+__hidden size_t uc_chunk_debug_get_srcpos(uc_chunk_t *chunk, size_t off);
+__hidden void uc_chunk_debug_add_variable(uc_chunk_t *chunk, size_t from, size_t to, size_t slot, bool upval, uc_value_t *name);
+__hidden uc_value_t *uc_chunk_debug_get_variable(uc_chunk_t *chunk, size_t off, size_t slot, bool upval);
#endif /* UCODE_CHUNK_H */
diff --git a/include/ucode/lexer.h b/include/ucode/lexer.h
index e3aba8e..c013aac 100644
--- a/include/ucode/lexer.h
+++ b/include/ucode/lexer.h
@@ -176,16 +176,15 @@ typedef struct {
} uc_lexer_t;
-void uc_lexer_init(uc_lexer_t *lex, uc_parse_config_t *config, uc_source_t *source);
-void uc_lexer_free(uc_lexer_t *lex);
+__hidden void uc_lexer_init(uc_lexer_t *lex, uc_parse_config_t *config, uc_source_t *source);
+__hidden void uc_lexer_free(uc_lexer_t *lex);
-uc_token_t *uc_lexer_next_token(uc_lexer_t *lex);
+__hidden uc_token_t *uc_lexer_next_token(uc_lexer_t *lex);
-bool uc_lexer_is_keyword(uc_value_t *label);
+__hidden bool uc_lexer_is_keyword(uc_value_t *label);
-bool utf8enc(char **out, int *rem, int code);
+__hidden bool utf8enc(char **out, int *rem, int code);
-const char *
-uc_tokenname(unsigned type);
+__hidden const char *uc_tokenname(unsigned type);
#endif /* UCODE_LEXER_H */
diff --git a/include/ucode/lib.h b/include/ucode/lib.h
index a80844d..4c7a3b0 100644
--- a/include/ucode/lib.h
+++ b/include/ucode/lib.h
@@ -31,8 +31,8 @@ extern const uc_function_list_t uc_stdlib_functions[];
void uc_stdlib_load(uc_value_t *scope);
uc_cfn_ptr_t uc_stdlib_function(const char *name);
-bool uc_source_context_format(uc_stringbuf_t *buf, uc_source_t *src, size_t off, bool compact);
-bool uc_error_context_format(uc_stringbuf_t *buf, uc_source_t *src, uc_value_t *stacktrace, size_t off);
+__hidden bool uc_source_context_format(uc_stringbuf_t *buf, uc_source_t *src, size_t off, bool compact);
+__hidden bool uc_error_context_format(uc_stringbuf_t *buf, uc_source_t *src, uc_value_t *stacktrace, size_t off);
/* vm helper */
diff --git a/include/ucode/program.h b/include/ucode/program.h
index c350fea..9014ae4 100644
--- a/include/ucode/program.h
+++ b/include/ucode/program.h
@@ -48,17 +48,17 @@ uc_program_put(uc_program_t *prog) {
#define uc_program_function_last(prog) (uc_function_t *)prog->functions.next
-uc_function_t *uc_program_function_new(uc_program_t *, const char *, uc_source_t *, size_t);
-size_t uc_program_function_id(uc_program_t *, uc_function_t *);
-uc_function_t *uc_program_function_load(uc_program_t *, size_t);
-uc_source_t *uc_program_function_source(uc_function_t *);
-size_t uc_program_function_srcpos(uc_function_t *, size_t);
-void uc_program_function_free(uc_function_t *);
+__hidden uc_function_t *uc_program_function_new(uc_program_t *, const char *, uc_source_t *, size_t);
+__hidden size_t uc_program_function_id(uc_program_t *, uc_function_t *);
+__hidden uc_function_t *uc_program_function_load(uc_program_t *, size_t);
+__hidden uc_source_t *uc_program_function_source(uc_function_t *);
+__hidden size_t uc_program_function_srcpos(uc_function_t *, size_t);
+__hidden void uc_program_function_free(uc_function_t *);
-ssize_t uc_program_export_lookup(uc_program_t *, uc_source_t *, uc_value_t *);
+__hidden ssize_t uc_program_export_lookup(uc_program_t *, uc_source_t *, uc_value_t *);
-uc_value_t *uc_program_get_constant(uc_program_t *, size_t);
-ssize_t uc_program_add_constant(uc_program_t *, uc_value_t *);
+__hidden uc_value_t *uc_program_get_constant(uc_program_t *, size_t);
+__hidden ssize_t uc_program_add_constant(uc_program_t *, uc_value_t *);
void uc_program_write(uc_program_t *, FILE *, bool);
uc_program_t *uc_program_load(uc_source_t *, char **);
diff --git a/include/ucode/source.h b/include/ucode/source.h
index b3eaa34..e1fd211 100644
--- a/include/ucode/source.h
+++ b/include/ucode/source.h
@@ -35,7 +35,7 @@ typedef enum {
uc_source_t *uc_source_new_file(const char *path);
uc_source_t *uc_source_new_buffer(const char *name, char *buf, size_t len);
-size_t uc_source_get_line(uc_source_t *source, size_t *offset);
+__hidden size_t uc_source_get_line(uc_source_t *source, size_t *offset);
static inline uc_source_t *
uc_source_get(uc_source_t *source) {
@@ -47,14 +47,14 @@ uc_source_put(uc_source_t *source) {
ucv_put(source ? &source->header : NULL);
}
-uc_source_type_t uc_source_type_test(uc_source_t *source);
+__hidden uc_source_type_t uc_source_type_test(uc_source_t *source);
-void uc_source_line_next(uc_source_t *source);
-void uc_source_line_update(uc_source_t *source, size_t off);
+__hidden void uc_source_line_next(uc_source_t *source);
+__hidden void uc_source_line_update(uc_source_t *source, size_t off);
-void uc_source_runpath_set(uc_source_t *source, const char *runpath);
+__hidden void uc_source_runpath_set(uc_source_t *source, const char *runpath);
-bool uc_source_export_add(uc_source_t *source, uc_value_t *name);
-ssize_t uc_source_export_lookup(uc_source_t *source, uc_value_t *name);
+__hidden bool uc_source_export_add(uc_source_t *source, uc_value_t *name);
+__hidden ssize_t uc_source_export_lookup(uc_source_t *source, uc_value_t *name);
#endif /* UCODE_SOURCE_H */
diff --git a/include/ucode/types.h b/include/ucode/types.h
index c32829f..0b63501 100644
--- a/include/ucode/types.h
+++ b/include/ucode/types.h
@@ -310,13 +310,12 @@ struct uc_vm {
/* Value API */
-void ucv_free(uc_value_t *, bool);
-void ucv_put(uc_value_t *);
-
-void ucv_unref(uc_weakref_t *);
-void ucv_ref(uc_weakref_t *, uc_weakref_t *);
+__hidden void ucv_free(uc_value_t *, bool);
+__hidden void ucv_unref(uc_weakref_t *);
+__hidden void ucv_ref(uc_weakref_t *, uc_weakref_t *);
uc_value_t *ucv_get(uc_value_t *uv);
+void ucv_put(uc_value_t *);
uc_type_t ucv_type(uc_value_t *);
const char *ucv_typename(uc_value_t *);
@@ -547,6 +546,6 @@ ucv_clear_mark(uc_value_t *uv)
void ucv_gc(uc_vm_t *);
-void ucv_freeall(uc_vm_t *);
+__hidden void ucv_freeall(uc_vm_t *);
#endif /* UCODE_TYPES_H */
diff --git a/include/ucode/util.h b/include/ucode/util.h
index 093951e..52303cc 100644
--- a/include/ucode/util.h
+++ b/include/ucode/util.h
@@ -26,6 +26,11 @@
#include <json-c/json.h>
+#ifndef __hidden
+#define __hidden __attribute__((visibility("hidden")))
+#endif
+
+
/* alignment & array size */
#ifndef ALIGN
diff --git a/include/ucode/vallist.h b/include/ucode/vallist.h
index 3dc5720..78b9a3e 100644
--- a/include/ucode/vallist.h
+++ b/include/ucode/vallist.h
@@ -33,17 +33,17 @@ typedef enum {
TAG_LSTR = 5
} uc_value_type_t;
-uc_value_t *uc_number_parse(const char *buf, char **end);
-uc_value_t *uc_number_parse_octal(const char *buf, char **end);
+__hidden uc_value_t *uc_number_parse(const char *buf, char **end);
+__hidden uc_value_t *uc_number_parse_octal(const char *buf, char **end);
bool uc_double_pack(double d, char *buf, bool little_endian);
double uc_double_unpack(const char *buf, bool little_endian);
-void uc_vallist_init(uc_value_list_t *list);
-void uc_vallist_free(uc_value_list_t *list);
+__hidden void uc_vallist_init(uc_value_list_t *list);
+__hidden void uc_vallist_free(uc_value_list_t *list);
-ssize_t uc_vallist_add(uc_value_list_t *list, uc_value_t *value);
-uc_value_type_t uc_vallist_type(uc_value_list_t *list, size_t idx);
-uc_value_t *uc_vallist_get(uc_value_list_t *list, size_t idx);
+__hidden ssize_t uc_vallist_add(uc_value_list_t *list, uc_value_t *value);
+__hidden uc_value_type_t uc_vallist_type(uc_value_list_t *list, size_t idx);
+__hidden uc_value_t *uc_vallist_get(uc_value_list_t *list, size_t idx);
#endif /* UCODE_VALUE_H */