Re: what happen to tcl C api ?

Liste des GroupesRevenir à cl tcl 
Sujet : Re: what happen to tcl C api ?
De : aotto1968 (at) *nospam* t-online.de (aotto1968)
Groupes : comp.lang.tcl
Date : 19. Jan 2025, 10:59:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vmiie1$24c6l$2@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
below is the code used for testing:
MOX_ ... is the internal name from me for various tcl api-types
RL_ ... is a helper to build the objc/objv array to finally call the Tcl_EvalObjv api-command
int NS(_IncrIndex1) (OBJCMD_ARGS) {
   MOX_SETUP_hdl_static;
   if (objc < (1+__skip) || objc > (2+__skip)) {
     Tcl_WrongNumArgs(interp,__skip,objv,"... expect: varName ?increment?");
     return TCL_ERROR;
   }
   MOX_OBJ_T varNameO  = objv[__skip++];
   MOX_OBJ_T incrO     = __skip < objc ? objv[__skip++] : NULL;
   int incrI=1;
   if (incrO) {
     if (Tcl_GetIntFromObj(interp,incrO,&incrI) == TCL_ERROR) return TCL_ERROR;
   }
   MOX_OBJ_T varO  = Tcl_ObjGetVar2(interp,varNameO,NULL,TCL_LEAVE_ERR_MSG);
     if (varO == NULL) return TCL_ERROR;
   int varI;
   if (Tcl_GetIntFromObj(interp,varO,&varI) == TCL_ERROR) return TCL_ERROR;
   MOX_OBJ_T newO = Tcl_ObjSetVar2(interp,varNameO,NULL, Tcl_NewIntObj(varI+incrI), TCL_LEAVE_ERR_MSG);
     if (newO== NULL) return TCL_ERROR;
   Tcl_SetObjResult(interp,newO);
   return TCL_OK;
};
MoxObjDelete(_IncrIndex1);
int NS(_IncrIndex2) (OBJCMD_ARGS) {
   MOX_SETUP_hdl_static;
   if (objc < (1+__skip) || objc > (2+__skip)) {
     Tcl_WrongNumArgs(interp,__skip,objv,"... expect: varName ?increment?");
     return TCL_ERROR;
   }
   if (objc == 2) {
     RL_init( 2, RL_NewS(0,"incr") ) ; RL_O(1,objv[1]) ;
     return RL_EvalEx(TCL_LEAVE_ERR_MSG);
   } else {
     RL_init( 3, RL_NewS(0,"incr") ) ; RL_O(1,objv[1]) ; RL_O(2,objv[2]) ;
     return RL_EvalEx(TCL_LEAVE_ERR_MSG);
   }
};
MoxObjDelete(_IncrIndex2);

Date Sujet#  Auteur
19 Jan 25 * what happen to tcl C api ?3aotto1968
19 Jan 25 +- Re: what happen to tcl C api ?1aotto1968
22 Feb 25 `- Re: what happen to tcl C api ?1Martin (m0h)

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal