|
@@ -239,7 +239,7 @@ static int math_set_name(char *p, struct arch *arch_fn) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-static int name_defined(char *name) {
|
|
|
|
|
|
|
+int name_defined(char *name) {
|
|
|
struct klist_node *n;
|
|
struct klist_node *n;
|
|
|
|
|
|
|
|
for (n = names_list.next; n != &names_list; n = n->next)
|
|
for (n = names_list.next; n != &names_list; n = n->next)
|
|
@@ -297,7 +297,7 @@ static int declare_object(char *p, struct arch *arch_fn) {
|
|
|
|
|
|
|
|
/* we will not free the name because interp_libs_dump uses it */
|
|
/* we will not free the name because interp_libs_dump uses it */
|
|
|
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ return 0;
|
|
|
|
|
|
|
|
case WORDTYPE_NAME:
|
|
case WORDTYPE_NAME:
|
|
|
/* functions or variables */
|
|
/* functions or variables */
|
|
@@ -311,8 +311,6 @@ static int declare_object(char *p, struct arch *arch_fn) {
|
|
|
|
|
|
|
|
n->payload = name;
|
|
n->payload = name;
|
|
|
|
|
|
|
|
- klist_add(&names_list, n);
|
|
|
|
|
-
|
|
|
|
|
guess = NAMES;
|
|
guess = NAMES;
|
|
|
|
|
|
|
|
p += out;
|
|
p += out;
|
|
@@ -325,9 +323,6 @@ static int declare_object(char *p, struct arch *arch_fn) {
|
|
|
|
|
|
|
|
_skip_spaces(p);
|
|
_skip_spaces(p);
|
|
|
|
|
|
|
|
- if (guess == SHARED)
|
|
|
|
|
- goto skip;
|
|
|
|
|
-
|
|
|
|
|
/* try to getword */
|
|
/* try to getword */
|
|
|
|
|
|
|
|
getword(p, &type, &out);
|
|
getword(p, &type, &out);
|
|
@@ -412,29 +407,30 @@ skip: attr = getattrmask(p, declare_attrtab);
|
|
|
if (unlikely(!attr && guess != SHARED))
|
|
if (unlikely(!attr && guess != SHARED))
|
|
|
exit(generic_error("you must give attributes for declares", psave, lno));
|
|
exit(generic_error("you must give attributes for declares", psave, lno));
|
|
|
|
|
|
|
|
- if (guess != SHARED) {
|
|
|
|
|
- if (attr & 2)
|
|
|
|
|
- n->value |= DECLARE_FN;
|
|
|
|
|
|
|
+ if (attr & 2)
|
|
|
|
|
+ n->value |= DECLARE_FN;
|
|
|
|
|
|
|
|
- else if (attr & 4) {
|
|
|
|
|
- if (unlikely(guess == FUNCTION))
|
|
|
|
|
- exit(generic_error("you gave us a function declare but told us this is a variable declare? ",
|
|
|
|
|
- psave, lno));
|
|
|
|
|
|
|
+ else if (attr & 4) {
|
|
|
|
|
+ if (unlikely(guess == FUNCTION))
|
|
|
|
|
+ exit(generic_error("you gave us a function declare but told us this is a variable declare? ",
|
|
|
|
|
+ psave, lno));
|
|
|
|
|
|
|
|
- /* variable */
|
|
|
|
|
- n->value = DECLARE_VAR;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- else
|
|
|
|
|
- exit(generic_error("one of 'fn' or 'var' must be gave", psave, lno));
|
|
|
|
|
|
|
+ /* variable */
|
|
|
|
|
+ n->value = DECLARE_VAR;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ else
|
|
|
|
|
+ exit(generic_error("one of 'fn' or 'var' must be gave", psave, lno));
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (unlikely(name_defined(n->payload))) {
|
|
if (unlikely(name_defined(n->payload))) {
|
|
|
error((char *) n->payload);
|
|
error((char *) n->payload);
|
|
|
|
|
|
|
|
exit(generic_error("name already defined", psave, lno));
|
|
exit(generic_error("name already defined", psave, lno));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ klist_add(&names_list, n);
|
|
|
|
|
+
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|