diff --git a/src/las.c b/src/las.c index 8d422391028b897010bf39c95453f395753db70b..f8199bd4d36d1e955159f2aad09e69ac15e88cb6 100644 --- a/src/las.c +++ b/src/las.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: las.c,v 1.62 1998/05/12 23:51:26 hubbe Exp $"); +RCSID("$Id: las.c,v 1.63 1998/06/06 03:27:25 hubbe Exp $"); #include "language.h" #include "interpret.h" @@ -956,6 +956,13 @@ int node_is_false(node *n) } } +int node_may_overload(node *n, int lfun) +{ + if(!n) return 0; + if(!n->type) return 1; + return type_may_overload(n->type->str, lfun); +} + node **last_cmd(node **a) { node **n; @@ -1001,7 +1008,22 @@ static node **low_get_arg(node **a,int *nr) } node **my_get_arg(node **a,int n) { return low_get_arg(a,&n); } -/* static node **first_arg(node **a) { return my_get_arg(a,0); } */ + +node **is_call_to(node *n, c_fun f) +{ + switch(n->token) + { + case F_APPLY: + if(CAR(n) && + CAR(n)->token == F_CONSTANT && + CAR(n)->u.sval.type == T_FUNCTION && + CAR(n)->u.sval.subtype == FUNCTION_BUILTIN && + CAR(n)->u.sval.u.efun->function == f) + return & CDR(n); + } + return 0; +} + static void low_print_tree(node *foo,int needlval) { diff --git a/src/las.h b/src/las.h index d7a8cd28611ea62a4a3644d50c8c6d8e3fe3c845..7a308693cb76005d1b599cad221bd2cee30d3baa 100644 --- a/src/las.h +++ b/src/las.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: las.h,v 1.14 1998/05/01 15:47:48 grubba Exp $ + * $Id: las.h,v 1.15 1998/06/06 03:27:26 hubbe Exp $ */ #ifndef LAS_H #define LAS_H @@ -17,6 +17,7 @@ #include "program.h" #define MAX_GLOBAL_VARIABLES 1000 +typedef void (*c_fun)(INT32); void yyerror(char *s); @@ -95,8 +96,10 @@ int is_const(node *n); int node_is_tossable(node *n); int node_is_true(node *n); int node_is_false(node *n); +int node_may_overload(node *n, int lfun); node **last_cmd(node **a); node **my_get_arg(node **a,int n); +node **is_call_to(node *n, c_fun f); void print_tree(node *n); struct used_vars; void fix_type_field(node *n);