e576bb2002-10-11Martin Nilsson /* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. */
24ddc71998-03-28Henrik Grubbström (Grubba) 
06983f1996-09-22Fredrik Hübinette (Hubbe) #ifndef PIKE_TYPES_H #define PIKE_TYPES_H
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) #include "svalue.h"
b068742013-02-25Arne Goedeke #include "stralloc.h"
2a3bfa2017-01-26Henrik Grubbström (Grubba) #include "string_builder.h"
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) 
f2b8262001-03-03Henrik Grubbström (Grubba) #define PIKE_TYPE_STACK_SIZE 100000
23f1002001-03-03Henrik Grubbström (Grubba) #ifdef PIKE_DEBUG void TYPE_STACK_DEBUG(const char *fun); #else /* !PIKE_DEBUG */ #define TYPE_STACK_DEBUG(X) #endif /* PIKE_DEBUG */
d68a072001-02-20Henrik Grubbström (Grubba) /* * The new type type. */ struct pike_type {
abe64b2018-05-19Tobias S. Josefowitz  GC_MARKER_MEMBERS;
d68a072001-02-20Henrik Grubbström (Grubba)  unsigned INT32 hash; struct pike_type *next;
00f45d2007-03-26Henrik Grubbström (Grubba)  unsigned INT32 flags;
1a647d2001-03-03Henrik Grubbström (Grubba)  unsigned INT16 type;
d68a072001-02-20Henrik Grubbström (Grubba)  struct pike_type *car; struct pike_type *cdr; };
1a647d2001-03-03Henrik Grubbström (Grubba) 
23db452003-08-20Martin Stjernholm extern struct pike_type **pike_type_hash; extern size_t pike_type_hash_size;
03905b2003-06-30Martin Stjernholm #define CAR_TO_INT(TYPE) ((char *) (TYPE)->car - (char *) 0) #define CDR_TO_INT(TYPE) ((char *) (TYPE)->cdr - (char *) 0)
00f45d2007-03-26Henrik Grubbström (Grubba) /* * pike_type flags: */ #define PT_FLAG_MARKER_0 0x000001 /* The subtree holds a '0'. */ #define PT_FLAG_MARKER_1 0x000002 /* The subtree holds a '1'. */ #define PT_FLAG_MARKER_2 0x000004 /* The subtree holds a '2'. */ #define PT_FLAG_MARKER_3 0x000008 /* The subtree holds a '3'. */ #define PT_FLAG_MARKER_4 0x000010 /* The subtree holds a '4'. */ #define PT_FLAG_MARKER_5 0x000020 /* The subtree holds a '5'. */ #define PT_FLAG_MARKER_6 0x000040 /* The subtree holds a '6'. */ #define PT_FLAG_MARKER_7 0x000080 /* The subtree holds a '7'. */ #define PT_FLAG_MARKER_8 0x000100 /* The subtree holds a '8'. */ #define PT_FLAG_MARKER_9 0x000200 /* The subtree holds a '9'. */ #define PT_FLAG_MARKER 0x0003ff /* The subtree holds markers. */ #define PT_ASSIGN_SHIFT 12 /* Number of bits to shift. */ #define PT_FLAG_ASSIGN_0 0x001000 /* The subtree assigns '0'. */ #define PT_FLAG_ASSIGN_1 0x002000 /* The subtree assigns '1'. */ #define PT_FLAG_ASSIGN_2 0x004000 /* The subtree assigns '2'. */ #define PT_FLAG_ASSIGN_3 0x008000 /* The subtree assigns '3'. */ #define PT_FLAG_ASSIGN_4 0x010000 /* The subtree assigns '4'. */ #define PT_FLAG_ASSIGN_5 0x020000 /* The subtree assigns '5'. */ #define PT_FLAG_ASSIGN_6 0x040000 /* The subtree assigns '6'. */ #define PT_FLAG_ASSIGN_7 0x080000 /* The subtree assigns '7'. */ #define PT_FLAG_ASSIGN_8 0x100000 /* The subtree assigns '8'. */ #define PT_FLAG_ASSIGN_9 0x200000 /* The subtree assigns '9'. */ #define PT_FLAG_ASSIGN 0x3ff000 /* The subtree holds assigns. */
1a647d2001-03-03Henrik Grubbström (Grubba) 
633f5c2007-04-27Henrik Grubbström (Grubba) #define PT_FLAG_MARK_ASSIGN 0x3ff3ff /* Assigns AND Markers. */
77f0d62013-12-12Henrik Grubbström (Grubba) #define PT_FLAG_INT_ONLY 0x1000000 /* Filter non-integers. */
3eb8912020-09-21Henrik Grubbström (Grubba) /*
eaf18d2020-09-26Henrik Grubbström (Grubba)  * Flags used by remap_marker{,s}():
3eb8912020-09-21Henrik Grubbström (Grubba)  */
eaf18d2020-09-26Henrik Grubbström (Grubba) enum pt_remap_flags { PT_FLAG_REMAP_SWAP_MARKERS = 0x01, /* Swap A & B */ PT_FLAG_REMAP_BOTH_MARKERS = 0x02, /* Look in both sets. */ PT_FLAG_REMAP_BOTH_MARKERS_AND = 0x02, /* And both markers */ PT_FLAG_REMAP_BOTH_MARKERS_OR = 0x06, /* Or both markers */ PT_FLAG_REMAP_BOTH_MARKERS_MASK = 0x06, /* Mask for the above */
003e122020-10-05Henrik Grubbström (Grubba)  PT_FLAG_REMAP_EVAL_MARKERS = 0x08, /* Eval marker assignments */
eaf18d2020-09-26Henrik Grubbström (Grubba)  };
3eb8912020-09-21Henrik Grubbström (Grubba) 
e5b1a92020-10-07Henrik Grubbström (Grubba) /* * Operations for type_binop(). */ enum pt_binop { /* First the minterms */ PT_BINOP_AND = 0x01, /* A & B */ PT_BINOP_MINUS = 0x02, /* A & ~B */ PT_BINOP_INVERSE_MINUS = 0x04, /* ~A & B */ PT_BINOP_NOR = 0x08, /* ~A & ~B */ PT_BINOP_XOR = 0x06, /* A ^ B */ PT_BINOP_OR = 0x07, /* A | B */ PT_BINOP_XNOR = 0x09, /* ~(A ^ B) */ PT_BINOP_NAND = 0x0e, /* ~(A & B) */ PT_BINOP_A = 0x03, PT_BINOP_B = 0x05, PT_BINOP_NOT_A = 0x0c, PT_BINOP_NOT_B = 0x0a, PT_BINOP_NONE = 0x00, PT_BINOP_ALL = 0x0f, /* Missing: * * 0x0b (0b1011) A | ~B * 0x0d (0b1101) B | ~A */ };
d41c192020-09-27Henrik Grubbström (Grubba) /* * Flags used by intersect_types() and subtract_types(). */ enum pt_cmp_flags { PT_FLAG_CMP_VOIDABLE = 0x0100, /* Type may be void */ };
c895d02016-10-29Henrik Grubbström (Grubba) /* * Flags used by low_match_types(). */ #define A_EXACT 1 #define B_EXACT 2 #define NO_MAX_ARGS 4 #define NO_SHORTCUTS 8 #define TYPE_GROUPING /* * Flags used by pike_types_le() */ #define LE_WEAK_OBJECTS 1 /* Perform weaker checking of objects. */ #define LE_A_B_SWAPPED 2 /* Argument A and B have been swapped. * Relevant for markers. */ #ifdef TYPE_GROUPING #define LE_A_GROUPED 4 /* Argument A has been grouped. * Perform weaker checking for OR-nodes. */ #define LE_B_GROUPED 8 /* Argument B has been grouped. * Perform weaker checking for OR-nodes. */ #define LE_A_B_GROUPED 12 /* Both the above two flags. */ #endif #define LE_USE_HANDLERS 16 /* Call handlers if appropriate. */ #define LE_EXPLICIT_ZERO 32 /* Zero is not subtype of all others. */
8ec3c62016-10-30Henrik Grubbström (Grubba) #define LE_TYPE_SVALUE 64 /* Same matching as match_type_svalue(). */
c895d02016-10-29Henrik Grubbström (Grubba)  /* * Flags used by low_get_first_arg_type() * * Note that these differ for the flags to get_first_arg_type(). */ #define FILTER_KEEP_VOID 1 /* Keep void during the filtering. */ /* * Flags used as flag_method to mk_type() */ #define PT_COPY_CAR 1 #define PT_COPY_CDR 2 #define PT_COPY_BOTH 3 #define PT_IS_MARKER 4 /* The node is a marker. */
86245a2007-03-28Henrik Grubbström (Grubba) /*
e1483f2011-12-11Henrik Grubbström (Grubba)  * new_check_call(), check_splice_call() and get_first_arg_type() flags
86245a2007-03-28Henrik Grubbström (Grubba)  */
ebd2e42008-06-18Henrik Grubbström (Grubba) #define CALL_STRICT 0x0001 /* Strict checking. */
960b402011-12-09Henrik Grubbström (Grubba) #define CALL_NOT_LAST_ARG 0x0002 /* This is not the last argument. */
ebd2e42008-06-18Henrik Grubbström (Grubba) #define CALL_WEAK_VOID 0x0008 /* Allow promotion of void to zero. */ #define CALL_ARG_LVALUE 0x0010 /* Argument is lvalue (sscanf). */ #define CALL_INHIBIT_WARNINGS 0x0020 /* Inhibit warnings. */
ff2bb12011-12-15Henrik Grubbström (Grubba) #define CALL_INVERTED_TYPES 0x0040 /* The fun and arg are inverted. */
86245a2007-03-28Henrik Grubbström (Grubba) 
c6747d2007-04-13Henrik Grubbström (Grubba) /* * soft_cast() flags */ #define SOFT_WEAKER 0x0001 /* Soft cast to a weaker type. */
9b5a822001-03-29Henrik Grubbström (Grubba) void debug_free_type(struct pike_type *t); #ifdef DEBUG_MALLOC
be6fec2001-04-01Henrik Grubbström (Grubba) #define copy_pike_type(D, S) add_ref((struct pike_type *)debug_malloc_pass(D = (S)))
9b5a822001-03-29Henrik Grubbström (Grubba) #else /* !DEBUG_MALLOC */
be6fec2001-04-01Henrik Grubbström (Grubba) #define copy_pike_type(D, S) add_ref(D = (S))
9b5a822001-03-29Henrik Grubbström (Grubba) #endif /* DEBUG_MALLOC */
1a647d2001-03-03Henrik Grubbström (Grubba) #define CONSTTYPE(X) make_pike_type(X)
18cec02014-05-22Per Hedbor extern struct pike_type **type_stack; extern struct pike_type ***pike_type_mark_stack;
1a647d2001-03-03Henrik Grubbström (Grubba) 
97a7332008-03-30Martin Stjernholm #define debug_free_type_preamble(T) do { \ debug_malloc_touch_named (T, "free_type"); \
cd9dfa2008-03-29Martin Stjernholm  DO_IF_DEBUG ( \ DO_IF_PIKE_CLEANUP ( \ if (gc_external_refs_zapped) \
97a7332008-03-30Martin Stjernholm  gc_check_zapped (T, PIKE_T_TYPE, __FILE__, __LINE__))); \ } while (0) #define free_type(T) do { \ struct pike_type *t_ = (T); \ debug_free_type_preamble (t_); \
cd9dfa2008-03-29Martin Stjernholm  debug_free_type (t_); \ } while (0)
d68a072001-02-20Henrik Grubbström (Grubba) 
97a7332008-03-30Martin Stjernholm #define free_pike_type free_type
1d53281996-11-25Fredrik Hübinette (Hubbe) extern int max_correct_args;
c507ca2007-03-20Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *string0_type_string;
d68a072001-02-20Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *string_type_string; PMOD_EXPORT extern struct pike_type *int_type_string;
218dba2020-01-08Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *int_pos_type_string;
d68a072001-02-20Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *float_type_string; PMOD_EXPORT extern struct pike_type *object_type_string; PMOD_EXPORT extern struct pike_type *function_type_string;
6901f22020-09-25Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *void_function_type_string;
d68a072001-02-20Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *program_type_string; PMOD_EXPORT extern struct pike_type *array_type_string;
dc8ade2001-03-02Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *multiset_type_string;
d68a072001-02-20Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *mapping_type_string; PMOD_EXPORT extern struct pike_type *type_type_string; PMOD_EXPORT extern struct pike_type *mixed_type_string; PMOD_EXPORT extern struct pike_type *void_type_string; PMOD_EXPORT extern struct pike_type *zero_type_string;
38f9312014-05-03Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *inheritable_type_string; PMOD_EXPORT extern struct pike_type *typeable_type_string;
d6f6d62013-11-08Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *enumerable_type_string;
d68a072001-02-20Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *any_type_string; PMOD_EXPORT extern struct pike_type *weak_type_string;
6f16cb2008-05-18Henrik Grubbström (Grubba) extern struct pike_type *sscanf_type_string;
1874052018-04-21Henrik Grubbström (Grubba) PMOD_EXPORT extern struct pike_type *utf8_type_string;
06983f1996-09-22Fredrik Hübinette (Hubbe) 
68ec3f2014-08-18Martin Nilsson PMOD_EXPORT extern struct pike_string *literal_string_string; PMOD_EXPORT extern struct pike_string *literal_int_string; PMOD_EXPORT extern struct pike_string *literal_float_string; PMOD_EXPORT extern struct pike_string *literal_function_string; PMOD_EXPORT extern struct pike_string *literal_object_string; PMOD_EXPORT extern struct pike_string *literal_program_string; PMOD_EXPORT extern struct pike_string *literal_array_string; PMOD_EXPORT extern struct pike_string *literal_multiset_string; PMOD_EXPORT extern struct pike_string *literal_mapping_string; PMOD_EXPORT extern struct pike_string *literal_type_string; PMOD_EXPORT extern struct pike_string *literal_mixed_string;
3699402001-02-20Henrik Grubbström (Grubba) #define CONSTTYPE(X) make_pike_type(X)
9405012007-04-26Martin Stjernholm  #ifdef DO_PIKE_CLEANUP
a7f0522001-03-02Henrik Grubbström (Grubba) struct pike_type_location { struct pike_type *t; struct pike_type_location *next; }; extern struct pike_type_location *all_pike_type_locations; #define MAKE_CONSTANT_TYPE(T, X) do { \ static struct pike_type_location type_; \
2129d22001-03-28Henrik Grubbström (Grubba)  if (!type_.t) { \
a7f0522001-03-02Henrik Grubbström (Grubba)  type_.t = CONSTTYPE(X); \ type_.next = all_pike_type_locations; \ all_pike_type_locations = &type_; \ } \
be6fec2001-04-01Henrik Grubbström (Grubba)  copy_pike_type((T), type_.t); \
a7f0522001-03-02Henrik Grubbström (Grubba)  } while(0)
9405012007-04-26Martin Stjernholm #else /* !DO_PIKE_CLEANUP */
a7f0522001-03-02Henrik Grubbström (Grubba) #define MAKE_CONSTANT_TYPE(T, X) do { \ static struct pike_type *type_; \ if (!type_) { \ type_ = CONSTTYPE(X); \ } \
be6fec2001-04-01Henrik Grubbström (Grubba)  copy_pike_type((T), type_); \
a7f0522001-03-02Henrik Grubbström (Grubba)  } while(0)
9405012007-04-26Martin Stjernholm #endif /* DO_PIKE_CLEANUP */
b2d75f1999-10-25Fredrik Hübinette (Hubbe) 
71f3a21998-11-22Fredrik Hübinette (Hubbe) #ifdef PIKE_DEBUG
fb2f661998-11-05Fredrik Hübinette (Hubbe) #define init_type_stack() type_stack_mark() #define exit_type_stack() do {\
393a592000-08-16Henrik Grubbström (Grubba)  ptrdiff_t q_q_q_q = pop_stack_mark(); \
6da27e2016-02-12Martin Nilsson  if(q_q_q_q) Pike_fatal("Type stack out of wack! %ld\n", (long)q_q_q_q); \
fb2f661998-11-05Fredrik Hübinette (Hubbe)  } while(0) #else
36feac1997-03-06Fredrik Hübinette (Hubbe) #define init_type_stack type_stack_mark #define exit_type_stack pop_stack_mark
fb2f661998-11-05Fredrik Hübinette (Hubbe) #endif
36feac1997-03-06Fredrik Hübinette (Hubbe) 
7e877a2003-04-02Martin Stjernholm void debug_push_type(unsigned int type); void debug_push_reverse_type(unsigned int type);
9b5a822001-03-29Henrik Grubbström (Grubba) #ifdef DEBUG_MALLOC #define push_type(T) do { debug_push_type(T); debug_malloc_pass(debug_peek_type_stack()); } while(0) #define push_reverse_type(T) do { debug_push_reverse_type(T); debug_malloc_pass(debug_peek_type_stack()); } while(0) #else /* !DEBUG_MALLOC */ #define push_type debug_push_type #define push_reverse_type debug_push_reverse_type #endif /* DEBUG_MALLOC */
1a647d2001-03-03Henrik Grubbström (Grubba) 
3b54e52014-08-21Martin Nilsson extern void type_stack_mark(void);
91aab41999-12-13Martin Stjernholm 
1347171998-04-23Fredrik Hübinette (Hubbe) #define reset_type_stack() do { \ type_stack_pop_to_mark(); \ type_stack_mark(); \ } while(0)
06983f1996-09-22Fredrik Hübinette (Hubbe) /* Prototypes begin here */
d476592013-06-12Arne Goedeke PMOD_EXPORT void really_free_pike_type(struct pike_type * t);
3b54e52014-08-21Martin Nilsson PMOD_EXPORT ATTRIBUTE((malloc)) struct pike_type * alloc_pike_type(void);
d476592013-06-12Arne Goedeke PMOD_EXPORT void count_memory_in_pike_types(size_t *n, size_t *s);
be478c1997-08-30Henrik Grubbström (Grubba) void init_types(void);
e21f422020-01-06Henrik Grubbström (Grubba) ptrdiff_t peek_stack_mark(void);
e0755c2000-08-15Henrik Grubbström (Grubba) ptrdiff_t pop_stack_mark(void);
7e877a2003-04-02Martin Stjernholm void debug_pop_type_stack(unsigned int expected);
be478c1997-08-30Henrik Grubbström (Grubba) void type_stack_pop_to_mark(void); void type_stack_reverse(void);
9b5a822001-03-29Henrik Grubbström (Grubba) struct pike_type *debug_peek_type_stack(void);
69aa4b2003-01-26Mirar (Pontus Hagland) void debug_push_int_type(INT_TYPE min, INT_TYPE max);
04017d2020-01-02Henrik Grubbström (Grubba) void debug_push_unlimited_array_type(enum PIKE_TYPE t);
9b5a822001-03-29Henrik Grubbström (Grubba) void debug_push_object_type(int flag, INT32 id); void debug_push_object_type_backwards(int flag, INT32 id);
9129122007-04-21Henrik Grubbström (Grubba) void debug_push_type_attribute(struct pike_string *attr);
9b5a822001-03-29Henrik Grubbström (Grubba) void debug_push_type_name(struct pike_string *name);
b660c81999-03-01Fredrik Hübinette (Hubbe) INT32 extract_type_int(char *p);
9b5a822001-03-29Henrik Grubbström (Grubba) void debug_push_unfinished_type(char *s); void debug_push_assign_type(int marker); void debug_push_finished_type(struct pike_type *type); void debug_push_finished_type_backwards(struct pike_type *type);
b8d5602007-11-11Martin Nilsson void debug_push_scope_type(int level);
d68a072001-02-20Henrik Grubbström (Grubba) struct pike_type *debug_pop_unfinished_type(void);
38a96a2020-01-04Henrik Grubbström (Grubba) void compiler_discard_top_type (void);
884b6f2008-06-17Martin Stjernholm void compiler_discard_type (void);
d68a072001-02-20Henrik Grubbström (Grubba) struct pike_type *debug_pop_type(void); struct pike_type *debug_compiler_pop_type(void);
0929a02002-09-12Marcus Comstedt struct pike_type *parse_type(const char *s);
e0755c2000-08-15Henrik Grubbström (Grubba) void stupid_describe_type(char *a, ptrdiff_t len);
d68a072001-02-20Henrik Grubbström (Grubba) void simple_describe_type(struct pike_type *s);
b10e412015-10-11Henrik Grubbström (Grubba) void low_describe_type(struct string_builder *s, struct pike_type *type);
d68a072001-02-20Henrik Grubbström (Grubba) struct pike_string *describe_type(struct pike_type *type); TYPE_T compile_type_to_runtime_type(struct pike_type *s);
fe607e2019-04-09Henrik Grubbström (Grubba) int deprecated_typep(struct pike_type *t);
a570c52016-06-13Henrik Grubbström (Grubba) int get_int_type_range(struct pike_type *t, INT_TYPE *range);
d68a072001-02-20Henrik Grubbström (Grubba) struct pike_type *or_pike_types(struct pike_type *a, struct pike_type *b, int zero_implied); struct pike_type *and_pike_types(struct pike_type *a, struct pike_type *b);
d41c192020-09-27Henrik Grubbström (Grubba) struct pike_type *subtract_types(struct pike_type *a, struct pike_type *b, enum pt_cmp_flags aflags, enum pt_cmp_flags bflags, enum pt_remap_flags remap_flags); struct pike_type *intersect_types(struct pike_type *a, struct pike_type *b, enum pt_cmp_flags aflags, enum pt_cmp_flags bflags, enum pt_remap_flags remap_flags);
b8a6882001-02-26Henrik Grubbström (Grubba) int strict_check_call(struct pike_type *fun_type, struct pike_type *arg_type);
d68a072001-02-20Henrik Grubbström (Grubba) int check_soft_cast(struct pike_type *to, struct pike_type *from); int match_types(struct pike_type *a,struct pike_type *b); int pike_types_le(struct pike_type *a, struct pike_type *b);
8ec3c62016-10-30Henrik Grubbström (Grubba) int check_variant_overload(struct pike_type *a, struct pike_type *b);
d68a072001-02-20Henrik Grubbström (Grubba) struct pike_type *index_type(struct pike_type *type,
6e4c642002-09-11Marcus Comstedt  struct pike_type *type_of_index,
d68a072001-02-20Henrik Grubbström (Grubba)  node *n);
663cbf2002-05-15Henrik Grubbström (Grubba) struct pike_type *range_type(struct pike_type *type, struct pike_type *index1_type, struct pike_type *index2_type);
d68a072001-02-20Henrik Grubbström (Grubba) struct pike_type *array_value_type(struct pike_type *array_type); struct pike_type *key_type(struct pike_type *type, node *n); int check_indexing(struct pike_type *type,
6e4c642002-09-11Marcus Comstedt  struct pike_type *type_of_index,
b8cda21997-01-21Fredrik Hübinette (Hubbe)  node *n);
d68a072001-02-20Henrik Grubbström (Grubba) int count_arguments(struct pike_type *s); int minimum_arguments(struct pike_type *s);
1a647d2001-03-03Henrik Grubbström (Grubba) struct pike_type *check_call(struct pike_type *args, struct pike_type *type, int strict);
2d787e2006-10-27Henrik Grubbström (Grubba) struct pike_type *get_argument_type(struct pike_type *fun, int arg_no);
c6747d2007-04-13Henrik Grubbström (Grubba) struct pike_type *soft_cast(struct pike_type *soft_type, struct pike_type *orig_type, int flags);
9956832013-05-26Henrik Grubbström (Grubba) struct pike_type *check_call_svalue(struct pike_type *fun_type, INT32 flags, struct svalue *sval);
0e835b2007-03-29Henrik Grubbström (Grubba) struct pike_type *low_new_check_call(struct pike_type *fun_type, struct pike_type *arg_type,
9129122007-04-21Henrik Grubbström (Grubba)  INT32 flags, struct svalue *sval);
00f45d2007-03-26Henrik Grubbström (Grubba) struct pike_type *new_get_return_type(struct pike_type *fun_type, INT32 flags); struct pike_type *get_first_arg_type(struct pike_type *fun_type, INT32 flags);
ebd2e42008-06-18Henrik Grubbström (Grubba) struct pike_type *check_splice_call(struct pike_string *fun_name, struct pike_type *fun_type, INT32 argno, struct pike_type *arg_type, struct svalue *sval, INT32 flags);
9129122007-04-21Henrik Grubbström (Grubba) struct pike_type *new_check_call(struct pike_string *fun_name, struct pike_type *fun_type,
6f16cb2008-05-18Henrik Grubbström (Grubba)  node *args, INT32 *argno, INT32 flags);
8cfb912008-04-25Henrik Grubbström (Grubba) struct pike_type *zzap_function_return(struct pike_type *t, struct pike_type *fun_ret);
93affb2013-05-31Per Hedbor struct pike_type *get_lax_type_of_svalue( const struct svalue *s );
01d0152008-07-09Martin Stjernholm struct pike_type *get_type_of_svalue(const struct svalue *s);
d68a072001-02-20Henrik Grubbström (Grubba) struct pike_type *object_type_to_program_type(struct pike_type *obj_t);
e68c782006-07-05Martin Stjernholm PMOD_EXPORT char *get_name_of_type(TYPE_T t);
be478c1997-08-30Henrik Grubbström (Grubba) void cleanup_pike_types(void);
f52b4a2001-12-14Martin Nilsson void cleanup_pike_type_table(void);
467f242011-01-28Henrik Grubbström (Grubba) PMOD_EXPORT void *find_type(struct pike_type *t, void *(*cb)(struct pike_type *));
d056542014-06-17Henrik Grubbström (Grubba) PMOD_EXPORT void visit_type (struct pike_type *t, int action, void *extra);
cd9dfa2008-03-29Martin Stjernholm void gc_mark_type_as_referenced(struct pike_type *t);
97a7332008-03-30Martin Stjernholm void gc_check_type (struct pike_type *t);
cd9dfa2008-03-29Martin Stjernholm void gc_check_all_types (void);
d5b6742001-02-23Henrik Grubbström (Grubba) int type_may_overload(struct pike_type *type, int lfun);
94d66b2008-05-24Henrik Grubbström (Grubba) void yyexplain_nonmatching_types(int severity_level, struct pike_string *a_file, INT32 a_line, struct pike_type *type_a, struct pike_string *b_file, INT32 b_line, struct pike_type *type_b);
4d404a2013-02-19Henrik Grubbström (Grubba) void string_builder_explain_nonmatching_types(struct string_builder *s, struct pike_type *type_a, struct pike_type *type_b);
9b5a822001-03-29Henrik Grubbström (Grubba) struct pike_type *debug_make_pike_type(const char *t);
9e6f6f2001-03-18Henrik Grubbström (Grubba) struct pike_string *type_to_string(struct pike_type *t);
d5b6742001-02-23Henrik Grubbström (Grubba) int pike_type_allow_premature_toss(struct pike_type *type);
9129122007-04-21Henrik Grubbström (Grubba) void register_attribute_handler(struct pike_string *attr, struct svalue *handler);
0079612014-09-30Per Hedbor  /* used by the precompiler to get the correct object types */ PMOD_EXPORT void set_program_id_to_id( int (*to)(int) );
06983f1996-09-22Fredrik Hübinette (Hubbe) /* Prototypes end here */
7c36d52014-06-17Henrik Grubbström (Grubba) #define visit_type_ref(T, REF_TYPE, EXTRA) \
5e83442008-05-11Martin Stjernholm  visit_ref (pass_type (T), (REF_TYPE), \
7c36d52014-06-17Henrik Grubbström (Grubba)  (visit_thing_fn *) &visit_type, (EXTRA))
5e83442008-05-11Martin Stjernholm 
61e9a01998-01-25Fredrik Hübinette (Hubbe) #ifdef DEBUG_MALLOC
d68a072001-02-20Henrik Grubbström (Grubba) #define pop_type() ((struct pike_type *)debug_malloc_pass(debug_pop_type())) #define compiler_pop_type() ((struct pike_type *)debug_malloc_pass(debug_compiler_pop_type()))
61e9a01998-01-25Fredrik Hübinette (Hubbe) #define pop_unfinished_type() \
d68a072001-02-20Henrik Grubbström (Grubba)  ((struct pike_type *)debug_malloc_pass(debug_pop_unfinished_type()))
9b5a822001-03-29Henrik Grubbström (Grubba) #define make_pike_type(X) \ ((struct pike_type *)debug_malloc_pass(debug_make_pike_type(X)))
00f45d2007-03-26Henrik Grubbström (Grubba) #define peek_type_stack() ((struct pike_type *)debug_malloc_pass(debug_peek_type_stack()))
5b368e2001-03-31Henrik Grubbström (Grubba) #define pop_type_stack(E) do { debug_malloc_pass(debug_peek_type_stack()); debug_pop_type_stack(E); } while(0)
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_int_type(MIN,MAX) do { debug_push_int_type(MIN,MAX);debug_malloc_pass(debug_peek_type_stack()); } while(0)
04017d2020-01-02Henrik Grubbström (Grubba) #define push_unlimited_array_type(ARRAY_OR_STRING) do { debug_push_unlimited_array_type(ARRAY_OR_STRING);debug_malloc_pass(debug_peek_type_stack()); } while(0)
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_object_type(FLAG,ID) do { debug_push_object_type(FLAG,ID);debug_malloc_pass(debug_peek_type_stack()); } while(0) #define push_object_type_backwards(FLAG,ID) do { debug_push_object_type_backwards(FLAG,ID);debug_malloc_pass(debug_peek_type_stack()); } while(0) #define push_scope_type(LEVEL) do { debug_push_scope_type(LEVEL);debug_malloc_pass(debug_peek_type_stack()); } while(0)
9129122007-04-21Henrik Grubbström (Grubba) #define push_type_attribute(ATTR) do { debug_push_type_attribute((struct pike_string *)debug_malloc_pass(ATTR));debug_malloc_pass(debug_peek_type_stack()); } while(0)
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_type_name(NAME) do { debug_push_type_name((struct pike_string *)debug_malloc_pass(NAME));debug_malloc_pass(debug_peek_type_stack()); } while(0)
d79bff2020-07-17Henrik Grubbström (Grubba) #define push_type_operator(OP, ARG) do { debug_push_type_operator(OP, (struct pike_type *)debug_malloc_pass(ARG));debug_malloc_pass(debug_peek_type_stack()); } while(0)
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_unfinished_type(S) ERROR #define push_assign_type(MARKER) do { debug_push_assign_type(MARKER);debug_malloc_pass(debug_peek_type_stack()); } while(0) #define push_finished_type(T) do { debug_push_finished_type((struct pike_type *)debug_malloc_pass(T));debug_malloc_pass(debug_peek_type_stack()); } while(0)
00f45d2007-03-26Henrik Grubbström (Grubba) #define push_finished_type_with_markers(T,M,MS) do { debug_push_finished_type_with_markers((struct pike_type *)debug_malloc_pass(T),M,MS);debug_malloc_pass(debug_peek_type_stack()); } while(0)
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_finished_type_backwards(T) ERROR
61e9a01998-01-25Fredrik Hübinette (Hubbe) #else
52409b2001-03-29Henrik Grubbström (Grubba) #define make_pike_type debug_make_pike_type
61e9a01998-01-25Fredrik Hübinette (Hubbe) #define pop_type debug_pop_type
4142a61998-05-19Fredrik Hübinette (Hubbe) #define compiler_pop_type debug_compiler_pop_type
61e9a01998-01-25Fredrik Hübinette (Hubbe) #define pop_unfinished_type debug_pop_unfinished_type
00f45d2007-03-26Henrik Grubbström (Grubba) #define peek_type_stack debug_peek_type_stack
9b5a822001-03-29Henrik Grubbström (Grubba) #define pop_type_stack debug_pop_type_stack #define push_int_type debug_push_int_type
04017d2020-01-02Henrik Grubbström (Grubba) #define push_unlimited_array_type debug_push_unlimited_array_type
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_object_type debug_push_object_type #define push_object_type_backwards debug_push_object_type_backwards #define push_scope_type debug_push_scope_type
9129122007-04-21Henrik Grubbström (Grubba) #define push_type_attribute debug_push_type_attribute
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_type_name debug_push_type_name
d79bff2020-07-17Henrik Grubbström (Grubba) #define push_type_operator debug_push_type_operator
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_unfinished_type debug_push_unfinished_type #define push_assign_type debug_push_assign_type #define push_finished_type debug_push_finished_type
a0315f2001-03-29Henrik Grubbström (Grubba) #define push_finished_type_with_markers debug_push_finished_type_with_markers
9b5a822001-03-29Henrik Grubbström (Grubba) #define push_finished_type_backwards debug_push_finished_type_backwards
61e9a01998-01-25Fredrik Hübinette (Hubbe) #endif
06983f1996-09-22Fredrik Hübinette (Hubbe) #endif