/* $Id: ctalk.h,v 1.57 2009/03/01 03:50:23 kiesling Exp $ */

/*
  This file is part of Ctalk.
  Copyright  2005-2009 Robert Kiesling, ctalk@ctalklang.org.
  Permission is granted to copy this software provided that this copyright
  notice is included in all source code modules.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation, 
  Inc., 51 Franklin St., Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef _CTALK_H
#define _CTALK_H

#ifndef __BOOLEAN
#define __BOOLEAN
/*
 *  Compatible with X11/Intrinsic.h.
 */
#ifdef CRAY
typedef long Boolean;
#else
typedef char Boolean;
#endif
#define True 1
#define False 0
/* typedef enum { */
/*     True = TRUE, */
/*     False = FALSE */
/* } Boolean; */
#endif

#ifndef _STDARG_H
#include <stdarg.h>
#endif

#ifndef _PARSER_H
#include "parser.h"
#endif

#ifndef _FRAME_H
#include "frame.h"
#endif

#ifndef _CVAR_H
#include "cvar.h"
#endif

#ifndef _EXCEPT_H
#include "except.h"
#endif

#ifndef _LEX_H
#include "lex.h"
#endif

#ifndef _LIST_H
#include "list.h"
#endif

#ifndef _OPTION_H
#include "option.h"
#endif

#ifndef _CLASSLIB_H
#include "classlib.h"
#endif

#ifndef _OBJECT_H
#include "object.h"
#endif

#ifndef __BUFMTHD_H
#include "bufmthd.h"
#endif

#ifndef _CTRLBLK_H
#include "ctrlblk.h"
#endif

#ifndef _PENDING_H
#include "pending.h"
#endif

#ifndef _RTINFO_H
#include "rtinfo.h"
#endif

#ifndef _RT_EXPR_H
#include "rt_expr.h"
#endif

#ifndef _SYMBOL_H
#include "symbol.h"
#endif

#ifndef _DEFCLS_H
#include "defcls.h"
#endif

#ifndef _FNTMPL_H
#include "fntmpl.h"
#endif

#ifndef _STDARGCALL_H
#include "stdargcall.h"
#endif

#ifndef __OBJTOC_H
#include "objtoc.h"
#endif

#ifndef _CHASH_H
# ifndef N_HASH_BUCKETS
# define N_HASH_BUCKETS 1024
# endif
# include "chash.h"
#endif

#ifndef MAXLABEL
#define MAXLABEL 255
#endif


#ifndef MAXMSG
#define MAXMSG 8192
#endif



#ifndef MAXUSERDIRS
#define MAXUSERDIRS 15
#endif


#define SUCCESS 0
#define ERROR -1


#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE !(FALSE)
#endif


#ifndef MAXARGS
#define MAXARGS 512
#endif


#ifndef FILENAME_MAX
#define FILENAME_MAX 4096
#endif

/*
 *  Disk block size for reading and writing streams.  Linux uses
 *  1K blocks, and this should work nearly as well with other
 *  OS block sizes, although without optimization.
 */

#ifndef IO_BLKSIZE
#define IO_BLKSIZE 1024
#endif

#ifdef __DJGPP__
# ifndef S_SPLINT_S
# define SNPRINTF(_buf,_size,_fmt,...) sprintf (_buf,_fmt,__VA_ARGS__)
# else
# define SNPRINTF(_buf,_size,_fmt) 
# endif
#else
#define SNPRINTF(_buf,_size,_fmt,...) snprintf (_buf,_size,_fmt,__VA_ARGS__)
#endif

#if defined(__DJGPP__) || defined(__CYGWIN__)
#define CTPP_BIN "ctpp.exe"
#define FILE_WRITE_MODE "w"
#define FILE_READ_MODE "r"
#define FILE_APPEND_MODE "a"
#else
/*
 *  Include the "b" suffix for UNIX systems that
 *  normally perform text-mode file I/O.
 */
#define CTPP_BIN "ctpp"
#define FILE_WRITE_MODE "wb"
#define FILE_READ_MODE "rb"
#define FILE_APPEND_MODE "ab"
#endif

/*
 *  Used in class libraries also, so change the definitions there
 *  also if necessary.  Used mainly for *scanf.  The *printf 
 *  function formats are compatible using the "%#x" format.
 */
#define FMT_0XHEX(__p) "0x%p",(__p)

#ifndef N_MESSAGES 
#define N_MESSAGES (MAXARGS * 120)
#endif

#ifndef P_MESSAGES
#define P_MESSAGES (N_MESSAGES * 30)  /* Enough to include all ISO headers. */
#endif

#ifndef __need_MESSAGE_STACK
#define __need_MESSAGE_STACK
typedef MESSAGE ** MESSAGE_STACK;
#endif

#ifndef NULL
#define NULL ((void *)0)
#endif

#ifndef NULLSTR
#define NULLSTR "(null)"
#endif


#define STR_VAL(s) _STR_VAL(s)
#define _STR_VAL(s) #s

#define IS_CVAR(x) (!memcmp ((void *)x, "CVAR", 4))
#define IS_OBJECT(x) (!memcmp ((void *)x, "OBJECT", 6))
#define IS_MESSAGE(x) ((x) -> sig == 0xd2d2d2)
#define IS_METHOD(x) (!memcmp ((void *)x, "METHOD", 6))
#define IS_PARAM(x) (!memcmp ((void *)x, "PARAM", 5))
#define IS_LIST(x) (!memcmp (x, "LIST", 4))
#define IS_HEXSTR(x) (!strncmp (x, "16r", 3))
#define IS_MACRODEF(x) (!memcmp ((void *)x, "MACRODEF", 8))
#define IS_METHOD_MSG(m) (IS_MESSAGE(m) && (m -> tokentype == METHODMSGLABEL))
#define VAL_OBJECT(x) ((x -> value && !IS_OBJECT(x -> value)) ? \
                       ((OBJECT *)x -> value) : (OBJECT *)x)
#define M_NAME(m) (m -> name)
#define M_VAL(m)  (m -> value)
#define M_TOK(m) (m -> tokentype)
#define M_OBJ(m) (m -> obj)
#define M_VALUE_OBJ(m) ((m -> value_obj && IS_OBJECT(m -> value_obj)) ? \
                         m -> value_obj : ((m -> obj && IS_OBJECT(m -> obj))\
                         ? m -> obj : NULL))
#define M_SENDER(m) (m -> sender)
#define M_RECEIVER(m) (m -> receiver)

#define CLASSNAME(__o) ((!strcmp((__o)->__o_classname, "Class")) ? \
			(__o)->__o_name : (__o)->__o_classname)

#define TRIM_LITERAL(s) (substrcpy (s, s, 1, strlen (s) - 2))
#define TRIM_CHAR(c)    (substrcpy (c, c, 1, strlen (c) - 2))
#define TRIM_CHAR_BUF(s) \
  { \
    while ((s[0] == '\'')&&(s[1] != '\0')) \
       substrcpy (s, s, 1, strlen (s) - 2); \
  } \

#define _TOK_OBJ_VALUE_OBJ(__o) ((__o)->instancevars ? (__o)->instancevars : \
			     (__o))

#define METHOD_ARG_MSG_TYPE(m) ((m -> tokentype == OPENPAREN) || \
                                (m -> tokentype == CHAR) || \
                                (m -> tokentype == EQ) || \
                                (m -> tokentype == BOOLEAN_EQ) || \
                                (m -> tokentype == GT) || \
                                (m -> tokentype == GE) || \
                                (m -> tokentype == ASR) || \
                                (m -> tokentype == ASR_ASSIGN) || \
                                (m -> tokentype == LT) || \
                                (m -> tokentype == LE) || \
                                (m -> tokentype == ASL) || \
                                (m -> tokentype == ASL_ASSIGN) || \
                                (m -> tokentype == PLUS) || \
                                (m -> tokentype == PLUS_ASSIGN) || \
                                (m -> tokentype == INCREMENT) || \
                                (m -> tokentype == MINUS) || \
                                (m -> tokentype == MINUS_ASSIGN) || \
                                (m -> tokentype == DECREMENT) || \
                                (m -> tokentype == DEREF) || \
                                (m -> tokentype == MULT) || \
                                (m -> tokentype == MULT_ASSIGN) || \
                                (m -> tokentype == DIVIDE) || \
                                (m -> tokentype == DIV_ASSIGN) || \
                                (m -> tokentype == DIVIDE) || \
                                (m -> tokentype == BIT_AND) || \
                                (m -> tokentype == BIT_AND_ASSIGN) || \
                                (m -> tokentype == BIT_COMP) || \
                                (m -> tokentype == LOG_NEG) || \
                                (m -> tokentype == INEQUALITY) || \
                                (m -> tokentype == BIT_OR) || \
                                (m -> tokentype == BOOLEAN_OR) || \
                                (m -> tokentype == BIT_OR_ASSIGN) || \
                                (m -> tokentype == BIT_XOR) || \
                                (m -> tokentype == BIT_XOR_ASSIGN) || \
                                (m -> tokentype == PERIOD) || \
                                (m -> tokentype == ELLIPSIS) || \
                                (m -> tokentype == LITERALIZE) || \
                                (m -> tokentype == MACRO_CONCAT) || \
                                (m -> tokentype == CONDITIONAL) || \
                                (m -> tokentype == COLON) || \
                                (m -> tokentype == LABEL) || \
                                (m -> tokentype == METHODLABEL) || \
                                (m -> tokentype == LITERAL) || \
                                (m -> tokentype == LITERAL_CHAR) || \
                                (m -> tokentype == INTEGER) || \
                                (m -> tokentype == LONG) || \
                                (m -> tokentype == LONGLONG) || \
                                (m -> tokentype == FLOAT))
