View Ticket
2014-06-15
20:10 Closed ticket [2b566b4c81]: :cproc errors when given more than one argl argument plus 4 other changes artifact: 143b032a3c user: rkeene
20:10 Ticket [2b566b4c81]: 7 changes artifact: ad6d08b639 user: rkeene
2014-06-13
16:02 New ticket [2b566b4c81]. artifact: 821293e0ca user: anonymous

Ticket Hash: 2b566b4c81d33f2ec0cfa228966b5804d83c1a0c
Title: [tcc4tcl::cproc] errors when given more than one argl argument
Status: Closed Type: Documentation
Severity: Important Priority: Medium
Subsystem: Resolution: Not_A_Bug
Last Modified: 2014-06-15 20:10:47
Version Found In: 0.17
User Comments:
anonymous added on 2014-06-13 16:02:46:
Attempting to create a [tcc4tcl::cproc] with an argl greater than one errors with "invalid type".

% tcc4tcl::cproc add {int a, int b} int {return a+b;}
<string>:4: error: invalid type
compilation failed

The full error message:

<string>:4: error: invalid type
compilation failed
    while executing
"$tcc(cc) compile $code"
    (procedure "::tcc4tcl::cc" line 8)
    invoked from within
"::tcc4tcl::cc {
#include <tcl.h>
static int
c_add(int a,, int b) {
return a+b;}


int Cmd_N4__add (ClientData dummy,Tcl_Interp *ip,int objc,Tcl_Obj *C..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 [list ${ns}::cc $code]"
    (procedure "::tcc4tcl::ccommand" line 40)
    invoked from within
"::tcc4tcl::ccommand add {dummy ip objc objv} {  int _a,;
  int _b;
  int rv;
  if (objc != 3) {
    Tcl_WrongNumArgs(ip, 1, objv, "a, b");
    return ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 [list ${ns}::ccommand $name {dummy ip objc objv} $cbody]"
    (procedure "tcc4tcl::cproc" line 5)
    invoked from within
"tcc4tcl::cproc add {int a, int b} int {return a+b;}"
    (file "tcc.tcl" line 3)

Maybe something to do with c_add having more than one ',' between each argument? 

c_add(int a,, int b) {return a+b;}

rkeene added on 2014-06-15 20:10:22:
Format of arguments is poorly documented but should be without the comma (i.e., as a Tcl list):

tcc4tcl::cproc add {int a int b} int { return(a+b); }