Nice example about the "inefficiently" of the tcl "c" api.

Liste des GroupesRevenir à cl tcl 
Sujet : Nice example about the "inefficiently" of the tcl "c" api.
De : aotto1968 (at) *nospam* t-online.de (aotto1968)
Groupes : comp.lang.tcl
Date : 06. Sep 2024, 21:36:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vbfp4d$utpf$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
Down is the "C" code of the C-Function to test the an "object" to be valid.
1. in "python"
bool MK(TestObject) (
   PyObject      * pyO,
   PyTypeObject  * typeO,
   MK_OBJ        * objP,
   MkTestClassE  * flagP
) {
   MkTestClassE flag = MkTestClassE_NONE_OBJECT;
   MK_OBJ obj = NULL;
   if (pyO == Py_None)   {
     flag=MkTestClassE_NULL; goto end;
   }
   if (!PyObject_TypeCheck(pyO,typeO))   {
     flag=MkTestClassE_WRONG_CLASS; goto end;
   }
   MK_MNG      objM = VAL2MNG(pyO);
   if (objM == NULL)   { flag=MkTestClassE_NULL     ; goto end; };
   obj = MkObj(objM);
   if (obj == NULL)    { flag=MkTestClassE_INVALID_SIGNATURE  ; goto end; };
   flag = MkTestClassE_OK;
end:
   if (flagP)  *flagP = flag;
   if (objP)   *objP = obj;
   switch(flag) {
     case MkTestClassE_NONE_OBJECT : return false;
     default                       : return true;
   }
}
2. same in "Tcl"
( tcl "C"-Api has "no" function to test if an object has an "given" type etc. )
bool MK(TestObject) (
   OT_Prefix_ARGS
   Tcl_Obj       * tclO,
   MK_OBJ        * objP,
   MkTestClassE  * flagP
) {
   MkTestClassE flag = MkTestClassE_NONE_OBJECT;
   int len=0;
   MK_STRN str = Tcl_GetStringFromObj(tclO,&len);
   if (len == 0 || MkStringIsNULL(MkStringCreate(len,str))) {
     flag=MkTestClassE_NULL; goto end;
   }
   Tcl_Object tclObj = Tcl_GetObjectFromObj (interp, tclO);
   if (tclObj == NULL)   {
     Tcl_ResetResult(interp);
     flag=MkTestClassE_NONE_OBJECT; goto end;
   };
   objM = Tcl_ObjectGetMetadata(tclObj, &MK(AtomMeta));
   /* NULL or wrong class etc */
   if (objM == NULL)   { flag=MkTestClassE_NULL     ; goto end; };
   objM = MkObj(objM);
   if (objM == NULL)   { flag=MkTestClassE_INVALID_SIGNATURE  ; goto end; };
   flag = MkTestClassE_OK;
   if (objP)   *objP = objM;
end:
   if (flagP)  *flagP = flag;
   switch(flag) {
     case MkTestClassE_NONE_OBJECT : return false;
     default                       : return true;
   }
}

Date Sujet#  Auteur
13 Aug 24 * tcl versa python regarding performance41aotto1968
13 Aug 24 +* Re: tcl versa python regarding performance5undroidwish
14 Aug 24 i+* Re: tcl versa python regarding performance3aotto1968
14 Aug 24 ii`* Re: tcl versa python regarding performance2aotto1968
15 Aug 24 ii `- Re: tcl versa python regarding performance1aotto1968
15 Aug 24 i`- Re: tcl versa python regarding performance1Alan Grunwald
15 Aug 24 +* Re: tcl versa python regarding performance15aotto1968
15 Aug 24 i+* Re: tcl versa python regarding performance10aotto1968
15 Aug 24 ii`* Re: tcl versa python regarding performance9aotto1968
15 Aug 24 ii +- Re: tcl versa python regarding performance1aotto1968
16 Aug 24 ii `* Re: tcl versa python regarding performance7saito
16 Aug 24 ii  `* Re: tcl versa python regarding performance6aotto1968
16 Aug 24 ii   `* Re: tcl versa python regarding performance5saito
16 Aug 24 ii    `* Re: tcl versa python regarding performance4aotto1968
17 Aug 24 ii     `* Re: tcl versa python regarding performance3undroidwish
17 Aug 24 ii      `* Re: tcl versa python regarding performance2aotto1968
17 Aug 24 ii       `- Re: tcl versa python regarding performance1undroidwish
15 Aug 24 i`* Re: tcl versa python regarding performance4aotto1968
16 Aug 24 i `* Re: tcl versa python regarding performance3Christian Gollwitzer
16 Aug 24 i  +- Re: tcl versa python regarding performance1undroidwish
16 Aug 24 i  `- Re: tcl versa python regarding performance1aotto1968
16 Aug 24 +- Re: tcl versa python regarding performance1aotto1968
18 Aug 24 +* Re: tcl versa python regarding performance3aotto1968
18 Aug 24 i`* Re: tcl versa python regarding performance2et99
19 Aug 24 i `- Re: tcl versa python regarding performance1aotto1968
24 Aug 24 +- Re: tcl versa python regarding performance1aotto1968
26 Aug 24 +- Re: tcl versa python regarding performance1aotto1968
6 Sep 24 +- update ...1aotto1968
6 Sep 24 +* Nice example about the "inefficiently" of the tcl "c" api.10aotto1968
8 Sep 24 i`* Re: Nice example about the "inefficiently" of the tcl "c" api.9undroidwish
8 Sep 24 i +* Re: Nice example about the "inefficiently" of the tcl "c" api.7Christian Gollwitzer
9 Sep 24 i i`* Re: Nice example about the "inefficiently" of the tcl "c" api.6aotto1968
9 Sep 24 i i `* Re: Nice example about the "inefficiently" of the tcl "c" api.5undroidwish
9 Sep 24 i i  `* Re: Nice example about the "inefficiently" of the tcl "c" api.4aotto1968
9 Sep 24 i i   `* Re: Nice example about the "inefficiently" of the tcl "c" api.3undroidwish
9 Sep 24 i i    `* Re: Nice example about the "inefficiently" of the tcl "c" api.2aotto1968
9 Sep 24 i i     `- Re: Nice example about the "inefficiently" of the tcl "c" api.1undroidwish
9 Sep 24 i `- Re: Nice example about the "inefficiently" of the tcl "c" api.1aotto1968
10 Sep 24 +- build a perfserver distribution1aotto1968
11 Sep 24 `* Re: tcl versa python regarding performance2aotto1968
11 Sep 24  `- Re: tcl versa python regarding performance1aotto1968

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal