/* 
   functions.m

   Copyright (C) 1995, 1996, 1997 Ovidiu Predescu and Mircea Oancea.
   All rights reserved.

   Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>

   This file is part of libFoundation.

   Permission to use, copy, modify, and distribute this software and its
   documentation for any purpose and without fee is hereby granted, provided
   that the above copyright notice appear in all copies and that both that
   copyright notice and this permission notice appear in supporting
   documentation.

   We disclaim all warranties with regard to this software, including all
   implied warranties of merchantability and fitness, in no event shall
   we be liable for any special, indirect or consequential damages or any
   damages whatsoever resulting from loss of use, data or profits, whether in
   an action of contract, negligence or other tortious action, arising out of
   or in connection with the use or performance of this software.
*/

#ifndef __functions_h__
#define __functions_h__

#include <config.h>
#include <objc/objc.h>

/* Put here any actions that you want to be executed before starting
   the main loop of test driver. */

void init_test(void)
{
}

void try_catch1(void);
void try_catch2(void);
void try_multicatch(void);
void nsduring_nshandler(void);

#ifndef NO_NESTED_FUNCTIONS
void try_cleanup_catch1(void);
void try_cleanup_catch2(void);
void try_finally_catch1(void);
void try_finally_catch2(void);
void try_cleanup_nocatch(void);
void try_finally_nocatch(void);
void try_cleanup_finally_nocatch(void);
void try_cleanup_cleanup_finally_nocatch(void);
#endif

void loop(void);
void try_catch(void);


void invocation_setFlag(id object);
void invocation_setShortValue(id object);
void invocation_setIntValue(id object);
void invocation_setString(id object);
void invocation_setIntFloatDoubleValues(id object);
void invocation_setStruct1(id object);
void invocation_setStruct2(id object);
void invocation_setStruct3(id object);
void invocation_setStruct4(id object);
void invocation_setStruct5(id object);
void invocation_setStruct6(id object);
void invocation_setStruct7(id object);
void invocation_setStruct8(id object);
void invocation_setStruct9(id object);
void invocation_setStruct10(id object);
void invocation_setStruct11(id object);
void invocation_setStruct12(id object);
void invocation_setStruct13(id object);
void invocation_setStruct14(id object);
void invocation_setStruct15(id object);
void invocation_setStruct16(id object);
void invocation_flag(id object);
void invocation_shortValue(id object);
void invocation_intValue(id object);
void invocation_floatValue(id object);
void invocation_doubleValue(id object);
void invocation_string(id object);
void invocation_struct1(id object);
void invocation_struct2(id object);
void invocation_struct3(id object);
void invocation_struct4(id object);
void invocation_struct5(id object);
void invocation_struct6(id object);
void invocation_struct7(id object);
void invocation_struct8(id object);
void invocation_struct9(id object);
void invocation_struct10(id object);
void invocation_struct11(id object);
void invocation_struct12(id object);
void invocation_struct13(id object);
void invocation_struct14(id object);
void invocation_struct15(id object);
void invocation_struct16(id object);

void string_format_char(id string, id format);
void string_format_short(id string, id format);
void string_format_int(id string, id format);
void string_format_float(id string, id format);
void string_format_cstring(id string, id format);
void string_format_obj(id string, id format);
void string_format_char_int(id string, id format);
void string_format_short_int(id string, id format);
void string_format_int_int(id string, id format);
void string_format_float_int(id string, id format);
void string_format_cstring_int(id string, id format);
void string_format_obj_int(id string, id format);

char* cstringcopy(char* cstr, int length);

void forwarder_setFlag(id object);
void forwarder_setShortValue(id object);
void forwarder_setIntValue(id object);
void forwarder_setIntFloatDoubleValues(id object);
void forwarder_flag(id object);
void forwarder_shortValue(id object);
void forwarder_intValue(id object);
void forwarder_floatValue(id object);
void forwarder_doubleValue(id object);
void forwarder_struct1(id object);
void forwarder_struct2(id object);
void forwarder_struct3(id object);
void forwarder_struct4(id object);
void forwarder_struct5(id object);
void forwarder_struct6(id object);
void forwarder_struct7(id object);
void forwarder_struct8(id object);
void forwarder_struct9(id object);
void forwarder_struct10(id object);
void forwarder_struct11(id object);
void forwarder_struct12(id object);
void forwarder_struct13(id object);
void forwarder_struct14(id object);
void forwarder_struct15(id object);
void forwarder_struct16(id object);
void forwarder_setStruct1(id object);
void forwarder_setStruct2(id object);
void forwarder_setStruct3(id object);
void forwarder_setStruct4(id object);
void forwarder_setStruct5(id object);
void forwarder_setStruct6(id object);
void forwarder_setStruct7(id object);
void forwarder_setStruct8(id object);
void forwarder_setStruct9(id object);
void forwarder_setStruct10(id object);
void forwarder_setStruct11(id object);
void forwarder_setStruct12(id object);
void forwarder_setStruct13(id object);
void forwarder_setStruct14(id object);
void forwarder_setStruct15(id object);
void forwarder_setStruct16(id object);
void setReturnValue_flag(id invocation);
void setReturnValue_shortValue(id invocation);
void setReturnValue_intValue(id invocation);
void setReturnValue_floatValue(id invocation);
void setReturnValue_doubleValue(id invocation);
void setReturnValue_struct1(id invocation);
void setReturnValue_struct2(id invocation);
void setReturnValue_struct3(id invocation);
void setReturnValue_struct4(id invocation);
void setReturnValue_struct5(id invocation);
void setReturnValue_struct6(id invocation);
void setReturnValue_struct7(id invocation);
void setReturnValue_struct8(id invocation);
void setReturnValue_struct9(id invocation);
void setReturnValue_struct10(id invocation);
void setReturnValue_struct11(id invocation);
void setReturnValue_struct12(id invocation);
void setReturnValue_struct13(id invocation);
void setReturnValue_struct14(id invocation);
void setReturnValue_struct15(id invocation);
void setReturnValue_struct16(id invocation);

struct {
    char* name;
    void (*function)(void);
} functions[] = {
    { "try_catch1", try_catch1 },
    { "try_catch2", try_catch2 },
    { "try_multicatch", try_multicatch },
    { "nsduring_nshandler", nsduring_nshandler },
#ifndef NO_NESTED_FUNCTIONS
    { "try_cleanup_catch1", try_cleanup_catch1 },
    { "try_cleanup_catch2", try_cleanup_catch2 },
    { "try_finally_catch1", try_finally_catch1 },
    { "try_finally_catch2", try_finally_catch2 },
    { "try_cleanup_nocatch", try_cleanup_nocatch },
    { "try_cleanup_finally_nocatch", try_cleanup_finally_nocatch },
    { "try_finally_nocatch", try_finally_nocatch },
    { "try_cleanup_cleanup_finally_nocatch", try_cleanup_cleanup_finally_nocatch },
#endif
    { "loop", loop },
    { "try_catch", try_catch },
    { NULL, NULL }
};

