Changeset 13

Show
Ignore:
Timestamp:
06/24/06 20:35:19 (6 years ago)
Author:
KirkMcDonald
Message:

Added support for default function arguments.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pyd/def.d

    r8 r13  
    3636/** 
    3737 * Wraps a D function, making it callable from Python. 
     38 * 
     39 * Params: 
     40 *      name = The name of the function as it will appear in Python. 
     41 *      fn   = The function to wrap. 
     42 *      MIN_ARGS = The minimum number of arguments this function can accept. 
     43 *                 For use with functions with default arguments. Defaults to 
     44 *                 the maximum number of arguments this function supports. 
    3845 * 
    3946 * For example: 
     
    5865 *It's greater than 10!) 
    5966 */ 
    60 template def(char[] name, alias fn) { 
     67template def(char[] name, alias fn, uint MIN_ARGS = NumberOfArgs!(typeof(&fn))) { 
    6168    void def() { 
    6269        static PyMethodDef empty = { null, null, 0, null }; 
    6370        module_global_methods[length-1].ml_name = name ~ \0; 
    6471        module_global_methods[length-1].ml_meth = 
    65             cast(PyCFunction)&func_wrap!(fn).func; 
     72            cast(PyCFunction)&func_wrap!(fn, MIN_ARGS).func; 
    6673        module_global_methods[length-1].ml_flags = METH_VARARGS; 
    6774        module_global_methods[length-1].ml_doc = ""; 
     
    7885} 
    7986 
    80 template func_wrap(alias fn) { 
     87template func_wrap(alias fn, uint MIN_ARGS) { 
    8188    //typeof(&r_fn) fn = &r_fn; 
    8289    alias typeof(&fn) fn_t; 
    83     const uint ARGS = NumberOfArgs!(fn_t); 
     90    const uint MAX_ARGS = NumberOfArgs!(fn_t); 
    8491    alias ReturnType!(fn_t) RetType; 
    8592    extern (C) 
     
    8895 
    8996        // Sanity check! 
    90         if (PyObject_Length(args) != ARGS) { 
    91             PyErr_SetString(PyExc_TypeError, "Wrong number of arguments. Got " ~ toString(PyObject_Length(args)) ~ " expected " ~ toString(ARGS) ~ "."); 
     97        int ARGS = PyObject_Length(args); 
     98        if (ARGS < MIN_ARGS || ARGS > MAX_ARGS) { 
     99            PyErr_SetString(PyExc_TypeError, "Wrong number of arguments. Got " ~ toString(ARGS) ~ ", expected between " ~ toString(MIN_ARGS) ~ "-" ~ toString(MAX_ARGS) ~ " args."); 
    92100            return null; 
    93101        } 
     
    95103        try { /* begin try */ 
    96104         
    97         static if (ARGS == 0) { 
    98             // If the return type is void... 
    99             static if (is(RetType : void)) { 
    100                 fn(); 
    101                 // Return Py_None 
    102                 Py_INCREF(Py_None); 
    103                 ret = Py_None; 
    104             } else { 
    105                 // Otherwise, return a conversion of the return value 
    106                 ret = _py( fn() ); 
    107             } 
    108         } else static if (ARGS == 1) { 
    109             // See, this ugly code works like this: 
    110             // (1) _py takes the return type of the wrapped function, and 
    111             // converts it to a PyObject*, which is passed straight back into 
    112             // Python. 
    113             // (2) fn is the wrapped function. Each of its arguments take the 
    114             // form: 
    115             // (3) d_type is a template function. It converts a PyObject* into 
    116             // a reasonable D type. The template argument is the type to 
    117             // convert to. The function argument is the PyObject* to convert. 
    118             // (4) ArgType derives the type of an argument to the function. It 
    119             // (therefore) is used to pass the correct type into d_type's 
    120             // template argument. 
    121             // This pattern is repeated umpteen times, as each number of 
    122             // function arguments requires its own statement TWICE, as void 
    123             // return types must be handled differently. 
    124             static if (is(RetType : void)) { 
    125                 // Call with void return type 
    126                 fn( 
    127                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)) 
    128                 ); 
    129                 // Return Py_None 
    130                 Py_INCREF(Py_None); 
    131                 ret = Py_None; 
    132             } else { 
    133                 // Capture return value 
    134                 ret = _py( fn( 
    135                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)) 
    136                 ) ); 
    137             } 
    138         } else static if (ARGS == 2) { 
    139             static if (is(RetType : void)) { 
    140                 fn( 
    141                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    142                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)) 
    143                 ); 
    144                 Py_INCREF(Py_None); 
    145                 ret = Py_None; 
    146             } else { 
    147                 return _py( fn( 
    148                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    149                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)) 
    150                 ) ); 
    151             } 
    152         } else static if (ARGS == 3) { 
    153             static if (is(RetType : void)) { 
    154                 fn( 
    155                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    156                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    157                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)) 
    158                 ); 
    159                 Py_INCREF(Py_None); 
    160                 ret = Py_None; 
    161             } else { 
    162                 return _py( fn( 
    163                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    164                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    165                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)) 
    166                 ) ); 
    167             } 
    168         } else static if (ARGS == 4) { 
    169             static if (is(RetType : void)) { 
    170                 fn( 
    171                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    172                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    173                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    174                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)) 
    175                 ); 
    176                 Py_INCREF(Py_None); 
    177                 ret = Py_None; 
    178             } else { 
    179                 return _py( fn( 
    180                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    181                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    182                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    183                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)) 
    184                 ) ); 
    185             } 
    186         } else static if (ARGS == 5) { 
    187             static if (is(RetType : void)) { 
    188                 fn( 
    189                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    190                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    191                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    192                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    193                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)) 
    194                 ); 
    195                 Py_INCREF(Py_None); 
    196                 ret = Py_None; 
    197             } else { 
    198                 return _py( fn( 
    199                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    200                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    201                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    202                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    203                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)) 
    204                 ) ); 
    205             } 
    206         } else static if (ARGS == 6) { 
    207             static if (is(RetType : void)) { 
    208                 fn( 
    209                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    210                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    211                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    212                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    213                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    214                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)) 
    215                 ); 
    216                 Py_INCREF(Py_None); 
    217                 ret = Py_None; 
    218             } else { 
    219                 return _py( fn( 
    220                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    221                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    222                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    223                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    224                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    225                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)) 
    226                 ) ); 
    227             } 
    228         } else static if (ARGS == 7) { 
    229             static if (is(RetType : void)) { 
    230                 fn( 
    231                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    232                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    233                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    234                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    235                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    236                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    237                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)) 
    238                 ); 
    239                 Py_INCREF(Py_None); 
    240                 ret = Py_None; 
    241             } else { 
    242                 return _py( fn( 
    243                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    244                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    245                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    246                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    247                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    248                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    249                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)) 
    250                 ) ); 
    251             } 
    252         } else static if (ARGS == 8) { 
    253             static if (is(RetType : void)) { 
    254                 fn( 
    255                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    256                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    257                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    258                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    259                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    260                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    261                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)), 
    262                     d_type!(ArgType!(fn_t, 8))(PyTuple_GET_ITEM(args, 7)) 
    263                 ); 
    264                 Py_INCREF(Py_None); 
    265                 ret = Py_None; 
    266             } else { 
    267                 return _py( fn( 
    268                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    269                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    270                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    271                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    272                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    273                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    274                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)), 
    275                     d_type!(ArgType!(fn_t, 8))(PyTuple_GET_ITEM(args, 7)) 
    276                 ) ); 
    277             } 
    278         } else static if (ARGS == 9) { 
    279             static if (is(RetType : void)) { 
    280                 fn( 
    281                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    282                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    283                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    284                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    285                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    286                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    287                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)), 
    288                     d_type!(ArgType!(fn_t, 8))(PyTuple_GET_ITEM(args, 7)), 
    289                     d_type!(ArgType!(fn_t, 9))(PyTuple_GET_ITEM(args, 8)) 
    290                 ); 
    291                 Py_INCREF(Py_None); 
    292                 ret = Py_None; 
    293             } else { 
    294                 return _py( fn( 
    295                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    296                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    297                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    298                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    299                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    300                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    301                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)), 
    302                     d_type!(ArgType!(fn_t, 8))(PyTuple_GET_ITEM(args, 7)), 
    303                     d_type!(ArgType!(fn_t, 9))(PyTuple_GET_ITEM(args, 8)) 
    304                 ) ); 
    305             } 
    306         } else static if (ARGS == 10) { 
    307             static if (is(RetType : void)) { 
    308                 fn( 
    309                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    310                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    311                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    312                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    313                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    314                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    315                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)), 
    316                     d_type!(ArgType!(fn_t, 8))(PyTuple_GET_ITEM(args, 7)), 
    317                     d_type!(ArgType!(fn_t, 9))(PyTuple_GET_ITEM(args, 8)), 
    318                     d_type!(ArgType!(fn_t, 10))(PyTuple_GET_ITEM(args, 9)) 
    319                 ); 
    320                 Py_INCREF(Py_None); 
    321                 ret = Py_None; 
    322             } else { 
    323                 return _py( fn( 
    324                     d_type!(ArgType!(fn_t, 1))(PyTuple_GET_ITEM(args, 0)), 
    325                     d_type!(ArgType!(fn_t, 2))(PyTuple_GET_ITEM(args, 1)), 
    326                     d_type!(ArgType!(fn_t, 3))(PyTuple_GET_ITEM(args, 2)), 
    327                     d_type!(ArgType!(fn_t, 4))(PyTuple_GET_ITEM(args, 3)), 
    328                     d_type!(ArgType!(fn_t, 5))(PyTuple_GET_ITEM(args, 4)), 
    329                     d_type!(ArgType!(fn_t, 6))(PyTuple_GET_ITEM(args, 5)), 
    330                     d_type!(ArgType!(fn_t, 7))(PyTuple_GET_ITEM(args, 6)), 
    331                     d_type!(ArgType!(fn_t, 8))(PyTuple_GET_ITEM(args, 7)), 
    332                     d_type!(ArgType!(fn_t, 9))(PyTuple_GET_ITEM(args, 8)), 
    333                     d_type!(ArgType!(fn_t, 10))(PyTuple_GET_ITEM(args, 9)) 
    334                 ) ); 
    335             } 
    336         } /* end ARGS static ifs */ 
     105        static if (MIN_ARGS <= 0 && MAX_ARGS >= 0) { 
     106            if (ARGS == 0) { 
     107                // If the return type is void... 
     108                static if (is(RetType : void)) { 
     109                    fn(); 
     110                    // Return Py_None 
     111                    Py_INCREF(Py_None); 
     112                    ret = Py_None; 
     113                } else { 
     114                    // Otherwise, return a conversion of the return value 
     115                    ret = _py( fn() ); 
     116                } 
     117            } 
     118        } static if (MIN_ARGS <= 1 && MAX_ARGS >= 1) { 
     119            if (ARGS == 1) { 
     120                // See, this ugly code works like this: 
     121                // (1) _py takes the return type of the wrapped function, and 
     122                // converts it to a PyObject*, which is passed straight back into 
     123                // Python. 
     124                // (2) fn is the wrapped function. Each of its arguments take the 
     125                // form: 
     126                // (3) d_type is a template function. It converts a PyObject* into 
     127                // a reasonable D type. The template argument is the type to 
     128                // convert to. The function argument is the PyObject* to convert. 
     129                // (4) ArgType derives the type of an argument to the function. It 
     130                // (therefore) is used to pass the correct type into d_type's 
     131                // template argument. 
     132                // This pattern is repeated umpteen times, as each number of 
     133                // function arguments requires its own statement TWICE, as void 
     134                // return types must be handled differently. 
     135                static if (is(RetType : void)) { 
     136                    // Call with void return type 
     137                    fn( 
     138                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)) 
     139                    ); 
     140                    // Return Py_None 
     141                    Py_INCREF(Py_None); 
     142                    ret = Py_None; 
     143                } else { 
     144                    // Capture return value 
     145                    ret = _py( fn( 
     146                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)) 
     147                    ) ); 
     148                } 
     149            } 
     150        } static if (MIN_ARGS <= 2 && MAX_ARGS >= 2) { 
     151            if (ARGS == 2) { 
     152                static if (is(RetType : void)) { 
     153                    fn( 
     154                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     155                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)) 
     156                    ); 
     157                    Py_INCREF(Py_None); 
     158                    ret = Py_None; 
     159                } else { 
     160                    ret = _py( fn( 
     161                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     162                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)) 
     163                    ) ); 
     164                } 
     165            } 
     166        } static if (MIN_ARGS <= 3 && MAX_ARGS >= 3) { 
     167            if (ARGS == 3) { 
     168                static if (is(RetType : void)) { 
     169                    fn( 
     170                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     171                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     172                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)) 
     173                    ); 
     174                    Py_INCREF(Py_None); 
     175                    ret = Py_None; 
     176                } else { 
     177                    ret = _py( fn( 
     178                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     179                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     180                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)) 
     181                    ) ); 
     182                } 
     183            } 
     184        } static if (MIN_ARGS <= 4 && MAX_ARGS >= 4) { 
     185            if (ARGS == 4) { 
     186                static if (is(RetType : void)) { 
     187                    fn( 
     188                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     189                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     190                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     191                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)) 
     192                    ); 
     193                    Py_INCREF(Py_None); 
     194                    ret = Py_None; 
     195                } else { 
     196                    ret = _py( fn( 
     197                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     198                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     199                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     200                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)) 
     201                    ) ); 
     202                } 
     203            } 
     204        } static if (MIN_ARGS <= 5 && MAX_ARGS >= 5) { 
     205            if (ARGS == 5) { 
     206                static if (is(RetType : void)) { 
     207                    fn( 
     208                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     209                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     210                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     211                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     212                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)) 
     213                    ); 
     214                    Py_INCREF(Py_None); 
     215                    ret = Py_None; 
     216                } else { 
     217                    ret = _py( fn( 
     218                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     219                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     220                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     221                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     222                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)) 
     223                    ) ); 
     224                } 
     225            } 
     226        } static if (MIN_ARGS <= 6 && MAX_ARGS >= 6) { 
     227            if (ARGS == 6) { 
     228                static if (is(RetType : void)) { 
     229                    fn( 
     230                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     231                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     232                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     233                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     234                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     235                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)) 
     236                    ); 
     237                    Py_INCREF(Py_None); 
     238                    ret = Py_None; 
     239                } else { 
     240                    ret = _py( fn( 
     241                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     242                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     243                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     244                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     245                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     246                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)) 
     247                    ) ); 
     248                } 
     249            } 
     250        } static if (MIN_ARGS <= 7 && MAX_ARGS >= 7) { 
     251            if (ARGS == 7) { 
     252                static if (is(RetType : void)) { 
     253                    fn( 
     254                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     255                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     256                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     257                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     258                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     259                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     260                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)) 
     261                    ); 
     262                    Py_INCREF(Py_None); 
     263                    ret = Py_None; 
     264                } else { 
     265                    ret = _py( fn( 
     266                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     267                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     268                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     269                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     270                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     271                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     272                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)) 
     273                    ) ); 
     274                } 
     275            } 
     276        } static if (MIN_ARGS <= 8 && MAX_ARGS >= 8) { 
     277            if (ARGS == 8) { 
     278                static if (is(RetType : void)) { 
     279                    fn( 
     280                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     281                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     282                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     283                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     284                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     285                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     286                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     287                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)) 
     288                    ); 
     289                    Py_INCREF(Py_None); 
     290                    ret = Py_None; 
     291                } else { 
     292                    ret = _py( fn( 
     293                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     294                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     295                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     296                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     297                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     298                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     299                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     300                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)) 
     301                    ) ); 
     302                } 
     303            } 
     304        } static if (MIN_ARGS <= 9 && MAX_ARGS >= 9) { 
     305            if (ARGS == 9) { 
     306                static if (is(RetType : void)) { 
     307                    fn( 
     308                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     309                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     310                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     311                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     312                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     313                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     314                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     315                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     316                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)) 
     317                    ); 
     318                    Py_INCREF(Py_None); 
     319                    ret = Py_None; 
     320                } else { 
     321                    ret = _py( fn( 
     322                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     323                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     324                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     325                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     326                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     327                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     328                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     329                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     330                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)) 
     331                    ) ); 
     332                } 
     333            } 
     334        } static if (MIN_ARGS <= 10 && MAX_ARGS >= 10) { 
     335            if (ARGS == 10) { 
     336                static if (is(RetType : void)) { 
     337                    fn( 
     338                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     339                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     340                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     341                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     342                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     343                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     344                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     345                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     346                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)), 
     347                        d_type!(ArgType!(fn_t, 10))(PyTuple_GetItem(args, 9)) 
     348                    ); 
     349                    Py_INCREF(Py_None); 
     350                    ret = Py_None; 
     351                } else { 
     352                    ret = _py( fn( 
     353                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     354                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     355                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     356                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     357                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     358                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     359                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     360                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     361                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)), 
     362                        d_type!(ArgType!(fn_t, 10))(PyTuple_GetItem(args, 9)) 
     363                    ) ); 
     364                } 
     365            } 
     366        } 
    337367         
    338368        } /* end try */ 
  • trunk/pyd/func_wrap.py

    r7 r13  
    11f = open('func_wrap.txt', 'w') 
    22 
    3 template = "d_type!(ArgType!(typeof(fn), %s))(PyTuple_GET_ITEM(args, %s))" 
     3template = "d_type!(ArgType!(fn_t, %s))(PyTuple_GetItem(args, %s))" 
    44 
    55for i in range(1, 11): 
    6     f.write(" " * 8 + "} else static if (ARGS == %s) {\n" % i) 
    7     f.write(" " * 12 +    "static if (is(RetType : void)) {\n") 
    8     f.write(" " * 16 +        "fn(\n") 
     6    f.write(" " * 8 + "} static if (MIN_ARGS <= %s && MAX_ARGS >= %s) {\n" % (i, i)) 
     7    f.write(" " * 12 + "if (ARGS == %s) {\n" % i) 
     8    f.write(" " * 16 +    "static if (is(RetType : void)) {\n") 
     9    f.write(" " * 20 +        "fn(\n") 
    910    for j in range(i): 
    10         f.write(" " * 20 + template % (j+1, j)) 
     11        f.write(" " * 24 + template % (j+1, j)) 
    1112        if j < i-1: 
    1213            f.write(',') 
    1314        f.write('\n') 
    14     f.write(" " * 16 +        ");\n") 
    15     f.write(" " * 16 +        "Py_INCREF(Py_None);\n") 
    16     f.write(" " * 16 +        "ret = Py_None;\n") 
    17     f.write(" " * 12 +    "} else {\n") 
    18     f.write(" " * 16 +        "return _py( fn(\n") 
     15    f.write(" " * 20 +        ");\n") 
     16    f.write(" " * 20 +        "Py_INCREF(Py_None);\n") 
     17    f.write(" " * 20 +        "ret = Py_None;\n") 
     18    f.write(" " * 16 +    "} else {\n") 
     19    f.write(" " * 20 +        "ret = _py( fn(\n") 
    1920    for j in range(i): 
    20         f.write(" " * 20 + template % (j+1, j)) 
     21        f.write(" " * 24 + template % (j+1, j)) 
    2122        if j < i-1: 
    2223            f.write(',') 
    2324        f.write('\n') 
    24     f.write(" " * 16 +        ") );\n") 
    25     f.write(" " * 12 +    "}\n") 
     25    f.write(" " * 20 +        ") );\n") 
     26    f.write(" " * 16 +    "}\n") 
     27    f.write(" " * 12 + "}\n") 
    2628f.write (" " * 8 + "}") 
  • trunk/pyd/func_wrap.txt

    r7 r13  
    1         } else static if (ARGS == 1) { 
    2             static if (is(RetType : void)) { 
    3                 fn( 
    4                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)) 
    5                 ); 
    6                 Py_INCREF(Py_None); 
    7                 ret = Py_None; 
    8             } else { 
    9                 return _py( fn( 
    10                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)) 
    11                 ) ); 
    12             } 
    13         } else static if (ARGS == 2) { 
    14             static if (is(RetType : void)) { 
    15                 fn( 
    16                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    17                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)) 
    18                 ); 
    19                 Py_INCREF(Py_None); 
    20                 ret = Py_None; 
    21             } else { 
    22                 return _py( fn( 
    23                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    24                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)) 
    25                 ) ); 
    26             } 
    27         } else static if (ARGS == 3) { 
    28             static if (is(RetType : void)) { 
    29                 fn( 
    30                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    31                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    32                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)) 
    33                 ); 
    34                 Py_INCREF(Py_None); 
    35                 ret = Py_None; 
    36             } else { 
    37                 return _py( fn( 
    38                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    39                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    40                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)) 
    41                 ) ); 
    42             } 
    43         } else static if (ARGS == 4) { 
    44             static if (is(RetType : void)) { 
    45                 fn( 
    46                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    47                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    48                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    49                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)) 
    50                 ); 
    51                 Py_INCREF(Py_None); 
    52                 ret = Py_None; 
    53             } else { 
    54                 return _py( fn( 
    55                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    56                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    57                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    58                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)) 
    59                 ) ); 
    60             } 
    61         } else static if (ARGS == 5) { 
    62             static if (is(RetType : void)) { 
    63                 fn( 
    64                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    65                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    66                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    67                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    68                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)) 
    69                 ); 
    70                 Py_INCREF(Py_None); 
    71                 ret = Py_None; 
    72             } else { 
    73                 return _py( fn( 
    74                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    75                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    76                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    77                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    78                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)) 
    79                 ) ); 
    80             } 
    81         } else static if (ARGS == 6) { 
    82             static if (is(RetType : void)) { 
    83                 fn( 
    84                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    85                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    86                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    87                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    88                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    89                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)) 
    90                 ); 
    91                 Py_INCREF(Py_None); 
    92                 ret = Py_None; 
    93             } else { 
    94                 return _py( fn( 
    95                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    96                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    97                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    98                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    99                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    100                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)) 
    101                 ) ); 
    102             } 
    103         } else static if (ARGS == 7) { 
    104             static if (is(RetType : void)) { 
    105                 fn( 
    106                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    107                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    108                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    109                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    110                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    111                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    112                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)) 
    113                 ); 
    114                 Py_INCREF(Py_None); 
    115                 ret = Py_None; 
    116             } else { 
    117                 return _py( fn( 
    118                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    119                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    120                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    121                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    122                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    123                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    124                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)) 
    125                 ) ); 
    126             } 
    127         } else static if (ARGS == 8) { 
    128             static if (is(RetType : void)) { 
    129                 fn( 
    130                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    131                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    132                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    133                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    134                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    135                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    136                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)), 
    137                     d_type!(ArgType!(typeof(fn), 8))(PyTuple_GET_ITEM(args, 7)) 
    138                 ); 
    139                 Py_INCREF(Py_None); 
    140                 ret = Py_None; 
    141             } else { 
    142                 return _py( fn( 
    143                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    144                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    145                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    146                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    147                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    148                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    149                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)), 
    150                     d_type!(ArgType!(typeof(fn), 8))(PyTuple_GET_ITEM(args, 7)) 
    151                 ) ); 
    152             } 
    153         } else static if (ARGS == 9) { 
    154             static if (is(RetType : void)) { 
    155                 fn( 
    156                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    157                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    158                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    159                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    160                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    161                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    162                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)), 
    163                     d_type!(ArgType!(typeof(fn), 8))(PyTuple_GET_ITEM(args, 7)), 
    164                     d_type!(ArgType!(typeof(fn), 9))(PyTuple_GET_ITEM(args, 8)) 
    165                 ); 
    166                 Py_INCREF(Py_None); 
    167                 ret = Py_None; 
    168             } else { 
    169                 return _py( fn( 
    170                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    171                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    172                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    173                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    174                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    175                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    176                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)), 
    177                     d_type!(ArgType!(typeof(fn), 8))(PyTuple_GET_ITEM(args, 7)), 
    178                     d_type!(ArgType!(typeof(fn), 9))(PyTuple_GET_ITEM(args, 8)) 
    179                 ) ); 
    180             } 
    181         } else static if (ARGS == 10) { 
    182             static if (is(RetType : void)) { 
    183                 fn( 
    184                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    185                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    186                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    187                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    188                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    189                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    190                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)), 
    191                     d_type!(ArgType!(typeof(fn), 8))(PyTuple_GET_ITEM(args, 7)), 
    192                     d_type!(ArgType!(typeof(fn), 9))(PyTuple_GET_ITEM(args, 8)), 
    193                     d_type!(ArgType!(typeof(fn), 10))(PyTuple_GET_ITEM(args, 9)) 
    194                 ); 
    195                 Py_INCREF(Py_None); 
    196                 ret = Py_None; 
    197             } else { 
    198                 return _py( fn( 
    199                     d_type!(ArgType!(typeof(fn), 1))(PyTuple_GET_ITEM(args, 0)), 
    200                     d_type!(ArgType!(typeof(fn), 2))(PyTuple_GET_ITEM(args, 1)), 
    201                     d_type!(ArgType!(typeof(fn), 3))(PyTuple_GET_ITEM(args, 2)), 
    202                     d_type!(ArgType!(typeof(fn), 4))(PyTuple_GET_ITEM(args, 3)), 
    203                     d_type!(ArgType!(typeof(fn), 5))(PyTuple_GET_ITEM(args, 4)), 
    204                     d_type!(ArgType!(typeof(fn), 6))(PyTuple_GET_ITEM(args, 5)), 
    205                     d_type!(ArgType!(typeof(fn), 7))(PyTuple_GET_ITEM(args, 6)), 
    206                     d_type!(ArgType!(typeof(fn), 8))(PyTuple_GET_ITEM(args, 7)), 
    207                     d_type!(ArgType!(typeof(fn), 9))(PyTuple_GET_ITEM(args, 8)), 
    208                     d_type!(ArgType!(typeof(fn), 10))(PyTuple_GET_ITEM(args, 9)) 
    209                 ) ); 
     1        } static if (MIN_ARGS <= 1 && MAX_ARGS >= 1) { 
     2            if (ARGS == 1) { 
     3                static if (is(RetType : void)) { 
     4                    fn( 
     5                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)) 
     6                    ); 
     7                    Py_INCREF(Py_None); 
     8                    ret = Py_None; 
     9                } else { 
     10                    ret = _py( fn( 
     11                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)) 
     12                    ) ); 
     13                } 
     14            } 
     15        } static if (MIN_ARGS <= 2 && MAX_ARGS >= 2) { 
     16            if (ARGS == 2) { 
     17                static if (is(RetType : void)) { 
     18                    fn( 
     19                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     20                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)) 
     21                    ); 
     22                    Py_INCREF(Py_None); 
     23                    ret = Py_None; 
     24                } else { 
     25                    ret = _py( fn( 
     26                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     27                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)) 
     28                    ) ); 
     29                } 
     30            } 
     31        } static if (MIN_ARGS <= 3 && MAX_ARGS >= 3) { 
     32            if (ARGS == 3) { 
     33                static if (is(RetType : void)) { 
     34                    fn( 
     35                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     36                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     37                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)) 
     38                    ); 
     39                    Py_INCREF(Py_None); 
     40                    ret = Py_None; 
     41                } else { 
     42                    ret = _py( fn( 
     43                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     44                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     45                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)) 
     46                    ) ); 
     47                } 
     48            } 
     49        } static if (MIN_ARGS <= 4 && MAX_ARGS >= 4) { 
     50            if (ARGS == 4) { 
     51                static if (is(RetType : void)) { 
     52                    fn( 
     53                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     54                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     55                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     56                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)) 
     57                    ); 
     58                    Py_INCREF(Py_None); 
     59                    ret = Py_None; 
     60                } else { 
     61                    ret = _py( fn( 
     62                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     63                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     64                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     65                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)) 
     66                    ) ); 
     67                } 
     68            } 
     69        } static if (MIN_ARGS <= 5 && MAX_ARGS >= 5) { 
     70            if (ARGS == 5) { 
     71                static if (is(RetType : void)) { 
     72                    fn( 
     73                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     74                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     75                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     76                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     77                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)) 
     78                    ); 
     79                    Py_INCREF(Py_None); 
     80                    ret = Py_None; 
     81                } else { 
     82                    ret = _py( fn( 
     83                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     84                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     85                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     86                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     87                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)) 
     88                    ) ); 
     89                } 
     90            } 
     91        } static if (MIN_ARGS <= 6 && MAX_ARGS >= 6) { 
     92            if (ARGS == 6) { 
     93                static if (is(RetType : void)) { 
     94                    fn( 
     95                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     96                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     97                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     98                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     99                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     100                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)) 
     101                    ); 
     102                    Py_INCREF(Py_None); 
     103                    ret = Py_None; 
     104                } else { 
     105                    ret = _py( fn( 
     106                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     107                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     108                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     109                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     110                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     111                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)) 
     112                    ) ); 
     113                } 
     114            } 
     115        } static if (MIN_ARGS <= 7 && MAX_ARGS >= 7) { 
     116            if (ARGS == 7) { 
     117                static if (is(RetType : void)) { 
     118                    fn( 
     119                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     120                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     121                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     122                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     123                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     124                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     125                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)) 
     126                    ); 
     127                    Py_INCREF(Py_None); 
     128                    ret = Py_None; 
     129                } else { 
     130                    ret = _py( fn( 
     131                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     132                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     133                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     134                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     135                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     136                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     137                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)) 
     138                    ) ); 
     139                } 
     140            } 
     141        } static if (MIN_ARGS <= 8 && MAX_ARGS >= 8) { 
     142            if (ARGS == 8) { 
     143                static if (is(RetType : void)) { 
     144                    fn( 
     145                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     146                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     147                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     148                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     149                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     150                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     151                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     152                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)) 
     153                    ); 
     154                    Py_INCREF(Py_None); 
     155                    ret = Py_None; 
     156                } else { 
     157                    ret = _py( fn( 
     158                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     159                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     160                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     161                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     162                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     163                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     164                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     165                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)) 
     166                    ) ); 
     167                } 
     168            } 
     169        } static if (MIN_ARGS <= 9 && MAX_ARGS >= 9) { 
     170            if (ARGS == 9) { 
     171                static if (is(RetType : void)) { 
     172                    fn( 
     173                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     174                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     175                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     176                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     177                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     178                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     179                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     180                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     181                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)) 
     182                    ); 
     183                    Py_INCREF(Py_None); 
     184                    ret = Py_None; 
     185                } else { 
     186                    ret = _py( fn( 
     187                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     188                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     189                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     190                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     191                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     192                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     193                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     194                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     195                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)) 
     196                    ) ); 
     197                } 
     198            } 
     199        } static if (MIN_ARGS <= 10 && MAX_ARGS >= 10) { 
     200            if (ARGS == 10) { 
     201                static if (is(RetType : void)) { 
     202                    fn( 
     203                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     204                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     205                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     206                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     207                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     208                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     209                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     210                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     211                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)), 
     212                        d_type!(ArgType!(fn_t, 10))(PyTuple_GetItem(args, 9)) 
     213                    ); 
     214                    Py_INCREF(Py_None); 
     215                    ret = Py_None; 
     216                } else { 
     217                    ret = _py( fn( 
     218                        d_type!(ArgType!(fn_t, 1))(PyTuple_GetItem(args, 0)), 
     219                        d_type!(ArgType!(fn_t, 2))(PyTuple_GetItem(args, 1)), 
     220                        d_type!(ArgType!(fn_t, 3))(PyTuple_GetItem(args, 2)), 
     221                        d_type!(ArgType!(fn_t, 4))(PyTuple_GetItem(args, 3)), 
     222                        d_type!(ArgType!(fn_t, 5))(PyTuple_GetItem(args, 4)), 
     223                        d_type!(ArgType!(fn_t, 6))(PyTuple_GetItem(args, 5)), 
     224                        d_type!(ArgType!(fn_t, 7))(PyTuple_GetItem(args, 6)), 
     225                        d_type!(ArgType!(fn_t, 8))(PyTuple_GetItem(args, 7)), 
     226                        d_type!(ArgType!(fn_t, 9))(PyTuple_GetItem(args, 8)), 
     227                        d_type!(ArgType!(fn_t, 10))(PyTuple_GetItem(args, 9)) 
     228                    ) ); 
     229                } 
    210230            } 
    211231        } 
  • trunk/test.py

    r7 r13  
    1919print 
    2020 
     21print "testdll.baz():" 
     22testdll.baz() 
     23print "testdll.baz(20):" 
     24testdll.baz(20) 
     25print "testdll.baz(30, 'cat'):" 
     26testdll.baz(30, 'cat') 
     27 
     28print 
     29 
    2130print '--------' 
    2231print 'SUCCESS' 
  • trunk/testdll.d

    r7 r13  
    2020} 
    2121 
     22void baz(int i=10, char[] s="moo") { 
     23    writefln("i = %s\ns = %s", i, s); 
     24} 
     25 
    2226extern (C) 
    2327export void inittestdll() { 
    2428    def!("bar", bar); 
    2529    def!("foo", foo); 
     30    // Minimum argument count. 
     31    def!("baz", baz, 0); 
    2632 
    2733    module_init("testdll"); 
  • trunk/testdll.map

    r7 r13  
    11 
    22 Start         Length     Name                   Class 
    3  0003:00000000 00012400H  _TEXT                  CODE 32-bit 
    4  0003:00012400 0000035AH  ICODE                  ICODE 32-bit 
     3 0003:00000000 00012740H  _TEXT                  CODE 32-bit 
     4 0003:00012740 00000360H  ICODE                  ICODE 32-bit 
    55 0004:00000000 00000004H  .CRT$XIA               DATA 32-bit 
    66 0004:00000010 00000004H  .CRT$XIZ               DATA 32-bit 
     
    1212 0004:00000070 00000004H  .CRT$XTZ               DATA 32-bit 
    1313 0004:00000074 00000000H  IMP__DATA              IMP__DATA 32-bit 
    14  0004:00000080 00007C40H  _DATA                  DATA 32-bit 
    15  0004:00007CC0 00000000H  FMB                    DATA 32-bit 
    16  0004:00007CC0 00000078H  FM                     DATA 32-bit 
    17  0004:00007D38 00000000H  FME                    DATA 32-bit 
    18  0004:00007D38 00000000H  XIB                    DATA 32-bit 
    19  0004:00007D38 00000018H  XI                     DATA 32-bit 
    20  0004:00007D50 00000000H  XIE                    DATA 32-bit 
    21  0004:00007D50 00000000H  XCB                    DATA 32-bit 
    22  0004:00007D50 00000010H  XC                     DATA 32-bit 
    23  0004:00007D60 00000000H  XCE                    DATA 32-bit 
    24  0004:00007D60 00000000H  XIFCB                  DATA 32-bit 
    25  0004:00007D60 00000004H  XIFU                   DATA 32-bit 
    26  0004:00007D64 00000000H  XIFL                   DATA 32-bit 
    27  0004:00007D64 00000004H  XIFM                   DATA 32-bit 
    28  0004:00007D68 00000000H  XIFCE                  DATA 32-bit 
    29  0004:00007D70 00000000H  CONST                  CONST 32-bit 
    30  0004:00007D70 00000000H  EEND                   ENDBSS 32-bit 
    31  0004:00007D70 00003278H  _BSS                   BSS 32-bit 
    32  0004:0000AFE8 00000000H  XOB                    BSS 32-bit 
    33  0004:0000AFE8 00000004H  XO                     BSS 32-bit 
    34  0004:0000AFEC 00000000H  XOE                    BSS 32-bit 
    35  0004:0000AFEC 00000000H  XOFB                   BSS 32-bit 
    36  0004:0000AFEC 00000108H  XOF                    BSS 32-bit 
    37  0004:0000B0F4 00000000H  XOFE                   BSS 32-bit 
    38  0004:0000B100 00000415H  c_common               BSS 32-bit 
    39  0004:0000B520 00000000H  STACK                  STACK 32-bit 
     14 0004:00000080 00007D20H  _DATA                  DATA 32-bit 
     15 0004:00007DA0 00000000H  FMB                    DATA 32-bit 
     16 0004:00007DA0 00000078H  FM                     DATA 32-bit 
     17 0004:00007E18 00000000H  FME                    DATA 32-bit 
     18 0004:00007E18 00000000H  XIB                    DATA 32-bit 
     19 0004:00007E18 00000018H  XI                     DATA 32-bit 
     20 0004:00007E30 00000000H  XIE                    DATA 32-bit 
     21 0004:00007E30 00000000H  XCB                    DATA 32-bit 
     22 0004:00007E30 00000010H  XC                     DATA 32-bit 
     23 0004:00007E40 00000000H  XCE                    DATA 32-bit 
     24 0004:00007E40 00000000H  XIFCB                  DATA 32-bit 
     25 0004:00007E40 00000004H  XIFU                   DATA 32-bit 
     26 0004:00007E44 00000000H  XIFL                   DATA 32-bit 
     27 0004:00007E44 00000004H  XIFM                   DATA 32-bit 
     28 0004:00007E48 00000000H  XIFCE                  DATA 32-bit 
     29 0004:00007E50 00000000H  CONST                  CONST 32-bit 
     30 0004:00007E50 00000000H  EEND                   ENDBSS 32-bit 
     31 0004:00007E50 00003288H  _BSS                   BSS 32-bit 
     32 0004:0000B0D8 00000000H  XOB                    BSS 32-bit 
     33 0004:0000B0D8 00000004H  XO                     BSS 32-bit 
     34 0004:0000B0DC 00000000H  XOE                    BSS 32-bit 
     35 0004:0000B0DC 00000000H  XOFB                   BSS 32-bit 
     36 0004:0000B0DC 00000108H  XOF                    BSS 32-bit 
     37 0004:0000B1E4 00000000H  XOFE                   BSS 32-bit 
     38 0004:0000B1F0 00000415H  c_common               BSS 32-bit 
     39 0004:0000B610 00000000H  STACK                  STACK 32-bit 
    4040 
    41 Program entry point at 0000D540  
     41Program entry point at 0000D874