#define METHOD_ARG_TERM_MSG_TYPE(m) ((m -> tokentype == SEMICOLON) || \
                                     (m -> tokentype == CLOSEPAREN) || \
                                     (m -> tokentype == ARGSEPARATOR) || \
                                     (m -> tokentype == ARRAYCLOSE) || \
                                     (m -> tokentype == DEREF))
#define CONSTANT_TOK(m) ((m -> tokentype == LITERAL) || \
                         (m -> tokentype == LITERAL_CHAR) || \
                         (m -> tokentype == INTEGER) || \
                         (m -> tokentype == LONG) || \
                         (m -> tokentype == FLOAT) || \
                         (m -> tokentype == LONGLONG))

#define THIS_FRAME (frame_at (current_parser () -> frame))
#define NEXT_FRAME (frame_at ((current_parser () -> frame) - 1))
#define HAVE_FRAMES ((interpreter_pass == parsing_pass) || \
                     (interpreter_pass == library_pass) || \
                     (interpreter_pass == method_pass) || \
                     (interpreter_pass == expr_check) || \
                     (interpreter_pass == c_fn_pass))


#define LINE_SPLICE(messages, i) (((i) < stack_start ((messages))) && \
                                  ((messages)[(i)+1]->name[0] == '\\'))

#define IS_CONSTRUCTOR(m) ((m) && IS_METHOD(m) && !strcmp ((m) -> name, "new"))

#define IS_CONSTRUCTOR_LABEL(__s) (!strcmp ((__s), "new"))

#define IS_PRIMITIVE_METHOD(m) (!strcmp (m -> name, "instanceMethod") || \
                                !strcmp (m -> name, "classMethod") || \
                                !strcmp (m -> name, "instanceVariable") || \
                                !strcmp (m -> name, "classVariable") || \
                                !strcmp (m -> name, "class"))

#define MAIN_ARGS "int argc, char **argv, char **envp"

#define VAR_IS_STRUCT(v) (!strcmp (v -> type, "struct") || \
                          !strcmp (v -> qualifier, "struct") || \
                          !strcmp (v -> type, "union") || \
                          !strcmp (v -> qualifier, "union"))

#define VAR_IS_FN(v) ((v -> attrs & CVAR_ATTR_FN_DECL) || \
                      (v -> attrs & CVAR_ATTR_FN_PTR_DECL) || \
                      (v -> attrs & CVAR_ATTR_FN_PROTOTYPE))

#define EXPR_CHECK (interpreter_pass == expr_check)

/*
 *  Value to return if a function is the argument of another function
 *  and doesn't need a ctoobj translation.
 */
#define FN_IS_ARG_RETURN_VAL 1
/* 
 *  Value to return if the function is a method argument.
 */
#define FN_IS_METHOD_ARG 2

#ifdef __GNUC__
#define IS_DEFINED_LABEL(s) (is_c_keyword(s) || \
                       is_ctalk_keyword(s) || \
                       is_gnu_extension_keyword(s) || \
                       global_var_is_declared(s) || \
                       get_local_var(s) || \
                       get_class_variable(s, NULL, FALSE) || \
                       get_function(s) || \
                       typedef_is_declared(s) || \
                       is_enum_member(s) || \
                       is_struct_member(s) || \
                       is_gnuc_builtin_type (s) || \
                       is_fn_param(s))
#else
#define IS_DEFINED_LABEL(s) (is_c_keyword(s) || \
                       is_ctalk_keyword(s) || \
                       is_gnu_extension_keyword(s) || \
                       get_global_var(s) || \
                       get_local_var(s) || \
                       get_class_variable(s, NULL, FALSE) || \
                       get_function(s) || \
                       get_typedef(s) || \
                       is_enum_member(s) || \
                       is_struct_member(s) || \
                       is_fn_param(s))
#endif /* __GNUC__ */

#define IS_DEFINED_FN(s) (get_function(s) || \
                          c99_name(s,0) || \
                          ctalk_lib_fn_name(s,0))

#define IS_MATH_TYPE(o) (!strcmp (o -> __o_classname, "Integer") || \
			 !strcmp (o -> __o_classname, "LongInteger") || \
			 !strcmp (o -> __o_classname, "Float") || \
			 !strcmp (o -> __o_classname, "Character"))

/*
 *  Every char in escape sequences defined by C99 that 
 *  we don't want to escape the backslash in front of.
 */
#define ESC_SEQUENCE_CHAR(c) ((c == '?') || \
			      (c == 'a') || \
			      (c == 'b') || \
			      (c == 'f') || \
			      (c == 'n') || \
			      (c == 'r') || \
			      (c == 't') || \
			      (c == 'u') || \
			      (c == 'U') || \
			      (c == 'v') || \
			      (c == 'x') || \
			      (c == '0') || \
			      (c == '1') || \
			      (c == '2') || \
			      (c == '3') || \
			      (c == '4') || \
			      (c == '5') || \
			      (c == '6') || \
			      (c == '7'))

#define REGISTER_C_METHOD_ARG "__ctalk_register_c_method_arg"
#define METHOD_ARG_ACCESSOR_FN "__ctalk_arg_internal"
#define EVAL_EXPR_FN           "__ctalkEvalExpr"
#define SELF_ACCESSOR_FN       "__ctalk_self_internal"
#define SRC_FILE_SAVE_FN       "__ctalkRtSaveSourceFileName"

#define SUBSCRIPT_VAR_FMT  "__ctsubscript_%d"
#define TMP_SUBSCRIPT_FMT  "%s = __ctalk_to_c_int (__ctalkEvalExpr (\"%s\"));"
#define TMPL_CVAR_ACCESSOR_FN "__ctalkGetTemplateCallerCVAR"
#define TMPL_CVAR_CLEANUP_FN  "__ctalkTemplateCallerCVARCleanup"

#define DELETE_MESSAGES(__s,__i,__l) \
   while (++__i <= __l) {\
     delete_message (__s[__i]);\
     __s[__i] = NULL;\
   }\
   __i = __l;\

#define TEMPLATE_CACHE_FMT "%s %s"

#define IS_CLASS_OF(s,c) (!strcmp ((s), (c)) ||	\
                               is_subclass_of((s), (c)))

#define IS_COLLECTION_SUBCLASS_OBJ(o) \
  (!strcmp ((o)->__o_name, COLLECTION_CLASSNAME) || \
   is_subclass_of ((o)->__o_name, COLLECTION_CLASSNAME))

/*
 *  WHITESPACE tokens include the characters of isspace(3),
 *  except for newlines (\n and \r), which have their own token 
 *  type.
 */
#define M_ISSPACE(m) (((m) -> tokentype == WHITESPACE) || \
                      ((m) -> tokentype == NEWLINE))

#define DEFAULT_LIBC_RETURNCLASS INTEGER_CLASSNAME

#define PARAM_C_ARG_ATTR  "__c_arg__"

#define STRCAT2(s,s1,s2) strcat (s, (s1)); strcat (s,(s2));

/* #define __ALLOC_FREE_CHECK__ */
#if defined(__CHECK_NULL_FREES__) || defined(__ALLOC_FREE_CHECK__)
#define free(__x) __xfree(__x)
#define calloc(__x,__y) __xalloc(__x,__y)
#define strdup(__s) __xstrdup(__s)
#endif

#define IS_CLASS_OBJECT(__o) ((__o)->__o_class==(__o))
#define HAS_INSTANCEVAR_CLASS(__o) (__o && __o->__o_p_obj && \
                                    (__o->__o_class == \
                                     __o->__o_p_obj->__o_class))


/*
 *  The Solaris index and rindex are interchangeable
 *  with strchr and strrchr.
 */
#if defined (__sparc__) && defined (__GNUC__)
#define index strchr
#define rindex strrchr
#endif

#ifdef __DJGPP__
#define PATHSEPCHAR ';'
#define DIRSEPCHAR '\\'
#else 
#define PATHSEPCHAR ':'
#define DIRSEPCHAR '/'
#endif

/*
 * Internationalization
 */
#ifndef _
#define _(String) (String)
#endif

#ifndef N_
#define N_(String) (String)
#endif

#ifndef textdomain
#define textdomain(Domain)
#endif

#ifndef bindtextdomain
#define bindtextdomain(Package,Directory)
#endif

/* 
 *    Debugging 
 *    Define DEBUG_CODE and any of symbols below.
 */
#define DEBUG_CODE

/* 
 *    #define STACK_TRACE if you want the interpreter to print 
 *    huge amounts of information about the stack values during 
 *    processing.  
 */
#undef STACK_TRACE
/*
 *    ARG_TRACE prints the method argument stack.
 */
#undef ARG_TRACE
/*
 *    #define CLASSLIB_TRACE if you want to watch 
 *    class library searches.
 */
#undef CLASSLIB_TRACE
/*
 *    TRACE_PREPROCESS_INCLUDES prints the include level
 *    of each #included file.
 */
#undef TRACE_PREPROCESS_INCLUDES
/*
 *    CHECK_PREPROCESS_CONDITIONALS prints the level of
 *    nested conditionals before and after every #include
 */
#undef CHECK_PREPROCESS_IF_LEVEL
/* 
 *    DEBUG_SYMBOLS prints information about the symbols
 *    defined by the preprocessor.  If a symbol is not 
 *    defined, print a warning - GNU cpp silently returns
 *    false for undefined symbols.
 */
#undef DEBUG_SYMBOLS
/*
 *    Issue a warning for undefined preprocessor symbols.
 *    GNU cpp returns false without issuing a warning when
 *    evaluating an undefined symbol.
 */