struct {
    char* name;
    void (*function)(id);
} functions1[] = {
    { "invocation_setFlag", invocation_setFlag },
    { "invocation_setShortValue", invocation_setShortValue },
    { "invocation_setIntValue", invocation_setIntValue },
    { "invocation_setString", invocation_setString },
    { "invocation_setIntFloatDoubleValues", invocation_setIntFloatDoubleValues },
    { "invocation_setStruct1", invocation_setStruct1 },
    { "invocation_setStruct2", invocation_setStruct2 },
    { "invocation_setStruct3", invocation_setStruct3 },
    { "invocation_setStruct4", invocation_setStruct4 },
    { "invocation_setStruct5", invocation_setStruct5 },
    { "invocation_setStruct6", invocation_setStruct6 },
    { "invocation_setStruct7", invocation_setStruct7 },
    { "invocation_setStruct8", invocation_setStruct8 },
    { "invocation_setStruct9", invocation_setStruct9 },
    { "invocation_setStruct10", invocation_setStruct10 },
    { "invocation_setStruct11", invocation_setStruct11 },
    { "invocation_setStruct12", invocation_setStruct12 },
    { "invocation_setStruct13", invocation_setStruct13 },
    { "invocation_setStruct14", invocation_setStruct14 },
    { "invocation_setStruct15", invocation_setStruct15 },
    { "invocation_setStruct16", invocation_setStruct16 },
    { "invocation_flag", invocation_flag },
    { "invocation_shortValue", invocation_shortValue },
    { "invocation_intValue", invocation_intValue },
    { "invocation_floatValue", invocation_floatValue },
    { "invocation_doubleValue", invocation_doubleValue },
    { "invocation_string", invocation_string }, 
    { "invocation_struct1", invocation_struct1 },
    { "invocation_struct2", invocation_struct2 },
    { "invocation_struct3", invocation_struct3 },
    { "invocation_struct4", invocation_struct4 },
    { "invocation_struct5", invocation_struct5 },
    { "invocation_struct6", invocation_struct6 },
    { "invocation_struct7", invocation_struct7 },
    { "invocation_struct8", invocation_struct8 },
    { "invocation_struct9", invocation_struct9 },
    { "invocation_struct10", invocation_struct10 },
    { "invocation_struct11", invocation_struct11 },
    { "invocation_struct12", invocation_struct12 },
    { "invocation_struct13", invocation_struct13 },
    { "invocation_struct14", invocation_struct14 },
    { "invocation_struct15", invocation_struct15 },
    { "invocation_struct16", invocation_struct16 },

    { "forwarder_setFlag", forwarder_setFlag },
    { "forwarder_setShortValue", forwarder_setShortValue },
    { "forwarder_setIntValue", forwarder_setIntValue },
    { "forwarder_setIntFloatDoubleValues", forwarder_setIntFloatDoubleValues },
    { "forwarder_flag", forwarder_flag },
    { "forwarder_shortValue", forwarder_shortValue },
    { "forwarder_intValue", forwarder_intValue },
    { "forwarder_floatValue", forwarder_floatValue },
    { "forwarder_doubleValue", forwarder_doubleValue },
    { "forwarder_struct1", forwarder_struct1 },
    { "forwarder_struct2", forwarder_struct2 },
    { "forwarder_struct3", forwarder_struct3 },
    { "forwarder_struct4", forwarder_struct4 },
    { "forwarder_struct5", forwarder_struct5 },
    { "forwarder_struct6", forwarder_struct6 },
    { "forwarder_struct7", forwarder_struct7 },
    { "forwarder_struct8", forwarder_struct8 },
    { "forwarder_struct9", forwarder_struct9 },
    { "forwarder_struct10", forwarder_struct10 },
    { "forwarder_struct11", forwarder_struct11 },
    { "forwarder_struct12", forwarder_struct12 },
    { "forwarder_struct13", forwarder_struct13 },
    { "forwarder_struct14", forwarder_struct14 },
    { "forwarder_struct15", forwarder_struct15 },
    { "forwarder_struct16", forwarder_struct16 },
    { "forwarder_setStruct1", forwarder_setStruct1 },
    { "forwarder_setStruct2", forwarder_setStruct2 },
    { "forwarder_setStruct3", forwarder_setStruct3 },
    { "forwarder_setStruct4", forwarder_setStruct4 },
    { "forwarder_setStruct5", forwarder_setStruct5 },
    { "forwarder_setStruct6", forwarder_setStruct6 },
    { "forwarder_setStruct7", forwarder_setStruct7 },
    { "forwarder_setStruct8", forwarder_setStruct8 },
    { "forwarder_setStruct9", forwarder_setStruct9 },
    { "forwarder_setStruct10", forwarder_setStruct10 },
    { "forwarder_setStruct11", forwarder_setStruct11 },
    { "forwarder_setStruct12", forwarder_setStruct12 },
    { "forwarder_setStruct13", forwarder_setStruct13 },
    { "forwarder_setStruct14", forwarder_setStruct14 },
    { "forwarder_setStruct15", forwarder_setStruct15 },
    { "forwarder_setStruct16", forwarder_setStruct16 },

    { "setReturnValue_flag", setReturnValue_flag },
    { "setReturnValue_shortValue", setReturnValue_shortValue },
    { "setReturnValue_intValue", setReturnValue_intValue },
    { "setReturnValue_floatValue", setReturnValue_floatValue },
    { "setReturnValue_doubleValue", setReturnValue_doubleValue },
    { "setReturnValue_struct1", setReturnValue_struct1 },
    { "setReturnValue_struct2", setReturnValue_struct2 },
    { "setReturnValue_struct3", setReturnValue_struct3 },
    { "setReturnValue_struct4", setReturnValue_struct4 },
    { "setReturnValue_struct5", setReturnValue_struct5 },
    { "setReturnValue_struct6", setReturnValue_struct6 },
    { "setReturnValue_struct7", setReturnValue_struct7 },
    { "setReturnValue_struct8", setReturnValue_struct8 },
    { "setReturnValue_struct9", setReturnValue_struct9 },
    { "setReturnValue_struct10", setReturnValue_struct10 },
    { "setReturnValue_struct11", setReturnValue_struct11 },
    { "setReturnValue_struct12", setReturnValue_struct12 },
    { "setReturnValue_struct13", setReturnValue_struct13 },
    { "setReturnValue_struct14", setReturnValue_struct14 },
    { "setReturnValue_struct15", setReturnValue_struct15 },
    { "setReturnValue_struct16", setReturnValue_struct16 },
    { NULL, NULL }
};

struct {
    char* name;
    void (*function)(id, id);
} functions2[] = {
    { "string_format_char", string_format_char },
    { "string_format_short", string_format_short },
    { "string_format_int", string_format_int },
    { "string_format_float", string_format_float },
    { "string_format_cstring", string_format_cstring },
    { "string_format_obj", string_format_obj },
    { "string_format_char_int", string_format_char_int },
    { "string_format_short_int", string_format_short_int },
    { "string_format_int_int", string_format_int_int },
    { "string_format_float_int", string_format_float_int },
    { "string_format_cstring_int", string_format_cstring_int },
    { "string_format_obj_int", string_format_obj_int },
    { NULL, NULL }
};

#endif /* __functions_h__ */
