From a675e06c38ec4e31a2758435a582b58a2199cfc4 Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 28 Jun 2018 03:17:32 +0200 Subject: Change functions to static where possible (Part 4 - map) This fixes issues with plugins defining symbols with the same names Signed-off-by: Haru --- src/map/script.c | 1560 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 867 insertions(+), 693 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 9c859ca12..9adf6b44d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -83,7 +83,7 @@ #include #endif -struct script_interface script_s; +static struct script_interface script_s; struct script_interface *script; static inline int GETVALUE(const struct script_buf *buf, int i) __attribute__((nonnull (1))); @@ -103,7 +103,8 @@ static inline void SETVALUE(struct script_buf *buf, int i, int n) VECTOR_INDEX(*buf, i+2) = GetByte(n, 2); } -const char* script_op2name(int op) { +const char *script_op2name(int op) +{ #define RETURN_OP_NAME(type) case type: return #type switch( op ) { RETURN_OP_NAME(C_NOP); @@ -162,7 +163,7 @@ const char* script_op2name(int op) { } #ifdef SCRIPT_DEBUG_DUMP_STACK -static void script_dump_stack(struct script_state* st) +static void script_dump_stack(struct script_state *st) { int i; nullpo_retv(st); @@ -205,7 +206,8 @@ static void script_dump_stack(struct script_state* st) #endif /// Reports on the console the src of a script error. -void script_reportsrc(struct script_state *st) { +static void script_reportsrc(struct script_state *st) +{ struct block_list* bl; nullpo_retv(st); @@ -236,7 +238,7 @@ void script_reportsrc(struct script_state *st) { } /// Reports on the console information about the script data. -void script_reportdata(struct script_data* data) +static void script_reportdata(struct script_data *data) { if( data == NULL ) return; @@ -278,7 +280,7 @@ void script_reportdata(struct script_data* data) } /// Reports on the console information about the current built-in function. -void script_reportfunc(struct script_state* st) +static void script_reportfunc(struct script_state *st) { int params, id; struct script_data* data; @@ -313,8 +315,9 @@ void script_reportfunc(struct script_state* st) /*========================================== * Output error message *------------------------------------------*/ -static void disp_error_message2(const char *mes,const char *pos,int report) __attribute__((nonnull (1))) analyzer_noreturn; -static void disp_error_message2(const char *mes,const char *pos,int report) { +static void disp_error_message2(const char *mes, const char *pos, int report) __attribute__((nonnull (1))) analyzer_noreturn; +static void disp_error_message2(const char *mes, const char *pos, int report) +{ script->error_msg = aStrdup(mes); script->error_pos = pos; script->error_report = report; @@ -322,12 +325,13 @@ static void disp_error_message2(const char *mes,const char *pos,int report) { } #define disp_error_message(mes,pos) (disp_error_message2((mes),(pos),1)) -void disp_warning_message(const char *mes, const char *pos) { +static void disp_warning_message(const char *mes, const char *pos) +{ script->warning(script->parser_current_src,script->parser_current_file,script->parser_current_line,mes,pos); } /// Checks event parameter validity -void check_event(struct script_state *st, const char *evt) +static void check_event(struct script_state *st, const char *evt) { if( evt && evt[0] && !stristr(evt, "::On") ) { @@ -339,7 +343,8 @@ void check_event(struct script_state *st, const char *evt) /*========================================== * Hashes the input string *------------------------------------------*/ -unsigned int calc_hash(const char* p) { +static unsigned int calc_hash(const char *p) +{ unsigned int h; nullpo_ret(p); @@ -374,7 +379,8 @@ unsigned int calc_hash(const char* p) { /*========================================== * Hashes the input string in a case insensitive way *------------------------------------------*/ -unsigned int calc_hash_ci(const char* p) { +static unsigned int calc_hash_ci(const char *p) +{ unsigned int h = 0; #ifdef ENABLE_CASE_CHECK @@ -413,14 +419,14 @@ unsigned int calc_hash_ci(const char* p) { *------------------------------------------*/ /// Looks up string using the provided id. -const char* script_get_str(int id) +static const char *script_get_str(int id) { Assert_retr(NULL, id >= LABEL_START && id < script->str_size); return script->str_buf+script->str_data[id].str; } /// Returns the uid of the string, or -1. -int script_search_str(const char* p) +static int script_search_str(const char *p) { int i; @@ -433,7 +439,7 @@ int script_search_str(const char* p) return -1; } -void script_casecheck_clear_sub(struct casecheck_data *ccd) +static void script_casecheck_clear_sub(struct casecheck_data *ccd) { #ifdef ENABLE_CASE_CHECK nullpo_retv(ccd); @@ -453,15 +459,17 @@ void script_casecheck_clear_sub(struct casecheck_data *ccd) #endif // ENABLE_CASE_CHECK } -void script_global_casecheck_clear(void) { +static void script_global_casecheck_clear(void) +{ script_casecheck_clear_sub(&script->global_casecheck); } -void script_local_casecheck_clear(void) { +static void script_local_casecheck_clear(void) +{ script_casecheck_clear_sub(&script->local_casecheck); } -const char *script_casecheck_add_str_sub(struct casecheck_data *ccd, const char *p) +static const char *script_casecheck_add_str_sub(struct casecheck_data *ccd, const char *p) { #ifdef ENABLE_CASE_CHECK int len; @@ -518,17 +526,19 @@ const char *script_casecheck_add_str_sub(struct casecheck_data *ccd, const char return NULL; } -const char *script_global_casecheck_add_str(const char *p) { +static const char *script_global_casecheck_add_str(const char *p) +{ return script_casecheck_add_str_sub(&script->global_casecheck, p); } -const char *script_local_casecheck_add_str(const char *p) { +static const char *script_local_casecheck_add_str(const char *p) +{ return script_casecheck_add_str_sub(&script->local_casecheck, p); } /// Stores a copy of the string and returns its id. /// If an identical string is already present, returns its id instead. -int script_add_str(const char* p) +static int script_add_str(const char *p) { int len, h = script->calc_hash(p); #ifdef ENABLE_CASE_CHECK @@ -607,7 +617,7 @@ int script_add_str(const char* p) * * @param a The byte to append. */ -void add_scriptb(int a) +static void add_scriptb(int a) { VECTOR_ENSURE(script->buf, 1, SCRIPT_BLOCK_SIZE); VECTOR_PUSH(script->buf, (uint8)a); @@ -622,7 +632,7 @@ void add_scriptb(int a) * * @param a The value to append. */ -void add_scriptc(int a) +static void add_scriptc(int a) { while( a >= 0x40 ) { @@ -642,7 +652,7 @@ void add_scriptc(int a) * * @param a The value to append. */ -void add_scripti(int a) +static void add_scripti(int a) { while( a >= 0x40 ) { @@ -657,7 +667,7 @@ void add_scripti(int a) * * @param l The id of the script->str_data entry (Maximum up to 16M) */ -void add_scriptl(int l) +static void add_scriptl(int l) { int backpatch = script->str_data[l].backpatch; @@ -695,7 +705,7 @@ void add_scriptl(int l) /*========================================== * Resolve the label *------------------------------------------*/ -void set_label(int l,int pos, const char* script_pos) +static void set_label(int l, int pos, const char *script_pos) { int i; @@ -719,7 +729,7 @@ void set_label(int l,int pos, const char* script_pos) } /// Skips spaces and/or comments. -const char* script_skip_space(const char* p) +static const char *script_skip_space(const char *p) { if( p == NULL ) return NULL; @@ -758,7 +768,7 @@ const char* script_skip_space(const char* p) /// Skips a word. /// A word consists of undercores and/or alphanumeric characters, /// and valid variable prefixes/postfixes. -const char* skip_word(const char* p) +static const char *skip_word(const char *p) { nullpo_retr(NULL, p); // prefix @@ -787,7 +797,8 @@ const char* skip_word(const char* p) /// Adds a word to script->str_data. /// @see skip_word /// @see script->add_str -int add_word(const char* p) { +static int add_word(const char *p) +{ size_t len; int i; @@ -813,8 +824,7 @@ int add_word(const char* p) { /// Parses a function call. /// The argument list can have parenthesis or not. /// The number of arguments is checked. -static -const char* parse_callfunc(const char* p, int require_paren, int is_custom) +static const char *parse_callfunc(const char *p, int require_paren, int is_custom) { const char *p2; char *arg = NULL; @@ -945,7 +955,7 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom) /// Processes end of logical script line. /// @param first When true, only fix up scheduling data is initialized /// @param p Script position for error reporting in set_label -void parse_nextline(bool first, const char* p) +static void parse_nextline(bool first, const char *p) { if( !first ) { @@ -963,7 +973,7 @@ void parse_nextline(bool first, const char* p) * Pushes a variable into stack, processing its array index if needed. * @see parse_variable */ -void parse_variable_sub_push(int word, const char *p2) +static void parse_variable_sub_push(int word, const char *p2) { if( p2 ) { const char* p3 = NULL; @@ -994,7 +1004,7 @@ void parse_variable_sub_push(int word, const char *p2) /// Parse a variable assignment using the direct equals operator /// @param p script position where the function should run from /// @return NULL if not a variable assignment, the new position otherwise -const char* parse_variable(const char* p) +static const char *parse_variable(const char *p) { int word; c_op type = C_NOP; @@ -1150,7 +1160,8 @@ const char* parse_variable(const char* p) * @param p Pointer to the string to check * @return Whether the string is a number literal */ -bool is_number(const char *p) { +static bool is_number(const char *p) +{ const char *np; if (!p) return false; @@ -1181,7 +1192,7 @@ bool is_number(const char *p) { * @param str The string to insert. * @return the string position in the script string list. */ -int script_string_dup(char *str) +static int script_string_dup(char *str) { int len; int pos = script->string_list_pos; @@ -1203,7 +1214,7 @@ int script_string_dup(char *str) /*========================================== * Analysis section *------------------------------------------*/ -const char *parse_simpleexpr(const char *p) +static const char *parse_simpleexpr(const char *p) { p=script->skip_space(p); @@ -1221,7 +1232,7 @@ const char *parse_simpleexpr(const char *p) } } -const char *parse_simpleexpr_paren(const char *p) +static const char *parse_simpleexpr_paren(const char *p) { int i = script->syntax.curly_count - 1; nullpo_retr(NULL, p); @@ -1248,7 +1259,7 @@ const char *parse_simpleexpr_paren(const char *p) return p + 1; } -const char *parse_simpleexpr_number(const char *p) +static const char *parse_simpleexpr_number(const char *p) { char *np = NULL; long long lli; @@ -1270,7 +1281,7 @@ const char *parse_simpleexpr_number(const char *p) return np; } -const char *parse_simpleexpr_string(const char *p) +static const char *parse_simpleexpr_string(const char *p) { const char *start_point = p; @@ -1311,7 +1322,7 @@ const char *parse_simpleexpr_string(const char *p) return p; } -const char *parse_simpleexpr_name(const char *p) +static const char *parse_simpleexpr_name(const char *p) { int l; const char *pv = NULL; @@ -1361,7 +1372,7 @@ const char *parse_simpleexpr_name(const char *p) return p; } -void script_add_translatable_string(const struct script_string_buf *string, const char *start_point) +static void script_add_translatable_string(const struct script_string_buf *string, const char *start_point) { struct string_translation *st = NULL; @@ -1401,7 +1412,7 @@ void script_add_translatable_string(const struct script_string_buf *string, cons /*========================================== * Analysis of the expression *------------------------------------------*/ -const char* script_parse_subexpr(const char* p,int limit) +static const char *script_parse_subexpr(const char *p, int limit) { int op,opl,len; @@ -1470,7 +1481,7 @@ const char* script_parse_subexpr(const char* p,int limit) /*========================================== * Evaluation of the expression *------------------------------------------*/ -const char* parse_expr(const char *p) +static const char *parse_expr(const char *p) { nullpo_retr(NULL, p); switch(*p) { @@ -1485,7 +1496,7 @@ const char* parse_expr(const char *p) /*========================================== * Analysis of the line *------------------------------------------*/ -const char* parse_line(const char* p) +static const char *parse_line(const char *p) { const char* p2; @@ -1548,7 +1559,7 @@ const char* parse_line(const char* p) } // { ... } Closing process -const char* parse_curly_close(const char* p) +static const char *parse_curly_close(const char *p) { nullpo_retr(NULL, p); if(script->syntax.curly_count <= 0) { @@ -1607,7 +1618,7 @@ const char* parse_curly_close(const char* p) // Syntax-related processing // break, case, continue, default, do, for, function, // if, switch, while ? will handle this internally. -const char* parse_syntax(const char* p) +static const char *parse_syntax(const char *p) { const char *p2 = script->skip_word(p); @@ -2037,7 +2048,8 @@ const char* parse_syntax(const char* p) return NULL; } -const char* parse_syntax_close(const char *p) { +static const char *parse_syntax_close(const char *p) +{ // If (...) for (...) hoge (); as to make sure closed closed once again int flag; @@ -2051,7 +2063,7 @@ const char* parse_syntax_close(const char *p) { // Close judgment if, for, while, of do // flag == 1 : closed // flag == 0 : not closed -const char* parse_syntax_close_sub(const char* p,int* flag) +static const char *parse_syntax_close_sub(const char *p, int *flag) { char label[256]; int pos = script->syntax.curly_count - 1; @@ -2224,7 +2236,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) } /// Retrieves the value of a constant. -bool script_get_constant(const char* name, int* value) +static bool script_get_constant(const char *name, int *value) { int n = script->search_str(name); @@ -2242,7 +2254,7 @@ bool script_get_constant(const char* name, int* value) } /// Creates new constant or parameter with given value. -void script_set_constant(const char *name, int value, bool is_parameter, bool is_deprecated) +static void script_set_constant(const char *name, int value, bool is_parameter, bool is_deprecated) { int n = script->add_str(name); @@ -2257,7 +2269,7 @@ void script_set_constant(const char *name, int value, bool is_parameter, bool is } } /* adds data to a existent constant in the database, inserted normally via parse */ -void script_set_constant2(const char *name, int value, bool is_parameter, bool is_deprecated) +static void script_set_constant2(const char *name, int value, bool is_parameter, bool is_deprecated) { int n = script->add_str(name); @@ -2290,7 +2302,7 @@ void script_set_constant2(const char *name, int value, bool is_parameter, bool i /** * Loads the constants database from constants.conf */ -void read_constdb(void) +static void read_constdb(void) { struct config_t constants_conf; char filepath[256]; @@ -2366,12 +2378,12 @@ void read_constdb(void) * * @param comment The comment to set (NULL to unset) */ -void script_constdb_comment(const char *comment) +static void script_constdb_comment(const char *comment) { (void)comment; } -void script_load_parameters(void) +static void script_load_parameters(void) { int i = 0; struct { @@ -2426,7 +2438,7 @@ void script_load_parameters(void) /*========================================== * Display emplacement line of script *------------------------------------------*/ -const char* script_print_line(StringBuf* buf, const char* p, const char* mark, int line) +static const char *script_print_line(StringBuf *buf, const char *p, const char *mark, int line) { int i, mark_pos = 0, tabstop = TAB_SIZE; if( p == NULL || !p[0] ) return NULL; @@ -2465,7 +2477,8 @@ const char* script_print_line(StringBuf* buf, const char* p, const char* mark, i #undef update_tabstop #define CONTEXTLINES 3 -void script_errorwarning_sub(StringBuf *buf, const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) { +static void script_errorwarning_sub(StringBuf *buf, const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos) +{ // Find the line where the error occurred int j; int line = start_line; @@ -2501,7 +2514,8 @@ void script_errorwarning_sub(StringBuf *buf, const char* src, const char* file, } #undef CONTEXTLINES -void script_error(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) { +static void script_error(const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos) +{ StringBuf buf; StrBuf->Init(&buf); @@ -2513,7 +2527,8 @@ void script_error(const char* src, const char* file, int start_line, const char* StrBuf->Destroy(&buf); } -void script_warning(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) { +static void script_warning(const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos) +{ StringBuf buf; StrBuf->Init(&buf); @@ -2527,7 +2542,8 @@ void script_warning(const char* src, const char* file, int start_line, const cha /*========================================== * Analysis of the script *------------------------------------------*/ -struct script_code* parse_script(const char *src,const char *file,int line,int options, int *retval) { +static struct script_code *parse_script(const char *src, const char *file, int line, int options, int *retval) +{ const char *p,*tmpp; int i; struct script_code* code = NULL; @@ -2741,7 +2757,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o /// Returns the player attached to this script, identified by the rid. /// If there is no player attached, the script is terminated. -struct map_session_data *script_rid2sd(struct script_state *st) +static struct map_session_data *script_rid2sd(struct script_state *st) { struct map_session_data *sd; nullpo_retr(NULL, st); @@ -2754,7 +2770,7 @@ struct map_session_data *script_rid2sd(struct script_state *st) return sd; } -struct map_session_data *script_id2sd(struct script_state *st, int account_id) +static struct map_session_data *script_id2sd(struct script_state *st, int account_id) { struct map_session_data *sd; if ((sd = map->id2sd(account_id)) == NULL) { @@ -2765,7 +2781,7 @@ struct map_session_data *script_id2sd(struct script_state *st, int account_id) return sd; } -struct map_session_data *script_charid2sd(struct script_state *st, int char_id) +static struct map_session_data *script_charid2sd(struct script_state *st, int char_id) { struct map_session_data *sd; if ((sd = map->charid2sd(char_id)) == NULL) { @@ -2776,7 +2792,7 @@ struct map_session_data *script_charid2sd(struct script_state *st, int char_id) return sd; } -struct map_session_data *script_nick2sd(struct script_state *st, const char *name) +static struct map_session_data *script_nick2sd(struct script_state *st, const char *name) { struct map_session_data *sd; if ((sd = map->nick2sd(name)) == NULL) { @@ -2787,14 +2803,16 @@ struct map_session_data *script_nick2sd(struct script_state *st, const char *nam return sd; } -char *get_val_npcscope_str(struct script_state* st, struct reg_db *n, struct script_data* data) { +static char *get_val_npcscope_str(struct script_state *st, struct reg_db *n, struct script_data *data) +{ if (n) return (char*)i64db_get(n->vars, reference_getuid(data)); else return NULL; } -char *get_val_pc_ref_str(struct script_state *st, struct reg_db *n, struct script_data *data) { +static char *get_val_pc_ref_str(struct script_state *st, struct reg_db *n, struct script_data *data) +{ struct script_reg_str *p = NULL; nullpo_retr(NULL, n); @@ -2802,7 +2820,8 @@ char *get_val_pc_ref_str(struct script_state *st, struct reg_db *n, struct scrip return p ? p->value : NULL; } -char *get_val_instance_str(struct script_state* st, const char* name, struct script_data* data) { +static char *get_val_instance_str(struct script_state *st, const char *name, struct script_data *data) +{ nullpo_retr(NULL, st); if (st->instance_id >= 0) { return (char*)i64db_get(instance->list[st->instance_id].regs.vars, reference_getuid(data)); @@ -2812,14 +2831,16 @@ char *get_val_instance_str(struct script_state* st, const char* name, struct scr } } -int get_val_npcscope_num(struct script_state* st, struct reg_db *n, struct script_data* data) { +static int get_val_npcscope_num(struct script_state *st, struct reg_db *n, struct script_data *data) +{ if (n) return (int)i64db_iget(n->vars, reference_getuid(data)); else return 0; } -int get_val_pc_ref_num(struct script_state *st, struct reg_db *n, struct script_data *data) { +static int get_val_pc_ref_num(struct script_state *st, struct reg_db *n, struct script_data *data) +{ struct script_reg_num *p = NULL; nullpo_retr(0, n); @@ -2827,7 +2848,8 @@ int get_val_pc_ref_num(struct script_state *st, struct reg_db *n, struct script_ return p ? p->value : 0; } -int get_val_instance_num(struct script_state* st, const char* name, struct script_data* data) { +static int get_val_instance_num(struct script_state *st, const char *name, struct script_data *data) +{ if (st->instance_id >= 0) return (int)i64db_iget(instance->list[st->instance_id].regs.vars, reference_getuid(data)); else { @@ -2843,7 +2865,8 @@ int get_val_instance_num(struct script_state* st, const char* name, struct scrip * @param data[in,out] variable/constant. * @return pointer to data, for convenience. */ -struct script_data *get_val(struct script_state* st, struct script_data* data) { +static struct script_data *get_val(struct script_state *st, struct script_data *data) +{ const char* name; char prefix; char postfix; @@ -3000,7 +3023,7 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { * @param ref[in] the container to look up the reference into. * @return the retrieved value of the reference. */ -const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref) +static const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref) { struct script_data* data; nullpo_retr(NULL, st); @@ -3016,7 +3039,8 @@ const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref) * Because, currently, array members with key 0 are indifferenciable from normal variables, we should ensure its actually in * Will be gone as soon as undefined var feature is implemented **/ -void script_array_ensure_zero(struct script_state *st, struct map_session_data *sd, int64 uid, struct reg_db *ref) { +static void script_array_ensure_zero(struct script_state *st, struct map_session_data *sd, int64 uid, struct reg_db *ref) +{ const char *name = script->get_str(script_getvarid(uid)); struct reg_db *src = NULL; bool insert = false; @@ -3063,7 +3087,8 @@ void script_array_ensure_zero(struct script_state *st, struct map_session_data * /** * Returns array size by ID **/ -unsigned int script_array_size(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { +static unsigned int script_array_size(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) +{ struct script_array *sa = NULL; struct reg_db *src = script->array_src(st, sd, name, ref); @@ -3075,7 +3100,8 @@ unsigned int script_array_size(struct script_state *st, struct map_session_data /** * Returns array's highest key (for that awful getarraysize implementation that doesn't really gets the array size) **/ -unsigned int script_array_highest_key(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { +static unsigned int script_array_highest_key(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) +{ struct script_array *sa = NULL; struct reg_db *src = script->array_src(st, sd, name, ref); @@ -3096,7 +3122,7 @@ unsigned int script_array_highest_key(struct script_state *st, struct map_sessio } return 0; } -int script_free_array_db(union DBKey key, struct DBData *data, va_list ap) +static int script_free_array_db(union DBKey key, struct DBData *data, va_list ap) { struct script_array *sa = DB->data2ptr(data); aFree(sa->members); @@ -3106,7 +3132,8 @@ int script_free_array_db(union DBKey key, struct DBData *data, va_list ap) /** * Clears script_array and removes it from script->array_db **/ -void script_array_delete(struct reg_db *src, struct script_array *sa) { +static void script_array_delete(struct reg_db *src, struct script_array *sa) +{ nullpo_retv(src); nullpo_retv(sa); aFree(sa->members); @@ -3118,7 +3145,8 @@ void script_array_delete(struct reg_db *src, struct script_array *sa) { * * @param idx the index of the member in script_array struct list, not of the actual array member **/ -void script_array_remove_member(struct reg_db *src, struct script_array *sa, unsigned int idx) { +static void script_array_remove_member(struct reg_db *src, struct script_array *sa, unsigned int idx) +{ unsigned int i, cursor; nullpo_retv(sa); @@ -3145,7 +3173,8 @@ void script_array_remove_member(struct reg_db *src, struct script_array *sa, uns * * @param idx the index of the array member being inserted **/ -void script_array_add_member(struct script_array *sa, unsigned int idx) { +static void script_array_add_member(struct script_array *sa, unsigned int idx) +{ nullpo_retv(sa); RECREATE(sa->members, unsigned int, ++sa->size); sa->members[sa->size - 1] = idx; @@ -3154,7 +3183,8 @@ void script_array_add_member(struct script_array *sa, unsigned int idx) { * Obtains the source of the array database for this type and scenario * Initializes such database when not yet initialized. **/ -struct reg_db *script_array_src(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { +static struct reg_db *script_array_src(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) +{ struct reg_db *src = NULL; nullpo_retr(NULL, name); @@ -3205,7 +3235,8 @@ struct reg_db *script_array_src(struct script_state *st, struct map_session_data * @param num[in] Variable ID * @param empty[in] Whether the modified member is empty (needs to be removed) **/ -void script_array_update(struct reg_db *src, int64 num, bool empty) { +static void script_array_update(struct reg_db *src, int64 num, bool empty) +{ struct script_array *sa = NULL; int id = script_getvarid(num); unsigned int index = script_getvaridx(num); @@ -3246,7 +3277,7 @@ void script_array_update(struct reg_db *src, int64 num, bool empty) { } } -void set_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 num, const char* name, const char *str) +static void set_reg_npcscope_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) { if (n) { @@ -3263,7 +3294,7 @@ void set_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 num, } } -void set_reg_pc_ref_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) +static void set_reg_pc_ref_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) { struct script_reg_str *p = NULL; unsigned int index = script_getvaridx(num); @@ -3312,7 +3343,7 @@ void set_reg_pc_ref_str(struct script_state *st, struct reg_db *n, int64 num, co } } -void set_reg_pc_ref_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) +static void set_reg_pc_ref_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) { struct script_reg_num *p = NULL; unsigned int index = script_getvaridx(num); @@ -3356,7 +3387,7 @@ void set_reg_pc_ref_num(struct script_state *st, struct reg_db *n, int64 num, co } } -void set_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 num, const char* name, int val) +static void set_reg_npcscope_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) { if (n) { if (val != 0) { @@ -3371,7 +3402,7 @@ void set_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 num, } } -void set_reg_instance_str(struct script_state* st, int64 num, const char* name, const char *str) +static void set_reg_instance_str(struct script_state *st, int64 num, const char *name, const char *str) { nullpo_retv(st); if (st->instance_id >= 0) { @@ -3390,7 +3421,7 @@ void set_reg_instance_str(struct script_state* st, int64 num, const char* name, } } -void set_reg_instance_num(struct script_state* st, int64 num, const char* name, int val) +static void set_reg_instance_num(struct script_state *st, int64 num, const char *name, int val) { nullpo_retv(st); if (st->instance_id >= 0) { @@ -3423,7 +3454,7 @@ void set_reg_instance_num(struct script_state* st, int64 num, const char* name, * * TODO: return values are screwed up, have been for some time (reaad: years), e.g. some functions return 1 failure and success. *------------------------------------------*/ -int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref) +static int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref) { char prefix; nullpo_ret(name); @@ -3546,18 +3577,18 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con } } -int set_var(struct map_session_data *sd, char *name, void *val) +static int set_var(struct map_session_data *sd, char *name, void *val) { return script->set_reg(NULL, sd, reference_uid(script->add_str(name),0), name, val, NULL); } -void setd_sub(struct script_state *st, struct map_session_data *sd, const char *varname, int elem, const void *value, struct reg_db *ref) +static void setd_sub(struct script_state *st, struct map_session_data *sd, const char *varname, int elem, const void *value, struct reg_db *ref) { script->set_reg(st, sd, reference_uid(script->add_str(varname),elem), varname, value, ref); } /// Converts the data to a string -const char *conv_str(struct script_state *st, struct script_data* data) +static const char *conv_str(struct script_state *st, struct script_data *data) { script->get_val(st, data); if (data_isstring(data)) { @@ -3591,7 +3622,7 @@ const char *conv_str(struct script_state *st, struct script_data* data) } /// Converts the data to an int -int conv_num(struct script_state *st, struct script_data *data) +static int conv_num(struct script_state *st, struct script_data *data) { long num; @@ -3649,7 +3680,8 @@ int conv_num(struct script_state *st, struct script_data *data) // /// Increases the size of the stack -void stack_expand(struct script_stack* stack) { +static void stack_expand(struct script_stack *stack) +{ nullpo_retv(stack); stack->sp_max += 64; stack->stack_data = (struct script_data*)aRealloc(stack->stack_data, @@ -3659,7 +3691,8 @@ void stack_expand(struct script_stack* stack) { } /// Pushes a value into the stack (with reference) -struct script_data* push_val(struct script_stack* stack, enum c_op type, int64 val, struct reg_db *ref) { +static struct script_data *push_val(struct script_stack *stack, enum c_op type, int64 val, struct reg_db *ref) +{ nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) script->stack_expand(stack); @@ -3671,7 +3704,7 @@ struct script_data* push_val(struct script_stack* stack, enum c_op type, int64 v } /// Pushes a string into the stack -struct script_data *push_str(struct script_stack *stack, char *str) +static struct script_data *push_str(struct script_stack *stack, char *str) { nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) @@ -3684,7 +3717,7 @@ struct script_data *push_str(struct script_stack *stack, char *str) } /// Pushes a constant string into the stack -struct script_data *push_conststr(struct script_stack *stack, const char *str) +static struct script_data *push_conststr(struct script_stack *stack, const char *str) { nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) @@ -3697,7 +3730,8 @@ struct script_data *push_conststr(struct script_stack *stack, const char *str) } /// Pushes a retinfo into the stack -struct script_data* push_retinfo(struct script_stack* stack, struct script_retinfo* ri, struct reg_db *ref) { +static struct script_data *push_retinfo(struct script_stack *stack, struct script_retinfo *ri, struct reg_db *ref) +{ nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) script->stack_expand(stack); @@ -3709,7 +3743,8 @@ struct script_data* push_retinfo(struct script_stack* stack, struct script_retin } /// Pushes a copy of the target position into the stack -struct script_data* push_copy(struct script_stack* stack, int pos) { +static struct script_data *push_copy(struct script_stack *stack, int pos) +{ nullpo_retr(NULL, stack); switch( stack->stack_data[pos].type ) { case C_CONSTSTR: @@ -3734,7 +3769,8 @@ struct script_data* push_copy(struct script_stack* stack, int pos) { /// Removes the values in indexes [start,end[ from the stack. /// Adjusts all stack pointers. -void pop_stack(struct script_state* st, int start, int end) { +static void pop_stack(struct script_state *st, int start, int end) +{ struct script_stack* stack; struct script_data* data; int i; @@ -3806,7 +3842,7 @@ void pop_stack(struct script_state* st, int start, int end) { /*========================================== * Release script dependent variable, dependent variable of function *------------------------------------------*/ -void script_free_vars(struct DBMap *var_storage) +static void script_free_vars(struct DBMap *var_storage) { if( var_storage ) { // destroy the storage construct containing the variables @@ -3814,7 +3850,7 @@ void script_free_vars(struct DBMap *var_storage) } } -void script_free_code(struct script_code* code) +static void script_free_code(struct script_code *code) { nullpo_retv(code); @@ -3834,7 +3870,8 @@ void script_free_code(struct script_code* code) /// @param rid Who is running the script (attached player) /// @param oid Where the code is being run (npc 'object') /// @return Script state -struct script_state* script_alloc_state(struct script_code* rootscript, int pos, int rid, int oid) { +static struct script_state *script_alloc_state(struct script_code *rootscript, int pos, int rid, int oid) +{ struct script_state* st; st = ers_alloc(script->st_ers, struct script_state); @@ -3876,7 +3913,8 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos, /// Frees a script state. /// /// @param st Script state -void script_free_state(struct script_state* st) { +static void script_free_state(struct script_state *st) +{ nullpo_retv(st); if( idb_exists(script->st_db,st->id) ) { struct map_session_data *sd = st->rid ? map->id2sd(st->rid) : NULL; @@ -3938,7 +3976,8 @@ void script_free_state(struct script_state* st) { * @param st[in] Script state. * @param ref[in] Reference to be added. */ -void script_add_pending_ref(struct script_state *st, struct reg_db *ref) { +static void script_add_pending_ref(struct script_state *st, struct reg_db *ref) +{ nullpo_retv(st); RECREATE(st->pending_refs, struct reg_db*, ++st->pending_ref_count); st->pending_refs[st->pending_ref_count-1] = ref; @@ -3950,7 +3989,7 @@ void script_add_pending_ref(struct script_state *st, struct reg_db *ref) { /*========================================== * Read command *------------------------------------------*/ -c_op get_com(const struct script_buf *scriptbuf, int *pos) +static c_op get_com(const struct script_buf *scriptbuf, int *pos) { int i = 0, j = 0; @@ -3967,7 +4006,7 @@ c_op get_com(const struct script_buf *scriptbuf, int *pos) /*========================================== * Income figures *------------------------------------------*/ -int get_num(const struct script_buf *scriptbuf, int *pos) +static int get_num(const struct script_buf *scriptbuf, int *pos) { int i,j; i=0; j=0; @@ -3980,7 +4019,7 @@ int get_num(const struct script_buf *scriptbuf, int *pos) /// Ternary operators /// test ? if_true : if_false -void op_3(struct script_state* st, int op) +static void op_3(struct script_state *st, int op) { struct script_data* data; int flag = 0; @@ -4017,7 +4056,7 @@ void op_3(struct script_state* st, int op) /// s1 RE_EQ s2 -> i /// s1 RE_NE s2 -> i /// s1 ADD s2 -> s -void op_2str(struct script_state* st, int op, const char* s1, const char* s2) +static void op_2str(struct script_state *st, int op, const char *s1, const char *s2) { int a = 0; @@ -4114,7 +4153,7 @@ void op_2str(struct script_state* st, int op, const char* s1, const char* s2) /// Binary number operators /// i OP i -> i -void op_2num(struct script_state* st, int op, int i1, int i2) +static void op_2num(struct script_state *st, int op, int i1, int i2) { int ret; int64 ret64; @@ -4174,7 +4213,7 @@ void op_2num(struct script_state* st, int op, int i1, int i2) } /// Binary operators -void op_2(struct script_state *st, int op) +static void op_2(struct script_state *st, int op) { struct script_data* left, leftref; struct script_data* right; @@ -4248,7 +4287,7 @@ void op_2(struct script_state *st, int op) /// NEG i -> i /// NOT i -> i /// LNOT i -> i -void op_1(struct script_state* st, int op) +static void op_1(struct script_state *st, int op) { struct script_data* data; int i1; @@ -4286,7 +4325,7 @@ void op_1(struct script_state* st, int op) /// /// @param st Script state whose stack arguments should be inspected. /// @param func Built-in function for which the arguments are intended. -bool script_check_buildin_argtype(struct script_state* st, int func) +static bool script_check_buildin_argtype(struct script_state *st, int func) { int idx, invalid = 0; char* sf; @@ -4372,7 +4411,7 @@ bool script_check_buildin_argtype(struct script_state* st, int func) /// Executes a buildin command. /// Stack: C_NAME() C_ARG ... -int run_func(struct script_state *st) +static int run_func(struct script_state *st) { struct script_data* data; int i,start_sp,end_sp,func; @@ -4465,7 +4504,8 @@ int run_func(struct script_state *st) /*========================================== * script execution *------------------------------------------*/ -void run_script(struct script_code *rootscript, int pos, int rid, int oid) { +static void run_script(struct script_code *rootscript, int pos, int rid, int oid) +{ struct script_state *st; if( rootscript == NULL || pos < 0 ) @@ -4479,7 +4519,7 @@ void run_script(struct script_code *rootscript, int pos, int rid, int oid) { script->run_main(st); } -void script_stop_instances(struct script_code *code) +static void script_stop_instances(struct script_code *code) { struct DBIterator *iter; struct script_state* st; @@ -4501,7 +4541,8 @@ void script_stop_instances(struct script_code *code) /*========================================== * Timer function for sleep *------------------------------------------*/ -int run_script_timer(int tid, int64 tick, int id, intptr_t data) { +static int run_script_timer(int tid, int64 tick, int id, intptr_t data) +{ struct script_state *st = idb_get(script->st_db,(int)data); if( st ) { struct map_session_data *sd = map->id2sd(st->rid); @@ -4522,7 +4563,8 @@ int run_script_timer(int tid, int64 tick, int id, intptr_t data) { /// /// @param st Script state to detach. /// @param dequeue_event Whether to schedule any queued events, when there was no previous script. -void script_detach_state(struct script_state* st, bool dequeue_event) { +static void script_detach_state(struct script_state *st, bool dequeue_event) +{ struct map_session_data* sd; nullpo_retv(st); @@ -4556,7 +4598,8 @@ void script_detach_state(struct script_state* st, bool dequeue_event) { /// Attaches script state to possibly attached character and backups it's previous script, if any. /// /// @param st Script state to attach. -void script_attach_state(struct script_state* st) { +static void script_attach_state(struct script_state *st) +{ struct map_session_data* sd; nullpo_retv(st); @@ -4588,7 +4631,8 @@ void script_attach_state(struct script_state* st) { /*========================================== * The main part of the script execution *------------------------------------------*/ -void run_script_main(struct script_state *st) { +static void run_script_main(struct script_state *st) +{ int cmdcount = script->config.check_cmdcount; int gotocount = script->config.check_gotocount; struct map_session_data *sd; @@ -4778,7 +4822,7 @@ void run_script_main(struct script_state *st) { * * @retval false in case of error. */ -bool script_config_read(const char *filename, bool imported) +static bool script_config_read(const char *filename, bool imported) { struct config_t config; struct config_setting_t * setting = NULL; @@ -4825,7 +4869,7 @@ bool script_config_read(const char *filename, bool imported) /** * @see DBApply */ -int db_script_free_code_sub(union DBKey key, struct DBData *data, va_list ap) +static int db_script_free_code_sub(union DBKey key, struct DBData *data, va_list ap) { struct script_code *code = DB->data2ptr(data); if (code) @@ -4833,7 +4877,7 @@ int db_script_free_code_sub(union DBKey key, struct DBData *data, va_list ap) return 0; } -void script_run_autobonus(const char *autobonus, int id, int pos) +static void script_run_autobonus(const char *autobonus, int id, int pos) { struct script_code *scriptroot = (struct script_code *)strdb_get(script->autobonus_db, autobonus); @@ -4843,7 +4887,7 @@ void script_run_autobonus(const char *autobonus, int id, int pos) } } -void script_add_autobonus(const char *autobonus) +static void script_add_autobonus(const char *autobonus) { if( strdb_get(script->autobonus_db, autobonus) == NULL ) { struct script_code *scriptroot = script->parse(autobonus, "autobonus", 0, 0, NULL); @@ -4854,7 +4898,8 @@ void script_add_autobonus(const char *autobonus) } /// resets a temporary character array variable to given value -void script_cleararray_pc(struct map_session_data* sd, const char* varname, void* value) { +static void script_cleararray_pc(struct map_session_data *sd, const char *varname, void *value) +{ struct script_array *sa = NULL; struct reg_db *src = NULL; unsigned int i, *list = NULL, size = 0; @@ -4881,7 +4926,8 @@ void script_cleararray_pc(struct map_session_data* sd, const char* varname, void /// sets a temporary character array variable element idx to given value /// @param refcache Pointer to an int variable, which keeps a copy of the reference to varname and must be initialized to 0. Can be NULL if only one element is set. -void script_setarray_pc(struct map_session_data* sd, const char* varname, uint32 idx, void* value, int* refcache) { +static void script_setarray_pc(struct map_session_data *sd, const char *varname, uint32 idx, void *value, int *refcache) +{ int key; if( idx >= SCRIPT_MAX_ARRAYSIZE ) { @@ -4901,7 +4947,7 @@ void script_setarray_pc(struct map_session_data* sd, const char* varname, uint32 /** * Clears persistent variables from memory **/ -int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap) +static int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap) { struct script_reg_state *src; @@ -4926,7 +4972,8 @@ int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap) /** * Clears a single persistent variable **/ -void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct script_reg_state *data) { +static void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct script_reg_state *data) +{ nullpo_retv(sd); nullpo_retv(data); i64db_remove(sd->regs.vars, reg); @@ -4942,21 +4989,23 @@ void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct sc ers_free(pc->num_reg_ers,(struct script_reg_num*)data); } } -unsigned int *script_array_cpy_list(struct script_array *sa) { +static unsigned int *script_array_cpy_list(struct script_array *sa) +{ nullpo_retr(NULL, sa); if( sa->size > script->generic_ui_array_size ) script->generic_ui_array_expand(sa->size); memcpy(script->generic_ui_array, sa->members, sizeof(unsigned int)*sa->size); return script->generic_ui_array; } -void script_generic_ui_array_expand (unsigned int plus) { +static void script_generic_ui_array_expand(unsigned int plus) +{ script->generic_ui_array_size += plus + 100; RECREATE(script->generic_ui_array, unsigned int, script->generic_ui_array_size); } /*========================================== * Destructor *------------------------------------------*/ -void do_final_script(void) +static void do_final_script(void) { int i; struct DBIterator *iter; @@ -5091,7 +5140,8 @@ void do_final_script(void) /** * **/ -uint8 script_add_language(const char *name) { +static uint8 script_add_language(const char *name) +{ uint8 lang_id = script->max_lang_id; nullpo_ret(name); @@ -5103,7 +5153,8 @@ uint8 script_add_language(const char *name) { /** * Goes thru db/translations.conf file **/ -void script_load_translations(void) { +static void script_load_translations(void) +{ struct config_t translations_conf; const char *config_filename = "db/translations.conf"; // FIXME hardcoded name struct config_setting_t *translations = NULL; @@ -5187,7 +5238,7 @@ void script_load_translations(void) { * @param file The filename. * @return The corresponding translation name. */ -const char *script_get_translation_file_name(const char *file) +static const char *script_get_translation_file_name(const char *file) { const char *basename = NULL, *last_dot = NULL; @@ -5231,7 +5282,7 @@ const char *script_get_translation_file_name(const char *file) * @return success state * @retval true if a new string was added. */ -bool script_load_translation_addstring(const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr) +static bool script_load_translation_addstring(const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr) { nullpo_retr(false, file); nullpo_retr(false, msgctxt); @@ -5299,7 +5350,7 @@ bool script_load_translation_addstring(const char *file, uint8 lang_id, const ch * @param lang_id The language identifier. * @return The amount of strings loaded. */ -int script_load_translation(const char *file, uint8 lang_id) +static int script_load_translation(const char *file, uint8 lang_id) { int translations = 0; char line[1024]; @@ -5439,7 +5490,8 @@ int script_load_translation(const char *file, uint8 lang_id) /** * **/ -void script_clear_translations(bool reload) { +static void script_clear_translations(bool reload) +{ uint32 i; if( script->string_list ) @@ -5473,7 +5525,7 @@ void script_clear_translations(bool reload) { /** * **/ -int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_list ap) +static int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_list ap) { struct DBMap *string_db = DB->data2ptr(data); @@ -5494,7 +5546,7 @@ int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_lis /** * **/ -void script_parser_clean_leftovers(void) +static void script_parser_clean_leftovers(void) { VECTOR_CLEAR(script->buf); @@ -5509,7 +5561,8 @@ void script_parser_clean_leftovers(void) /** * Performs cleanup after all parsing is processed **/ -int script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) { +static int script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) +{ script->parser_clean_leftovers(); script->parse_cleanup_timer_id = INVALID_TIMER; @@ -5520,7 +5573,8 @@ int script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Initialization *------------------------------------------*/ -void do_init_script(bool minimal) { +static void do_init_script(bool minimal) +{ script->parse_cleanup_timer_id = INVALID_TIMER; VECTOR_INIT(script->parse_simpleexpr_strbuf); @@ -5550,7 +5604,7 @@ void do_init_script(bool minimal) { script->load_translations(); } -int script_reload(void) +static int script_reload(void) { int i; struct DBIterator *iter; @@ -5602,7 +5656,8 @@ int script_reload(void) return 0; } /* returns name of current function being run, from within the stack [Ind/Hercules] */ -const char *script_getfuncname(struct script_state *st) { +static const char *script_getfuncname(struct script_state *st) +{ struct script_data *data; nullpo_retr(NULL, st); @@ -5626,7 +5681,7 @@ const char *script_getfuncname(struct script_state *st) { * already initialized) * @retval false if an error occurs. */ -bool script_sprintf_helper(struct script_state *st, int start, struct StringBuf *out) +static bool script_sprintf_helper(struct script_state *st, int start, struct StringBuf *out) { const char *format = NULL; const char *p = NULL, *np = NULL; @@ -5851,7 +5906,7 @@ bool script_sprintf_helper(struct script_state *st, int start, struct StringBuf /// If a dialog doesn't exist yet, one is created. /// /// mes ""; -BUILDIN(mes) +static BUILDIN(mes) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5872,7 +5927,7 @@ BUILDIN(mes) * mes ""; * @endcode */ -BUILDIN(mesf) +static BUILDIN(mesf) { struct map_session_data *sd = script->rid2sd(st); struct StringBuf buf; @@ -5897,7 +5952,7 @@ BUILDIN(mesf) /// The dialog text is cleared and the script continues when the button is pressed. /// /// next; -BUILDIN(next) +static BUILDIN(next) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5914,7 +5969,7 @@ BUILDIN(next) /// The dialog is closed when the button is pressed. /// /// close; -BUILDIN(close) +static BUILDIN(close) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5929,7 +5984,7 @@ BUILDIN(close) /// The dialog is closed and the script continues when the button is pressed. /// /// close2; -BUILDIN(close2) +static BUILDIN(close2) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5949,7 +6004,7 @@ BUILDIN(close2) /// Counts the number of valid and total number of options in 'str' /// If max_count > 0 the counting stops when that valid option is reached /// total is incremented for each option (NULL is supported) -int menu_countoptions(const char* str, int max_count, int* total) +static int menu_countoptions(const char *str, int max_count, int *total) { int count = 0; int bogus_total; @@ -5999,7 +6054,7 @@ int menu_countoptions(const char* str, int max_count, int* total) /// NOTE: the client closes the npc dialog when cancel is pressed /// /// menu "",{,"",,...}; -BUILDIN(menu) +static BUILDIN(menu) { int i; const char* text; @@ -6121,7 +6176,7 @@ BUILDIN(menu) /// select({,,...}) -> /// /// @see menu -BUILDIN(select) +static BUILDIN(select) { int i; const char* text; @@ -6196,7 +6251,7 @@ BUILDIN(select) /// prompt({,,...}) -> /// /// @see menu -BUILDIN(prompt) +static BUILDIN(prompt) { int i; const char *text; @@ -6278,7 +6333,7 @@ BUILDIN(prompt) /// Jumps to the target script label. /// /// goto