#undef DEBUG_UNDEFINED_PREPROCESSOR_SYMBOLS
/*
 *    DEBUG_TYPEDEFS dumps a list of the typedefs.
 */
#undef DEBUG_TYPEDEFS
/*    DEBUG_C_VARIABLES causes the interpreter to perform more
 *    type checking.
 */
#undef DEBUG_C_VARIABLES
/*
 *    FN_STACK_TRACE prints a stack trace of the function output
 *    buffer.
 */
#undef FN_STACK_TRACE
/*
 *    MALLOC_TRACE enables the glibc mtrace () function.  You
 *    must also set the environment variable MALLOC_TRACE to
 *    the name of the file that will contain the trace data.
 */
#undef MALLOC_TRACE
/*
 *    DEBUG_OBJECT_DESTRUCTION adds extra run-time warnings 
 *    in lib/rtnewobj.c.
 */
#undef DEBUG_OBJECT_DESTRUCTION
/*
 *    DEBUG_DYNAMIC_C_ARGS issues warnings if the run-time 
 *    library encounters a C variable for which a class 
 *    has not yet been loaded.  Basic C types should not
 *    need this warning.
 */
#undef DEBUG_DYNAMIC_C_ARGS
/*
 *    DEBUG_INVALID_OBJ_REFS prints warnings if __objRefCntInc and
 *    __objRefCntDec receive invalid objects.
 */
#undef DEBUG_INVALID_OBJ_REFS
/*
 *    DEBUG_UNDEFINED_PARAMETER_CLASSES prints warnings if a method
 *    tries to use a parameter for which a class has not yet been
 *    defined.
 */
#undef DEBUG_UNDEFINED_PARAMETER_CLASSES
/*
 *    MEM_WARNINGS can print all sort of information about memory
 *    issues.
 */
#define MEM_WARNINGS


/* Prototypes */

/* arg.c */
int arg_is_constant (MESSAGE_STACK, int, int);
int c_param_expr_arg (MESSAGE_STACK, int);
char *fmt_c_fn_obj_args_expr (MESSAGE_STACK, int);
int global_constructor_arg (METHOD *, int);
int method_arglist_limit (MESSAGE_STACK, int, int, int);
int fn_is_arg (OBJECT *, MESSAGE_STACK, int);
OBJECT *fn_arg_expression (OBJECT *, METHOD *, MESSAGE_STACK, int);
char *obj_arg_to_c_expr (MESSAGE_STACK, int, OBJECT *, int);
int obj_expr_is_fn_arg (MESSAGE_STACK, int, int, int, int *);
int resolve_arg2 (MESSAGE_STACK, int);
int split_args (MESSAGE_STACK, int, int, char **, int *);

/* ccompat.c */
void ccompat_init (void);
char *find_gcc_target_dir (void);
void gnu_attributes (MESSAGE_STACK, int);
int gnu_cpp_symbols (void);
int init_gcc_paths (void);
char *verify_gnu_version (void);
void gnuc_type_extensions (CVAR *);
void print_libdirs (void);
#ifdef __GNUC__
void gnuc_fix_empty_extern (MESSAGE_STACK, int);
#endif

/* check.c */
void classlib_check (MESSAGE_STACK, int);

/* class.c */
int add_class_object (OBJECT *);
OBJECT *class_object_search (char *);
void delete_class_library (void);
OBJECT *get_class_object (char *);
int get_lib_includes_ptr (void);
int init_default_classes (void);
void init_library_include_stack (void);
int is_pending_class (char *);
CLASSLIB *lib_include_at (int ptr);
char *library_pathname (void);
int library_search (char *);
CLASSLIB *pop_input_declaration (void);
CLASSLIB *pop_library_include (void);
int prev_include (char *);
void push_input_declaration (char *, char *, int);
void push_library_include (char *, char *, int);
OBJECT *resolve (int);
int add_instance_variables (OBJECT *, OBJECT *);
int instance_variables_from_class_definition (OBJECT *);
int is_subclass_of (char *, char *);

/* collection.c */
int collection_needs_rt_eval (OBJECT *, METHOD *);
int collection_rt_expr (METHOD *, MESSAGE_STACK, int, OBJECT_CONTEXT);
COLLECTION_CONTEXT collection_context (MESSAGE_STACK, int);

/* complexmethd.c */
char *complex_expr_class (MESSAGE_STACK, int);
int complex_method_statement (OBJECT *, MESSAGE_STACK, int);
int complex_self_method_statement (OBJECT *, MESSAGE_STACK, int);
int complex_var_or_method_message (OBJECT *, MESSAGE_STACK, int);
MESSAGE_CLASS message_class (MESSAGE_STACK, int);

/* control.c */
int case_stmt (MESSAGE_STACK, int);
int ctrl_block_state (int);
int control_structure (MESSAGE_STACK, int);
int ctrlblk_cleanup_args (METHOD *,int);
int ctrlblk_method_call (OBJECT *, METHOD *, int);
int ctrlblk_push_args (OBJECT *, METHOD *, OBJECT *);
int ctrlblk_register_c_var (char *, int);
CTRLBLK *ctrlblk_pop (void);
void ctrlblk_push (CTRLBLK *);
int ctrl_blk_state (int);
int ctrlblk_pred_rt_expr (MESSAGE_STACK, int);
void delete_control_block (CTRLBLK *);
int do_stmt (MESSAGE_STACK, int);
int if_else_end (MESSAGE_STACK, int);
int for_stmt (MESSAGE_STACK, int);
int get_ctrlblk_ptr (void);
STMT_CLASS get_ctrl_class (char *);
int if_stmt (MESSAGE_STACK, int);
void init_control_blocks (void);
int leading_unary_op (MESSAGE_STACK, int);
void loop_linemarker (MESSAGE_STACK, int);
CTRLBLK *new_ctrl_blk (void);
int require_class (MESSAGE_STACK, int);
int switch_stmt (MESSAGE_STACK, int);
int while_stmt (MESSAGE_STACK, int);
int expr_paren_check (MESSAGE_STACK, int);

/* cparse.c */
MESSAGE *c_message_at (int);
int c_message_push (MESSAGE *);
MESSAGE_STACK c_message_stack (void);
char *deref_var_basename (char *);
int escaped_line_end (MESSAGE **, int, int);
int eval_constant_expr (MESSAGE_STACK, int, int *, VAL *);
int find_arg_end (MESSAGE_STACK, int);
int find_declaration_end (MESSAGE_STACK, int);
int find_function_close (MESSAGE_STACK, int);
int find_n_subscripts (MESSAGE_STACK, int, int *);
int find_struct_members (MESSAGE_STACK, int);
int find_subscript_declaration_end (MESSAGE_STACK, int);
int fn_closure (MESSAGE_STACK, int, int);
int fn_has_gnu_attribute (MESSAGE_STACK, int);
int fn_is_declaration (MESSAGE_STACK, int);
int fn_param_cvars (MESSAGE_STACK, int);
int fn_params (MESSAGE_STACK, int, int);
int get_c_message_ptr (void);
int get_cvar_attrs (void);
int get_cvar_type_attrs (void);
int get_n_vars (void);
CVAR get_param_n (int );
int get_param_ptr (void);
char *get_qualifier_val (void);
char *get_qualifier_val2 (void);
Boolean get_struct_decl (void);
char *get_type_decl (int);
int get_type_decls_ptr (void);
char *get_type_val (void);
Boolean get_unsigned_declaration_val (void);
VARNAME *get_var (int);
char *get_var_storage_class (void);
int have_declaration (char *);
int have_ref_prefix (MESSAGE_STACK, int);
int have_type_prefix (MESSAGE_STACK, int);
int initializer_end (MESSAGE_STACK, int);
int is_c_fn_declaration_msg (MESSAGE_STACK, int);
int is_c_function_declaration (char *);
int is_c_function_prototype_declaration (MESSAGE_STACK, int);
int is_c_identifier (char *);
int is_c_prefix_op (MESSAGE_STACK, int);
Boolean is_c_var_declaration_msg (MESSAGE_STACK, int, int);
int is_typecast (MESSAGE_STACK, int);
int math (MESSAGE *, MATH_OP, VAL *, VAL *, VAL *);
int param_is_fnptr (MESSAGE_STACK, int, int);
int parse_include_directive (MESSAGE_STACK, int, int, INCLUDE *);
void reset_struct_decl (void);
void restore_fn_declaration (void);
void restore_struct_declaration (void);
void save_fn_declaration (MESSAGE_STACK, int);
void save_struct_declaration (MESSAGE_STACK, int);
void set_n_vars (int);
char *subscript_var_basename (char *);
char *trim_whitespace (char *, char *);
int typedef_var (MESSAGE_STACK, int);

/* ctoobj.c */
char *fmt_c_to_obj_call (OBJECT *, METHOD *, OBJECT *);
int generate_c_to_obj_call (OBJECT *, METHOD *, OBJECT *);
char *cfunc_return_class (CFUNC *);
int c_char_ptr_to_obj_call (OBJECT *, METHOD *, OBJECT *);
int c_double_to_obj_call (OBJECT *, METHOD *, OBJECT *);
int c_int_to_obj_call (OBJECT *, METHOD *, OBJECT *);
int c_longlong_to_obj_call (OBJECT *, METHOD *, OBJECT *);
char *fn_return_class (char *);

