From cc5e51e22559b2f58f33ec05238db00c4bb24ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Fri, 5 Jun 1998 20:27:26 -0700 Subject: [PATCH] new functions: is_call_to and node_may_overload Rev: src/las.c:1.63 Rev: src/las.h:1.15 --- src/las.c | 26 ++++++++++++++++++++++++-- src/las.h | 5 ++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/las.c b/src/las.c index 8d42239102..f8199bd4d3 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 d7a8cd2861..7a308693cb 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); -- GitLab