/* ** read_mutex_counters */ static int test_read_mutex_counters( object clientdata, Tcl_Interp interp, int objc, Tcl_Obj[] objv ) { Tcl_Obj pRet; int ii; string[] aName = new string[] { "fast", "recursive", "static_master", "static_mem", "static_open", "static_prng", "static_lru", "static_pmem" }; if (objc != 1) { TCL.Tcl_WrongNumArgs(interp, 1, objv, ""); return(TCL.TCL_ERROR); } pRet = TCL.Tcl_NewObj(); TCL.Tcl_IncrRefCount(pRet); for (ii = 0; ii < 8; ii++) { TCL.Tcl_ListObjAppendElement(interp, pRet, TCL.Tcl_NewStringObj(aName[ii], -1)); TCL.Tcl_ListObjAppendElement(interp, pRet, TCL.Tcl_NewIntObj(g.aCounter[ii])); } TCL.Tcl_SetObjResult(interp, pRet); TCL.Tcl_DecrRefCount(ref pRet); return(TCL.TCL_OK); }
/* ** Returns 1 if data is ready, or 0 if not. */ static int next2(Tcl_Interp interp, tclvar_cursor pCur, Tcl_Obj pObj) { Tcl_Obj p; if (pObj != null) { if (null == pCur.pList2) { p = TCL.Tcl_NewStringObj("array names", -1); TCL.Tcl_IncrRefCount(p); TCL.Tcl_ListObjAppendElement(null, p, pObj); TCL.Tcl_EvalObjEx(interp, p, TCL.TCL_EVAL_GLOBAL); TCL.Tcl_DecrRefCount(ref p); pCur.pList2 = TCL.Tcl_GetObjResult(interp); TCL.Tcl_IncrRefCount(pCur.pList2); Debug.Assert(pCur.i2 == 0); } else { int n = 0; pCur.i2++; TCL.Tcl_ListObjLength(null, pCur.pList2, out n); if (pCur.i2 >= n) { TCL.Tcl_DecrRefCount(ref pCur.pList2); pCur.pList2 = null; pCur.i2 = 0; return(0); } } } return(1); }
static int tclvarFilter( sqlite3_vtab_cursor pVtabCursor, int idxNum, string idxStr, int argc, sqlite3_value[] argv ) { tclvar_cursor pCur = (tclvar_cursor )pVtabCursor; Tcl_Interp interp = ((tclvar_vtab )(pVtabCursor.pVtab)).interp; Tcl_Obj p = TCL.Tcl_NewStringObj("info vars", -1); TCL.Tcl_IncrRefCount(p); Debug.Assert(argc == 0 || argc == 1); if (argc == 1) { Tcl_Obj pArg = TCL.Tcl_NewStringObj((string)sqlite3_value_text(argv[0]), -1); TCL.Tcl_ListObjAppendElement(null, p, pArg); } TCL.Tcl_EvalObjEx(interp, p, TCL.TCL_EVAL_GLOBAL); if (pCur.pList1 != null) { TCL.Tcl_DecrRefCount(ref pCur.pList1); } if (pCur.pList2 != null) { TCL.Tcl_DecrRefCount(ref pCur.pList2); pCur.pList2 = null; } pCur.i1 = 0; pCur.i2 = 0; pCur.pList1 = TCL.Tcl_GetObjResult(interp); TCL.Tcl_IncrRefCount(pCur.pList1); Debug.Assert(pCur.i1 == 0 && pCur.i2 == 0 && pCur.pList2 == null); TCL.Tcl_DecrRefCount(ref p); return(tclvarNext(pVtabCursor)); }