/* cvars.c */
int add_incomplete_type (MESSAGE_STACK, int, int);
int add_typedef_from_cvar (CVAR *);
int add_typedef_from_parser (void);
int add_variable_from_cvar (CVAR *);
void buffer_fn_args (PENDING *, char *);
OBJECT *c_constant_object (MESSAGE_STACK, int);
int is_global_constructor (MESSAGE_STACK, int);
int is_incomplete_type (char *);
int c_fn_args (MESSAGE_STACK, OBJECT *, int);
CFUNC *cvar_to_cfunc (CVAR *);
char *declaration_expr_from_cvar (CVAR *, char *);
void delete_local_c_vars (void);
void dump_typedefs (MESSAGE *);
CVAR *get_fn_declaration (char *);
CFUNC *get_function (char *);
CVAR *get_global_struct_defn (char *);
CVAR *get_global_var (char *);
CVAR *get_local_struct_defn (char *);
CVAR *get_local_var (char *);
char *get_type_val2 (void);
int get_params (void);
CVAR *get_struct_from_member (void);
CVAR *get_typedef (char *);
int global_var_is_declared (char *);
CVAR *have_struct (char *);
int typedef_is_declared (char *);
int is_c_derived_type (char *);
int is_enum_member (char *);
int is_fn_param (char *);
int is_param_of (CFUNC *, char *);
int is_struct_element (MESSAGE_STACK, int);
int is_struct_member (char *s);
int match_type (VAL *, VAL *);
CVAR *parser_to_cvars (void);
int parse_vars (char *);
int parse_vars_and_save (char *, char *);
int resolve_incomplete_types (void);
int struct_def_from_typedef (CVAR *);
CVAR *struct_member_from_expr (char *, CVAR *);
int var_cmp (MESSAGE *, CVAR *, CVAR *);
int var_cmp2 (CVAR *, CVAR *);
int var_message_push (MESSAGE *);
int get_var_messageptr (void);
void unlink_global_cvar (CVAR *);
MESSAGE_STACK var_message_stack (void);
MESSAGE *var_message_stack_at (int);
char *var_tmp_ofn (char *);
void init_cvars (void);

/* enum.c */
CVAR *enum_decl (MESSAGE_STACK, int);
char *enum_initializer (MESSAGE_STACK, int, int *);

/* expr.c */
int is_constant_expr (MESSAGE_STACK, int);

/* error.c */
#ifdef DEBUG_CODE
void debug (char *, ...);
#endif
void error (MESSAGE *, char *, ...);
void fn_check_expr (MESSAGE_STACK, int, int, int);
char *source_filename (void);
void warning (MESSAGE *, char *, ...);

/* extern.c */
int extern_declaration (MESSAGE_STACK, int);

/* fn_param.c */
int fn_param_declarations (MESSAGE_STACK, int, int, char **, int *);

/* fn_tmpl.c */
int add_method_return (char *, char *);
int buffer_fn_template (char *);
int c_tmpl_fn_args (MESSAGE_STACK, OBJECT *, int);
void cache_fn_tmpl_name (char *, char *);
void cleanup_template_cache (void);
char *clib_fn_expr (MESSAGE_STACK, int, int, OBJECT *);
char *clib_fn_rt_expr (MESSAGE_STACK, int);
int find_fn_arg_parens (MESSAGE_STACK, int, int *, int *);
char *find_tmpmethodname (char *);
char *fn_tmpl_is_cached (char *);
char *fn_param_prototypes_from_cfunc (CFUNC *, char *);
void generate_fn_template_init (char *, char *);
int get_tmpl_messageptr (void);
void init_c_fn_class (void);
void init_fn_templates (void);
char *preprocess_template (FN_TMPL *);
MESSAGE_STACK tmpl_message_stack (void);
char *template_params (char *, char *);
char *template_return_class (char *);
MESSAGE *tmpl_message_pop (void);
int tmpl_message_push (MESSAGE *);
MESSAGE *tmpl_message_stack_at (int);
int unbuffer_fn_templates (void);
FN_TMPL *cache_template (char *);
void init_fn_template_cache (void);
FN_TMPL *new_fn_template (void);
int preprocess_template_file (char *);
FN_TMPL *get_template (char *);
char *insert_c_methd_return_type (char *, char *);
char *fmt_template_rt_expr (FN_TMPL *);
char *user_fn_expr_args_from_params (MESSAGE_STACK, int, char *);

/* fnbuf.c */
void buffer_function_statement (char *);
void begin_function_buffer (void);
void end_function_buffer (void);
int fn_message_push (MESSAGE *);
int fn_return_at_close (MESSAGE_STACK, int, int);
MESSAGE **fn_message_stack (void);
MESSAGE *fn_message_pop (void);
int get_fn_messageptr (void);
int input_is_c_header (void);
int buffer_output (char *);
int main_args (char *, int);

/* fninit.c */
void generate_fn_return (MESSAGE_STACK, int, int);
void generate_init (int);
void fn_init (char *, int);
void global_init_statement (char *, int);
void output_global_init (void);

/* frame.c */
int delete_frame (void);
FRAME *frame_at (int);
int get_frame_pointer (void);
int init_frames (void);
int is_global_frame ();
int message_frame_top (void);
int message_frame_top_n (int);
int new_frame (int, int);
int ret_frame_top (void);
FRAME *this_frame (void);
int var_frame_top (void);

/* include.c */
char *find_library_include (char *, int);
void init_library_paths (void);
void init_lib_cache_path (void);
void init_user_home_path (void);

/* lib/ansitime.c */
char *mon (int);

/* lib/become.c */
int __ctalkIsCallersReceiver (void);
OBJECT *__ctalkGetCallingFnObject (char *, char *);
OBJECT *__ctalkGetCallingMethodObject (char *, char *);
OBJECT *__ctalkCallingFnObjectBecome (OBJECT *, OBJECT *);
OBJECT *__ctalkCallingInstanceVarBecome (OBJECT *, OBJECT *);
OBJECT *__ctalkCallingMethodObjectBecome (OBJECT *, OBJECT *);
OBJECT *__ctalkCallingReceiverBecome (OBJECT *, OBJECT *);
int __ctalkInstanceVarIsCallersReceiver (void);
OBJECT *__ctalkReceiverReceiverBecome (OBJECT *);
OBJECT *__ctalkGlobalObjectBecome (OBJECT *, OBJECT *);

/* lib/bnamecmp.c */
int basename_cmp (const char *, const char *);

/* lib/chash.c */
void _hash_symbol_line (int);
void _hash_symbol_column (int);
void _hash_symbol_source_file (char *);
void _new_hash (HASHTAB *);
HLIST *_new_hlist (void);
void *_hash_first (HASHTAB);
void *_hash_first_obj (HASHTAB);
void *_hash_get (HASHTAB, const char *);
void *_hash_get_obj (HASHTAB h, char *s_key);
void *_hash_next (HASHTAB);
void *_hash_next_obj (HASHTAB);
int _hash_put (HASHTAB, void *, char *);
int _hash_put_obj (HASHTAB h, void *e, char *s_key, void *);
void *_hash_remove (HASHTAB, const char *);
void _hash_all_initialize (void);
void *_hash_all (HASHTAB);


/* lib/clibtmpl.c */
char *c99_name (char *, int);
char *get_clib_template_file (char *);
char *get_clib_template_fn (char *);

/* lib/ctdtoa.c */
void __ctalkDoubleToASCII (double, char *);

/* lib/ctitoa.c */
void __reverse(char *);
void __ctalkDecimalIntegerToASCII (int, char *);

/* lib/ctlltoa.c */
void __ctalkDecimalLongLongToASCII (long long int, char *);

/* lib/ctoobj.c */
OBJECT *__ctalkCCharPtrToObj (char *);
OBJECT *__ctalkCIntToObj (int);
OBJECT *__ctalkCDoubleToObj (double);
OBJECT *__ctalkCLongLongToObj (long long int);
char *__ctalkCFUNCReturnClass (CFUNC *, char *);
char *__ctalkCVARReturnClass (CVAR *, char *);
int __ctalkIsObject (void *);

/* lib/ctsleep.c */
void __ctalkSleep (int);

/* lib/cttmpl.c */
char *ctalk_lib_fn_name (char *, int);

/* lib/err_out.c */
void _error_out (char *);

/* lib/errorloc.c */
int error_column_at (int);
char *error_file_at (int);
int error_line_at (int);
void error_reset (void);
int get_error_location_ptr (void);
void init_error_location (void);
void restore_error_location (void);
void save_error_location (int, int, char *);
int set_error_location (MESSAGE *, int *, int *);

/* lib/escstr.c */
char *escape_str (char *);
char *escape_str_quotes (char *);
char *unescape_str_quotes (char *);
char *esc_expr_quotes (char *);
void de_newline_buf (char *s);

/* lib/event.c */
int __ctalkNewSignalEventInternal (int, int, char *);
int __ctalkNewApplicationEventInternal (int, char *);

/* lib/except.c */
int __ctalkCriticalExceptionInternal (MESSAGE *, EXCEPTION, char *);
int __ctalkCriticalSysErrExceptionInternal (MESSAGE *, int, char *);
int __ctalkDeleteExceptionInternal (I_EXCEPTION *);
OBJECT *__ctalkExceptionNotifyInternal (I_EXCEPTION *);
char *__ctalkGetRunTimeException (void);
int __ctalkHandleInterpreterExceptionInternal (MESSAGE *);
int __ctalkHandleRunTimeException (void);
int __ctalkHandleRunTimeExceptionInternal (void);
int __ctalkExceptionInternal (MESSAGE *, EXCEPTION, char *);
void __ctalkPrintExceptionTrace (void);
int __ctalkPrintObject (OBJECT *);
int __ctalkPrintObjectByName (char *);
int __ctalkSysErrExceptionInternal (MESSAGE *, int, char *);
I_EXCEPTION *__ctalkTrapException (void);
I_EXCEPTION *__ctalkTrapExceptionInternal (MESSAGE *);
int __ctalkPendingException (void);
OBJECT *__ctalkUndefinedMethodReferenceException (I_EXCEPTION *);
int _delete_exception (I_EXCEPTION *);
I_EXCEPTION *__get_x_list (void);
I_EXCEPTION *__new_exception (void);

/* lib/infiles.c */
int is_input_file (char *);
void save_infile_declarations (CLASSLIB *);

/* lib/lex.c */
char *collect_expression (MESSAGE_STACK, int, int *, int, int);
char *collect_tokens (MESSAGE_STACK, int, int);
int expr_outer_parens (MESSAGE_STACK, int, int, int, int, int *, int *);
int find_expression_limit (MESSAGE_STACK, int, int, int);
int lexical (const char *, long long *, MESSAGE *);
int prefix (MESSAGE_STACK, int, int);
int tokenize (int (*)(MESSAGE *), char *);

/* lib/lextype.c */
int _lextype (char *);

/* lib/lineinfo.c */
int end_of_p_stmt (MESSAGE_STACK, int);
MESSAGE *l_message_pop (void);
int l_message_push (MESSAGE *);
int line_info_tok (char *);
int set_line_info (MESSAGE_STACK, int, int);

/* lib/keyword.c */
int is_c_data_type (const char *);
int is_c_data_type_attr (const char *);
int is_c_keyword (const char *);
int is_ctrl_keyword (const char *);
int is_ctalk_keyword (const char *);
int is_c_storage_class (const char *);
int is_gnu_extension_keyword (const char *);
int is_gnuc_builtin_type (const char *);
int is_macro_keyword (const char *);

/* lib/message.c */
MESSAGE *dup_message (MESSAGE *);
MESSAGE *new_message (void);
void delete_message (MESSAGE *);
void copy_message (MESSAGE *, MESSAGE *);
MESSAGE *resize_message (MESSAGE *, int);
int __rt_get_stack_end (MESSAGE_STACK );
int __rt_get_stack_top (MESSAGE_STACK);

/* lib/getopts.c */
int getopts (char **, int);

/* lib/list.c */
void list_add (LIST *, LIST *);
void delete_list (LIST **);
void delete_list_element (LIST *);
LIST *new_list (void);
LIST *list_remove (LIST **, LIST **);
void list_push (LIST **, LIST **);
LIST *list_unshift (LIST **);

/* lib/objtoc.c */
char __ctalk_to_c_char (OBJECT *);
double __ctalk_to_c_double (OBJECT *);
int __ctalk_to_c_int (OBJECT *);
long long int __ctalk_to_c_longlong (OBJECT *);
char *__ctalk_to_c_char_ptr (OBJECT *);
void *__ctalk_to_c_ptr (OBJECT *);
void *__ctalkToCArrayElement (OBJECT *);
int __ctalkToCIntArrayElement (OBJECT *);
char __ctalkToCCharacter (OBJECT *, int);
char *__ctalkToCCharPtr (OBJECT *, int);
int __ctalkToCInteger (OBJECT *o, int);

/* lib/panelib.c */
int **__ctalkCreateWinBuffer (int, int, int);
int __ctalkANSITerminalPaneMapWindow (OBJECT *);
int __ctalkANSITerminalPaneUnMapWindow (OBJECT *);
int __ctalkANSITerminalPanePutChar (int, int, char);
int __ctalkANSITerminalPaneRefresh (void);

/* lib/rt_call.c */
OBJECT *__ctalkCallMethodFn (METHOD *);

/* lib/rt_op.c */
OP_CONTEXT _rt_op_context (MESSAGE_STACK, int, int, int, int);
int _rt_operands (MESSAGE_STACK, int, int *, int *, int, int);
int _rt_unary_operand (MESSAGE_STACK, int, int *, int, int);
int _rt_op_precedence (int, MESSAGE_STACK, int, int, int, int);
OBJECT *_rt_unary_math (MESSAGE_STACK, int, OBJECT *);

/* lib/param.c */
PARAM *new_param (void);

/* lib/pattern.c */
int is_printf_fmt (char *);

/* lib/pattypes.c */
int is_char_fmt (char *);
int is_char_ptr_fmt (char *);
int is_char_fmt_arg (MESSAGE_STACK, int, int, int);
int is_char_ptr_fmt_arg (MESSAGE_STACK, int, int, int);
int is_double_fmt (char *);
int is_double_fmt_arg (MESSAGE_STACK, int, int, int);
int is_fmt_arg (MESSAGE_STACK, int, int, int);
int is_function_call (MESSAGE_STACK, int, int, int);
int is_int_fmt (char *);
int is_int_fmt_arg (MESSAGE_STACK, int, int, int);
int is_printf_fmt_msg (MESSAGE_STACK, int, int, int);
int is_simple_subscript (MESSAGE_STACK, int, int, int);
int is_struct_or_union_expr (MESSAGE_STACK, int, int, int);
int obj_expr_is_arg (MESSAGE_STACK, int, int, int, int *);

/* lib/radixof.c */
RADIX radix_of (char *);
char *__ctalkCharRadixToDecimal (char *);
char *__ctalkIntRadixToDecimal (char *);
char *__ctalkLongLongRadixToDecimal (char *);

/* lib/read.c */
int is_binary_file (char *);
#ifdef __DJGPP__
unsigned long int read_file (char *, char *);
unsigned long int p_read_file (char **, char *);
#else
size_t read_file (char *, char *);
size_t p_read_file (char **, char *);
#endif

/* lib/rtobjvar.c */
OBJECT *__ctalkAddClassVariable (OBJECT *, char *, OBJECT *);
OBJECT *__ctalkAddInstanceVariable (OBJECT *, char *, OBJECT *);
OBJECT *__ctalkDefineClassVariable (char *, char *, char *, char *);
OBJECT *__ctalkDefineInstanceVariable (char *, char *, char *, char *);
int __ctalkDeleteObjectList (OBJECT *);
OBJECT *__ctalkFindMemberClass (OBJECT *);
int __ctalkAddInstanceVariables (OBJECT *, OBJECT *);
OBJECT *__ctalkGetInstanceVariableByName (char *, char *, int);
OBJECT *__ctalkFindClassVariable (char *, int);
OBJECT *__ctalkGetClassVariable (OBJECT *, char *, int);
OBJECT *__ctalkGetInstanceVariable (OBJECT *, char *, int);
int __ctalkInstanceVarsFromClassObject (OBJECT *);
int __ctalkIsClassVariableOf (OBJECT *, const char *);
int __ctalkIsInstanceVariableOf (OBJECT *, const char *);

/* lib/rttrace.c */
void __ctalkSetExceptionTrace (int);
int __ctalkGetExceptionTrace (void);
int __save_call_stack_to_exception (I_EXCEPTION *);

/* lib/rt_args.c */
int is_arg (OBJECT *);
int __ctalkCreateArg (char *, char *, void *);
int __ctalkGetArgPtr (void);
int __ctalk_arg (char *, char *, void *);
int __ctalk_arg_cleanup (void);
int __ctalk_arg_push (OBJECT *);
int __ctalk_arg_push_ref (OBJECT *);
OBJECT *__ctalk_arg_pop (void);
OBJECT *__ctalk_arg_pop_deref (void);
OBJECT *__ctalk_arg_internal (int);
OBJECT *__ctalk_getstack (void *);
MESSAGE *__rt_arg_message_pop (void);
int __rt_arg_message_push (MESSAGE *);
OBJECT *__rt_eval_arg (METHOD *, OBJECT *, char *);
OBJECT *__ctalk_arg_expr (MESSAGE_STACK, int, char *);
int __rt_method_args(METHOD *, MESSAGE_STACK, int, int, int);
int __rt_arglist_limit (MESSAGE_STACK, int, int, int, int, int);

/* lib/rt_cvar.c */
OBJECT *__obj_from_cvar (MESSAGE *, CVAR *, char *, int);
int add_method_arg_cvar (CVAR *);
CVAR *__ctalkGetCArg (OBJECT *);
OBJECT *char_to_int (OBJECT *);
OBJECT *cvar_object (CVAR *);
int cvar_object_ref_cleanup (MESSAGE_STACK, int, int, int);
void _delete_cvar (CVAR *);
CVAR *__get_rt_typedef (char *);
void init_cvars (void);
OBJECT *int_to_longint (OBJECT *);
int delete_method_arg_cvars (void);
CVAR *get_method_arg_cvars (const char *);
int m_print_var (MESSAGE *, CVAR *);
CVAR *remove_method_arg_cvar ( char *name);
void _new_cvar (CVARREF_T);
int is_c_type (char *s);
int validate_type_declarations (CVAR *);

/* lib/rt_expr.c */
int _cleanup_temporary_objects (OBJECT *, OBJECT *, OBJECT *);
int __check_state (int, MESSAGE **, int *, int);
int __ctalkMatchParen (MESSAGE_STACK, int, int);
int __ctalkNextLangMsg (MESSAGE_STACK, int, int);
int __ctalkPrevLangMsg (MESSAGE_STACK, int, int);
EXPR_PARSER *__current_expr_parser (void);
void __delete_expr_parser (EXPR_PARSER *);
OBJECT *exception_null_obj (MESSAGE_STACK, int);
EXPR_PARSER *__expr_parser_at (int);
OBJECT *expr_result_object (MESSAGE_STACK, int, int);
char *expr_text (char *);
int __get_expr_parser_level (void);
int __get_expr_parser_ptr (void);
EXPR_PARSER *__new_expr_parser (void);
EXPR_PARSER *__pop_expr_parser (void);
void __push_expr_parser (EXPR_PARSER *);
OBJECT *__obj_from_msg_val (MESSAGE *m, char *, char *, int);
int __set_aggregate_obj (MESSAGE_STACK, int, int, OBJECT *);
int __set_left_operand_value (MESSAGE_STACK, int, OBJECT *);
int __set_right_operand_value (MESSAGE_STACK, int, OBJECT *);
int _get_e_message_ptr (void);
OBJECT *create_param (char *, METHOD *, OBJECT *);
int e_message_push (MESSAGE *);
MESSAGE *e_message_pop (void);
OBJECT *eval_expr (char *, OBJECT *, METHOD *, OBJECT *, int, int);
OBJECT *eval_subexpr (MESSAGE_STACK, int);
PARAM *has_param_def (METHOD *);
int is_aggregate_type (MESSAGE_STACK, int, int, char *);
int is_c_fn_syntax (MESSAGE_STACK, int);
OBJECT *null_result_obj (METHOD *, int);
int __ctalk_isMethod (char *, MESSAGE_STACK, int, int, int);
OBJECT *__ctalkEvalExpr (char *);
EXPR_PARSER *__ctalkGetExprParserAt (int);
int __ctalkGetExprParserPtr (void);
OBJECT *_rt_math_op (MESSAGE_STACK, int, int, int);
OBJECT *_rt_unary_math_op (MESSAGE_STACK, int, int, int);
METHOD *get_op_method (void);
int _set_expr_value (MESSAGE_STACK, int, int, int, OBJECT *);
int _set_rt_math_op_expr_value (MESSAGE_STACK, int, int, int, OBJECT *);
int _set_unary_expr_value (MESSAGE_STACK, int, int, int, OBJECT *);
OBJECT *__set_obj_from_msg_val (MESSAGE *, char *, char *, int);
MESSAGE_STACK _get_e_messages (void);
OBJECT *self_expr (METHOD *, int);

/* lib/rt_error.c */
#ifdef __GNUC__
void _error (char *, ...) __attribute__ ((noreturn));
#else
void _error (char *, ...);
#endif
void _warning (char *, ...);
void __ctalkWarning (char *, ...);
#ifdef __GNUC__
void system_dir_error (char *) __attribute__ ((noreturn));
#else
void system_dir_error (char *);
#endif

/* lib/rt_stdarg.c */
OBJECT *__ctalkLibcFnWithMethodVarArgs (int (*)(), METHOD *, char *);
int __call_fn_w_args_fmtarg0 (char *, METHOD *, STDARG_CALL_INFO *);
int __call_fn_w_args_fmtarg1 (char *, METHOD *, STDARG_CALL_INFO *);
void args_to_method_args (METHOD *, STDARG_CALL_INFO *);
int __rt_check_stdargs (void);
int tokenize_fmt (char *);

/* lib/rtinfo.c */
char *__argvFileName (void);
void __argvName (char *);
int __ctalkRtSaveSourceFileName (char *);
int __get_call_stack_ptr (void);
char *__source_filename (void);
void __classLibName (char *);
char *__classLibFileName (void);
int __ctalk_exitFn (int);
void __ctalk_initRtFns (void);
int __ctalk_initFn (char *);
Boolean __ctalkIsInlineCall (void);
Boolean __ctalkCallerIsInlineCall (void);
void __ctalkRtReceiver (OBJECT *);
METHOD *__ctalkRtGetMethod (void);
OBJECT *__ctalkRtReceiverObject (void);
void __ctalk_rtReceiverClass (OBJECT *);
void __ctalkRtMethodClass (OBJECT *);
OBJECT *__ctalkRtMethodClassObject (void);
OBJECT *__ctalk_rtReceiverClassObject (void);
void __ctalk_rtMethodFn (OBJECT *(*fn)());
void *__ctalkRtGetMethodFn (void);
void __init_time (void);
RT_FN *get_calling_fn (void);
METHOD *get_calling_method (void);
RT_FN *get_fn (void);
RT_FN *new_rt_fn (void);
void _delete_rtinfo (RT_INFO *);
RT_INFO *_new_rtinfo (void);
int __save_rt_info (OBJECT *, OBJECT *, OBJECT *, METHOD *,
		    OBJECT *(*) (), Boolean);
int __restore_rt_info (void);

/* lib/rt_cvar.c */
int add_method_arg_cvar (CVAR *);
OBJECT *cvar_object (CVAR *);
int cvar_ref_delete (char *);
CVAR *__ctalkCopyCVariable (CVAR *);
OBJECT *__ctalkGetTemplateCallerCVAR (char *);
void __ctalkTemplateCallerCVARCleanup (void);
int __ctalk_register_c_method_arg (char *, char *, char *, char *,
				   char *, char *, int, int, int, void *);
int __resolve_aggregate_method (MESSAGE_STACK, int);

/* lib/rt_methd.c */
int _external_parens (MESSAGE_STACK, int, int);
int _is_empty_arglist (MESSAGE_STACK, int, int);
int __ctalkArglistLimit (MESSAGE_STACK, int, int, int, int);
int __ctalkDefineClassMethod (char *, char *, OBJECT *(*)(), int);
int __ctalkDefineInstanceMethod (char *, char *, OBJECT *(*)(), int);
int __ctalkDefineTemplateMethod (char *, char *, OBJECT *(*)(), int, int);
METHOD *__ctalkFindClassMethodByFn (OBJECT **, OBJECT *(*)(void), int);
METHOD *__ctalkFindClassMethodByName (OBJECT **, const char *, int);
METHOD *__ctalkFindInstanceMethodByFn (OBJECT **, OBJECT *(*)(void), int);
METHOD *__ctalkFindInstanceMethodByName (OBJECT **, const char *, int);
METHOD *__ctalkGetClassMethodByFn (OBJECT *o, OBJECT *(*)(void), int);
METHOD *__ctalkGetClassMethodByName (OBJECT *, const char *, int);
METHOD *__ctalkGetInstanceMethodByFn (OBJECT *o, OBJECT *(*)(void), int);
METHOD *__ctalkGetInstanceMethodByName (OBJECT *, const char *, int);
METHOD *__ctalkFindMethodByFn (OBJECT **, OBJECT *(*)(void), int);
METHOD *__ctalkFindMethodByName (OBJECT **, const char *, int);
OBJECT *__ctalkInlineMethod (OBJECT *, METHOD *);
OBJECT *__ctalk_method (char *, OBJECT *(*)());
void __ctalk_initLocalObjects (void);
OBJECT *__ctalk_methodReturn (OBJECT *, METHOD *, OBJECT *);
void __ctalk_primitive_method (char *, char *, int);
void __ctalkClassMethodInitReturnClass (char *, char *, char *);
void __ctalkInstanceMethodInitReturnClass (char *, char *, char *);
void __ctalkInstanceMethodParam (char *, char *, char *, char *, int);
void __ctalkMethodReturnClass (char *);
int __super_move_args  (char *, char *);
METHOD *__this_method (void);

/* lib/rt_obj.c */
OBJECT *__ctalkCopyObject (OBJREF_T, OBJREF_T);
char *__ctalkCopyObjectRef(char *);
OBJECT *__ctalk_get_object (const char *, const char *);
void __ctalkDeleteObject (OBJECT *);
void __ctalkDeleteObjectInternal (OBJECT *);
OBJECT *__ctalkInstanceVariableObject (OBJECT *);
OBJECT *__ctalkInstanceVariableReceiver (OBJECT *);
int __ctalkRegisterUserObject (OBJECT *);
OBJECT *__ctalkReplaceVarEntry (VARENTRY *, OBJECT *);
void __ctalkSetObjectScope (OBJECT *, int);
int __ctalk_remove_object (OBJECT *o);
OBJECT *__ctalk_self_internal (void);
void __ctalk_set_global (char *, char *);
void __ctalk_set_local (OBJECT *);
void __delete_operand_result (OBJREF_T, OBJREF_T);
void delete_varentry (VARENTRY *);
OBJECT *match_instancevar (OBJECT *, OBJECT *);
VARENTRY *new_varentry (OBJECT *);
int object_is_decrementable (OBJECT *, OBJECT *, OBJECT *);
int object_is_deletable (OBJECT *, OBJECT *, OBJECT *);

/* lib/rt_prton.c */
int __ctalkSelfPrintOn (void);
int __ctalkObjectPrintOn (OBJECT *);

/* lib/rt_rcvr.c */
OBJECT *__constant_rcvr (char *);
void __ctalk_class_initialize (void);
int __ctalk_receiver_push (OBJECT *);
int __ctalk_receiver_push_ref (OBJECT *);
int is_current_receiver (OBJECT *);
int is_receiver (OBJECT *);
OBJECT *__ctalk_receivers_at (int);
OBJECT *__ctalk_receiver_pop (void);
OBJECT *__ctalk_receiver_pop_deref (void);
int __ctalkGetReceiverPtr (void);
Boolean __getClassLibRead (void);
int need_defined_receiver (MESSAGE_STACK, int, int, int, OBJECT *);
void __setClassLibRead (Boolean);

/* lib/rtclslib.c */
void __ctalk_dictionary_add (OBJECT *);
OBJECT *__ctalk_define_class (OBJECT **);
void __ctalkClassDictionaryCleanup (void);
OBJECT *__ctalkFindFirstSubclass (OBJECT *);
OBJECT *__ctalkGetClass (const char *);
OBJECT *__ctalkClassObject (OBJECT *);
int __ctalkIsSubClassOf (char *, char *);
OBJECT *get_class_library_definition (char *);
void __ctalkRemoveClass (OBJECT *);
OBJECT *__ctalk_find_classvar (const char *, const char *);

/* lib/rtnewobj.c */
OBJECT *_dup_object (OBJECT *);
OBJECT *__ctalkCreateObject (char *, char *, char *, int);
OBJECT *__ctalkCreateObjectInit (char *, char *, char *, int, char *);
OBJECT *__ctalk_new_object (OBJECT **);
int __ctalkSetObjectValue (OBJECT *, char *);
int __ctalkSetObjectValueBuf (OBJECT *, char *);
int __ctalkSetObjectValueVar (OBJECT *, char *);
int __ctalkSetObjectValueClass (OBJECT *, OBJECT *);
int __ctalkSetObjectName (OBJECT *, char *);

/* lib/rtobjref.c */
void *generic_ptr_str (char *);
void __refObj (OBJREF_T, OBJREF_T);
void __objRefCntInc (OBJREF_T);
void __objRefCntDec (OBJREF_T);
void __objRefCntSet (OBJREF_T, int);
OBJECT *obj_from_ref_str (char *);
OBJECT *obj_ref_str (char *);

/* lib/rtsyserr.c */
int __ctalkErrnoInternal (void);

/* lib/rtxalloc.c */
void *__xalloc (int);
void __xfree(void *);
void *__xstrdup (char *);

/* lib/sformat.c */
char *_format_str (char *, char *, va_list);
char *__ctalkCFmtToCtalkFmt (char *, char *);
void *__ctalkStrToPtr (char *);
char *__scalar_fmt_conv (char *, char *, OBJECT *);

/* lib/statfile.c */
char *expand_path (char *);
char *pwd (void);
int file_exists (char *);
int file_mtime (char *);
int file_size (char *);
int is_dir (char *);
char *which (char *);
int __ctalkIsDir (char *);

/* lib/streq.c */
#ifdef __GNUC__
inline int __str_eq (register char *, register char *);
#else
int __str_eq (const char *, const char *);
#endif

/* lib/tempio.c */
void init_tmp_files (void);
int create_tmp (void);
char *macro_cache_path (void);
char *new_macro_cache_path (void);
int unlink_tmp (void);
void cleanup_preprocessor_cache (void);
int close_tmp (void);
int copy_file (char *, char *);
int write_tmp (char *);
char *get_tmpname (void);
void tmp_to_output (void);
void cleanup (int);
char *preprocess_name (char *, int);
char *ctpp_name (char *, int);
int save_previous_output (char *);
int rename_file (char *, char *);

/* lib/tempname.c */
char *__rand_ext (void);
char *__tempname (char *, char *);

/* lib/trimstr.c */
char *trim_leading_whitespace (char *);
char *trim_trailing_whitespace (char *);
char *trimstr (char *);
char *remove_whitespace (char *);

/* lib/typecast.c */
char *collect_typecast_expr (MESSAGE_STACK, int, int *);
CVAR *__ctalkGetTypedef (char *);
int __ctalkRegisterCTypedef (char *, char *, char *, char *, char *, char *,
			     char *, int, int, int, int);
int __rt_is_typecast (MESSAGE_STACK, int, int);
int typecast_is_pointer (MESSAGE_STACK, int, int);
int typecast_ptr_expr (MESSAGE_STACK, int, int);
int typecast_value_expr (MESSAGE_STACK, int, int);

/* lib/val.c */
int copy_val (VAL *, VAL *);
int d_print_val (DEFINITION *, VAL *);
char *hex_from_numeric_val (char *);
int is_val_true (VAL *);
int m_print_val (MESSAGE *, VAL *);
int numeric_value (char *, VAL *);
int val_eq (VAL *, VAL *);

/* libdeps.c */
int cache_ctpp_output_file (char *);
void check_user_args (void);
char *ctpp_cache_path (char *);
int ctpp_deps_updated (char *);
void save_opts (char **, int);
void record_opts (void);

/* loop.c */
void init_loops (void);
int loop_block_end (MESSAGE_STACK, int);
int loop_block_start (MESSAGE_STACK, int);
int loop_pred_end (MESSAGE_STACK, int);

/* main.c */
int args (char **, int);
/* char *ctalk_lib_include (char *); */
char *ctalk_lib_include (void);
void exit_help (void);
int extended_arg (char *);
char *get_class_lib_dir (void);
char *get_package_name (void);
int preprocess (char *, int);
int preprocess_to_output (char *);

/* math.c */
Boolean eval_bool (MESSAGE_STACK, int, VAL *);
int eval_math (MESSAGE_STACK, int, VAL *);
int handle_sizeof_op (MESSAGE_STACK, int, int *, VAL *);
int perform_add (MESSAGE *, VAL *, VAL *, VAL *);
int perform_divide (MESSAGE *, VAL *, VAL *, VAL *);
int perform_modulus (MESSAGE *, VAL *, VAL *, VAL *);
int perform_multiply (MESSAGE *, VAL *, VAL *, VAL *);
int perform_subtract (MESSAGE *, VAL *, VAL *, VAL *);
int perform_asl (MESSAGE *, VAL *, VAL *, VAL *);
int perform_asr (MESSAGE *, VAL *, VAL *, VAL *);
int perform_bit_and (MESSAGE *, VAL *, VAL *, VAL *);
int perform_bit_comp (MESSAGE *, VAL *, VAL *);
int perform_bit_or (MESSAGE *, VAL *, VAL *, VAL *);
int perform_bit_xor (MESSAGE *, VAL *, VAL *, VAL *);
Boolean bool_eval (MESSAGE_STACK, int, VAL *);
int math_eval (MESSAGE_STACK, int, VAL *);
Boolean question_conditional_eval (MESSAGE_STACK, int, int *, VAL *);

/* method.c */
int arg_error_loc (int, int, int, ERROR_LOCATION *);
void cleanup_args (METHOD *, OBJECT *, int);
int compound_method (MESSAGE_STACK, int, int *);
int define_method (char *, char *, int, int);
int define_primitive_method (char *, char *, OBJECT *(*)(), int, int);
OBJECT *eval_arg (METHOD *, OBJECT *, char *, int);
OBJECT *eval_receiver_token (MESSAGE_STACK, int, OBJECT *);
METHOD *get_class_method (MESSAGE *, OBJECT *, char *, int);
METHOD *get_instance_method (MESSAGE *, OBJECT *, char *, int);
CVAR *get_instance_method_local_cvar (char *);
OBJECT *get_instance_method_local_object (char *);
METHOD *get_super_instance_method (OBJECT *, char *, int);
int get_method_message_ptr (void);
void init_imported_method_queue (void);
int init_method_stack (void);
Boolean is_class_method (MESSAGE_STACK, int);
Boolean is_instance_method (MESSAGE_STACK, int);
Boolean is_instance_method_or_variable (MESSAGE_STACK, int);
Boolean is_c_constant_instance_method (MESSAGE_STACK, int);
int is_method_name (const char *);
int is_method_parameter (MESSAGE_STACK, int);
int is_method_selector (const char *);
OBJECT *method_arg_object ( MESSAGE *);
int method_args (METHOD *, int);
int method_args2 (METHOD *, int);
int method_call (int);
int method_declaration_info (char *, char *, char **, int *, int *);
int method_declaration_msg (MESSAGE_STACK, int, int, char *, int *, 
			    char *, int *);
MESSAGE *method_message_pop (void);
int method_message_push (MESSAGE *);
MESSAGE_STACK method_message_stack (void);
METHOD *method_replaces_primitive (METHOD *, OBJECT *);
void output_imported_methods (void);
void queue_method_for_output (char *, METHOD *);
int register_c_var (MESSAGE_STACK, int);
OBJECT *resolve_arg (METHOD *, MESSAGE_STACK, int);
char *rt_library_method_call (OBJECT *, METHOD *, MESSAGE_STACK, int);
void save_method_object (OBJECT *);
void save_method_local_objects (void);
void save_method_local_cvars (void);
int store_arg_object (METHOD *, OBJECT *);
int method_arg_accessor_fn (MESSAGE_STACK, int, int);
int method_arg_accessor_fn_c (MESSAGE_STACK, int, int);
int method_arg_rt_expr (MESSAGE_STACK, int);
int saved_method_object (OBJECT *);

/* methodbuf.c */
void begin_method_buffer (METHOD *);
void buffer_method_statement (char *);
void end_method_buffer (void);
int format_method (BUFFERED_METHOD);
void generate_method_init (METHOD *, LIST *);
int get_method_buf_message_ptr (void);
void init_method_buffer (void);
int method_buf_message_push (MESSAGE *);
MESSAGE **method_buf_message_stack (void);
void method_init_statement (char *);
void unbuffer_method_statements (void);

/* mthdrf.c */

int method_prototypes (char *, CLASSLIB *);
void input_prototypes (char *);
int is_method_proto (char *, char *);
int method_proto_is_output (char *, char *);
OBJECT *method_from_prototype (char *);

/* object.c */
int add_object (OBJECT *);
OBJECT *arg_expr_object (char *);
void cleanup_dictionary (void);
OBJECT *constant_token_object (MESSAGE *);
OBJECT *create_object (char *, char *);
OBJECT *create_object_init (char *, char *, char *, char *);
int delete_arg_object (OBJECT *);
void delete_local_objects (void);
void delete_objects (int);
void delete_object (OBJECT *);
OBJECT *find_class_variable (MESSAGE *, char *);
int fn_return (MESSAGE_STACK, int);
OBJECT *get_class_variable (char *, char *, int);
OBJECT *get_global_object (char *, char *);
OBJECT *get_instance_variable (char *, char *, int);
OBJECT *get_local_object (char *, char *);
OBJECT *get_object (char *, char *);
int instance_vars_from_class_object (OBJECT *);
CFUNC *is_c_fn (OBJECT *);
CVAR *is_c_variable (OBJECT *);
int label_is_defined (MESSAGE_STACK, int);
int self_is_fmt_arg (int, char *);
OBJECT *self_object (MESSAGE_STACK, int);

/* objtoc.c */
char *fmt_printf_fmt_arg (MESSAGE_STACK, int, int, int, char *);
char *get_type_conv_name (char *);
int is_translatable_basic_class (char *);
char *obj_2_c_wrapper (MESSAGE *, OBJECT *, METHOD *, char *, int);
char *obj_2_c_wrapper_trans (MESSAGE_STACK, int, MESSAGE *, OBJECT *, METHOD *, char *, int);
char *array_obj_2_c_wrapper (MESSAGE_STACK, int, OBJECT *, METHOD *, char *);
char *basic_class_from_cvar (CVAR *, int);
char *fmt_rt_return (char *, char *, int);

/* op.c */
OP_CONTEXT op_context (MESSAGE_STACK, int);
int op_precedence (int, MESSAGE_STACK, int);
int operands (MESSAGE_STACK, int, int *, int *);

/*output.c */
void __fileout (char *);
void fileout (char *s, int, int);
char *fmt_eval_expr (char *);
int fmt_line_info (char *, int, char *, int, int);
char *fmt_c_expr_store_arg_call (OBJECT *, METHOD *, OBJECT *, char *);
char *fmt_method_call (OBJECT *, char *);
char *fmt_register_c_method_arg_call (CVAR *, char *, int);
char *fmt_rt_instancevar_call (OBJECT *, char *);
char *fmt_store_arg_call (OBJECT *, METHOD *, OBJECT *);
void generate_ctalk_init (void);
void generate_ctalk_init_call (void);
int generate_c_expr_store_arg_call (OBJECT *, METHOD *, OBJECT *, char *, int);
int generate_define_class_variable_call (char *, char *, char *, char *);
int generate_define_instance_variable_call (char *, char *, char *, char *);
int generate_method_call (OBJECT *, char *, int);
int generate_instance_method_param_definition_call (char *, char *, char *, char *,
					   int, int);
int generate_method_pop_arg_call (int);
int generate_global_method_definition_call (char *,char *,char *, int);
int generate_global_object_definition (char *, char *, char *, char *, int);
int generate_method_c_declaration (char *);
int generate_method_call_from_primitive (OBJECT *, METHOD *, char *, int);
int generate_class_method_definition_call (char *, char *, char *, int);
int generate_instance_method_definition_call (char *, char *, char *, int);
int generate_class_method_return_class_call (char *, char *, char *);
int generate_instance_method_return_class_call (char *, char *, char *);
int generate_primitive_method_call (OBJECT *, METHOD *, char *, int);
int generate_primitive_class_definition_call (OBJECT *, METHOD *);
int generate_register_c_method_arg_call (CVAR *, char *, int, int);
int generate_register_typedef_call (CVAR *);
int generate_rt_instancevar_call (OBJECT *, char *, int);
int generate_self_call (int);
int generate_set_global_variable_call (char *, char *);
int generate_set_local_variable_call (char *, char *);
int generate_store_arg_call (OBJECT *, METHOD *, OBJECT *, int);
int generate_store_arg_call2 (OBJECT *, METHOD *, int);
int include_output (char *);
void init_output_vars (void);
int output_buffer (char *, int);
int output_ctalk_init (int);
int output_frame (int);
int queue_init_statement (char *, int, int);
void unbuffer_function_output (void);
char *struct_or_union_expr (MESSAGE_STACK, int, int, int *);

/* param.c */
PARAM *new_param (void);
OBJECT *__ctalk_getParamByName (char *);

/* parser.c */
int add_frame (int, int);
int check_evaled (int);
int check_state (int, MESSAGE_STACK, int*, int);
void clear_all_messages (void);
void clear_frame_messages  (int);
void delete_parserinfo (PARSER *);
PARSER *current_parser (void);
int get_messageptr (void);
int get_parser_output_ptr (void);
int init_message_stack (void);
void init_parser_frame_ptr (void);
void init_parsers (void);
int lasttoken (int);
int lookup_message (MESSAGE *);
MESSAGE_STACK message_stack ();
MESSAGE *message_pop (void);
MESSAGE *message_stack_at (int);
int message_push (MESSAGE *);
PARSER *new_parserinfo (void);
char *parse_string (char *);
char *parse (char *, long long);
PARSER *parser_at (int);
int parser_frame_ptr (void);
int parser_frame_scope (void);
int parser_pass (int, PARSER *);
int parser_ptr (void);
PARSER *pop_parser (void);
void push_parser (PARSER *);
int remove_frame (void);
int reset_messageptr (int);
int set_declaration_evaled (MESSAGE_STACK, int);
void set_message_value (MESSAGE *, void *);
void set_parser_frame_ptr (int);
int unevaled (int);

/* pexcept.c */
int catch_exception (void (*)(void));
int handle_parse_exception (PARSER *, int);
int i_exception (MESSAGE *, EXCEPTION, char *);
void init_i_exceptions (void);
void save_unresolved_classes (I_EXCEPTION *);
void save_unresolved_symbols (I_EXCEPTION *);
void set_parser_env (void);

/* primitives.c */
int class_primitive_method_args (METHOD *, MESSAGE_STACK, int);
OBJECT *define_class (int);
OBJECT *define_class_variable (int);
OBJECT *define_instance_variable (int);
OBJECT *get_rcvr_class_obj (void);
void init_new_method_stack (void);
int is_cached_class (char *);
OBJECT *new_class_method (int);
OBJECT *new_instance_method (int);
OBJECT *new_object (int);
PARAM *method_param (char *);
int param_class_exists (char *);
void set_rcvr_class_obj (OBJECT *);

/* return.c */
int return_val_push (OBJECT *);
int get_return_val_pointer (void);
OBJECT *return_val_pop (void);
int init_return_vals (void);

/* rexpr.c */
int check_constant_expr (MESSAGE_STACK, int, int);
int class_variable_expression (MESSAGE_STACK, int);
int default_method (MESSAGE_STACK, int);
int expr_has_objects (MESSAGE_STACK, int, int);
int fn_output_context (MESSAGE_STACK, int, OBJECT *, METHOD *, int, int);
int is_instancevar_ref (OBJECT *, char *);
int is_expr_obj (MESSAGE *);
OBJECT_CONTEXT object_context (MESSAGE_STACK, int);
int self_class_or_instance_variable_lookahead (MESSAGE_STACK, int);
int need_rt_eval (MESSAGE_STACK, int);

/* rt_expr.c */
char *fmt_default_ctrlblk_expr (MESSAGE_STACK, int, int, int);
char *fmt_rt_expr (MESSAGE_STACK, int, int *);
char *fmt_user_fn_rt_expr (MESSAGE_STACK, int, int, char *);
char *rt_expr (MESSAGE_STACK, int, int *);
char *rt_obj_arg (MESSAGE_STACK, int, int *);
char *rt_self_expr (MESSAGE_STACK, int, int *);

/* stack.c */
int p_message_push (MESSAGE *);
MESSAGE *p_message_pop (void);
int stack_start (MESSAGE_STACK);
int get_stack_top (MESSAGE_STACK);

/* subexpr.c */
int _scanback (MESSAGE_STACK, int, int, int, int);
int _scanforward (MESSAGE_STACK, int, int, int, int);
int constant_subexpr (MESSAGE_STACK, int, int *, VAL *);
int copy_val (VAL *, VAL *);
int m_print_val (MESSAGE *, VAL *);
int p_match_paren (MESSAGE_STACK, int, int);
int match_paren (MESSAGE_STACK, int, int);
int match_paren_rev (MESSAGE_STACK, int, int);
int nextlangmsg (MESSAGE_STACK, int);
int prevlangmsg (MESSAGE_STACK, int);
int re_eval (int, int);
int scanback (MESSAGE_STACK, int, int, int);
int scanback_other (MESSAGE_STACK, int, int, int);
int scanforward (MESSAGE_STACK, int, int, int);
int scanforward_other (MESSAGE_STACK, int, int, int);
int set_subexpr_val (MESSAGE_STACK, int, VAL *);
int un_evaled (int, int);

/* subscr.c */
char *subscript_expr (MESSAGE_STACK, int, int, OBJECT *, METHOD *, char *, CVAR *);

/* substrcpy.c */
char *substrcpy (char *, char *, int, int);
char *substrcat (char *, char *, int, int);

/* symbol.c */
int add_unresolved_class (char *);
int add_unresolved_symbol (char *);
SYMBOL *new_symbol (void);
void delete_symbol (SYMBOL *);

/* typecheck.c */
int operand_type_check (MESSAGE_STACK, int);
int unary_type_check (MESSAGE_STACK, int);
int binary_type_check (MESSAGE_STACK, int);

/* typeof.c */
int type_of (char *);
int lextype_of_class (char *);

/* ufntmpl.c */
FN_TMPL *create_user_fn_template (MESSAGE_STACK, int);
char *fmt_user_template_rt_expr (MESSAGE_STACK, int, FN_TMPL *);
int register_user_args (char **, int, CFUNC *);
char *template_from_user_cfunc (CFUNC *, char *, char *, char *);
int user_fn_arg_declarations (MESSAGE_STACK, int, int, char **, int *);
char *user_fn_expr_args (MESSAGE_STACK, int, char *);
char *user_fn_expr_args_from_params (MESSAGE_STACK, int, char *);
char *user_fn_template (MESSAGE_STACK, int);
void generate_user_fn_template_init (char *, char *);
char *user_fn_template_name (char *);
int user_template_params (MESSAGE_STACK, int);

#endif /* _CTALK_H */



