• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Tcl_Obj类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Tcl_Obj的典型用法代码示例。如果您正苦于以下问题:C# Tcl_Obj类的具体用法?C# Tcl_Obj怎么用?C# Tcl_Obj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tcl_Obj类属于命名空间,在下文中一共展示了Tcl_Obj类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: c_collation_test

    /*
    ** 2007 March 29
    **
    ** The author disclaims copyright to this source code.  In place of
    ** a legal notice, here is a blessing:
    **
    **    May you do good and not evil.
    **    May you find forgiveness for yourself and forgive others.
    **    May you share freely, never taking more than you give.
    **
    *************************************************************************
    **
    ** This file contains obscure tests of the C-interface required
    ** for completeness. Test code is written in C for these cases
    ** as there is not much point in binding to Tcl.
    *************************************************************************
    **  Included in SQLite3 port to C#-SQLite;  2008 Noah B Hart
    **  C#-SQLite is an independent reimplementation of the SQLite software library
    **
    **  SQLITE_SOURCE_ID: 2010-08-23 18:52:01 42537b60566f288167f1b5864a5435986838e3a3
    **
    *************************************************************************
    */
    //#include "sqliteInt.h"
    //#include "tcl.h"
    //#include <stdlib.h>
    //#include <string.h>

    /*
    ** c_collation_test
    */
    static int c_collation_test(
    object clientdata, /* Pointer to sqlite3_enable_XXX function */
    Tcl_Interp interp,    /* The TCL interpreter that invoked this command */
    int objc,              /* Number of arguments */
    Tcl_Obj[] objv  /* Command arguments */
    )
    {
      string zErrFunction = "N/A";
      sqlite3 db = null;

      int rc;
      if ( objc != 1 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "" );
        return TCL.TCL_ERROR;
      }

      /* Open a database. */
      rc = sqlite3_open( ":memory:", out db );
      if ( rc != SQLITE_OK )
      {
        zErrFunction = "sqlite3_open";
        goto error_out;
      }

      rc = sqlite3_create_collation( db, "collate", 456, null, null );
      if ( rc != SQLITE_MISUSE )
      {
        sqlite3_close( db );
        zErrFunction = "sqlite3_create_collation";
        goto error_out;
      }

      sqlite3_close( db );
      return TCL.TCL_OK;

error_out:
      TCL.Tcl_ResetResult( interp );
      TCL.Tcl_AppendResult( interp, "Error testing function: ", zErrFunction, null );
      return TCL.TCL_ERROR;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:72,代码来源:test9_c.cs


示例2: next2

/*
** 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;
}
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:33,代码来源:test_tclvar_c.cs


示例3: register_echo_module

 /*
 ** Register the echo virtual table module.
 */
 static int register_echo_module(
   ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
   Tcl_Interp interp,    /* The TCL interpreter that invoked this command */
   int objc,              /* Number of arguments */
   Tcl_Obj[] objv  /* Command arguments */
 )
 {
   sqlite3 db = null;
   ;
   ;
   EchoModule pMod;
   if ( objc != 2 )
   {
     TCL.Tcl_WrongNumArgs( interp, 1, objv, "DB" );
     return TCL.TCL_ERROR;
   }
   if ( getDbPointer( interp, TCL.Tcl_GetString( objv[1] ), out db ) != 0 )
     return TCL.TCL_ERROR;
   pMod = new EchoModule();//sqlite3_malloc(sizeof(EchoModule));
   pMod.interp = interp;
   sqlite3_create_module_v2( db, "echo", echoModule, pMod, moduleDestroy );
   return TCL.TCL_OK;
 }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:26,代码来源:test8_c.cs


示例4: backupTestInit

    /*
    **     sqlite3_backup CMDNAME DESTHANDLE DESTNAME SRCHANDLE SRCNAME
    **
    */
    static int backupTestInit(
    ClientData clientData,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      sqlite3_backup pBackup;
      sqlite3 pDestDb = null;
      sqlite3 pSrcDb = null;
      string zDestName;
      string zSrcName;
      string zCmd;

      if ( objc != 6 )
      {
        TCL.Tcl_WrongNumArgs(
        interp, 1, objv, "CMDNAME DESTHANDLE DESTNAME SRCHANDLE SRCNAME"
        );
        return TCL.TCL_ERROR;
      }

      zCmd = TCL.Tcl_GetString( objv[1] );
      getDbPointer( interp, TCL.Tcl_GetString( objv[2] ), ref pDestDb );
      zDestName = TCL.Tcl_GetString( objv[3] );
      getDbPointer( interp, TCL.Tcl_GetString( objv[4] ), ref pSrcDb );
      zSrcName = TCL.Tcl_GetString( objv[5] );

      pBackup = sqlite3_backup_init( pDestDb, zDestName, pSrcDb, zSrcName );
      if ( null == pBackup )
      {
        TCL.Tcl_AppendResult( interp, "sqlite3_backup_init() failed" );
        return TCL.TCL_ERROR;
      }

      TCL.Tcl_CreateObjCommand( interp, zCmd, (Interp.dxObjCmdProc)backupTestCmd, pBackup, (Interp.dxCmdDeleteProc)backupTestFinish );
      TCL.Tcl_SetObjResult( interp, objv[1] );
      return TCL.TCL_OK;
    }
开发者ID:mbahar94,项目名称:fracture,代码行数:43,代码来源:test_backup_c.cs


示例5: test_intarray_bind

    /*
    **    sqlite3_intarray_bind  INTARRAY  ?VALUE ...?
    **
    ** Invoke the sqlite3_intarray_bind interface on the given array of integers.
    */
    static int test_intarray_bind(
      ClientData clientData, /* Not used */
      Tcl_Interp interp,     /* The TCL interpreter that invoked this command */
      int objc,              /* Number of arguments */
      Tcl_Obj[] objv         /* Command arguments */
    )
    {
      sqlite3_intarray pArray;
      int rc = SQLITE_OK;
      int i, n;
      sqlite3_int64[] a;

      if ( objc < 2 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "INTARRAY" );
        return TCL.TCL_ERROR;
      }
      pArray = (sqlite3_intarray)sqlite3TestTextToPtr( interp, TCL.Tcl_GetString( objv[1] ) );
      n = objc - 2;
#if !SQLITE_OMIT_VIRTUALTABLE
      a = new sqlite3_int64[n];//sqlite3_malloc( sizeof(a[0])*n );
      //if( a==0 ){
      //  Tcl_AppendResult(interp, "SQLITE_NOMEM", (char*)0);
      //  return TCL_ERROR;
      //}
      for ( i = 0; i < n; i++ )
      {
        //a[i] = 0;
        TCL.Tcl_GetWideIntFromObj( null, objv[i + 2], out a[i] );
      }
      rc = sqlite3_intarray_bind( pArray, n, a, sqlite3_free );
      if ( rc != SQLITE_OK )
      {
        TCL.Tcl_AppendResult( interp, sqlite3TestErrorName( rc ), null );
        return TCL.TCL_ERROR;
      }
#endif
      return TCL.TCL_OK;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:44,代码来源:test_intarray_c.cs


示例6: tvfsExecTcl

static void tvfsExecTcl(
  Testvfs p, 
  string zMethod,
  Tcl_Obj arg1,
  Tcl_Obj arg2,
  Tcl_Obj arg3
){
  int rc;                         /* Return code from Tcl_EvalObj() */
  Tcl_Obj pEval;
  Debug.Assert( p.pScript!=null );

  Debug.Assert( zMethod != null );
  Debug.Assert( p != null );
  Debug.Assert( arg2 == null || arg1 != null );
  Debug.Assert( arg3 == null || arg2 != null );

  pEval = TCL.Tcl_DuplicateObj(p.pScript);
  TCL.Tcl_IncrRefCount(p.pScript);
  TCL.Tcl_ListObjAppendElement( p.interp, pEval, TCL.Tcl_NewStringObj( zMethod, -1 ) );
  if ( arg1!=null )
    TCL.Tcl_ListObjAppendElement( p.interp, pEval, arg1 );
  if ( arg2 !=null )
    TCL.Tcl_ListObjAppendElement( p.interp, pEval, arg2 );
  if ( arg3 != null )
    TCL.Tcl_ListObjAppendElement( p.interp, pEval, arg3 );

  rc = TCL.Tcl_EvalObjEx(p.interp, pEval, TCL.TCL_EVAL_GLOBAL);
  if ( rc != TCL.TCL_OK )
  {
    TCL.Tcl_BackgroundError( p.interp );
    TCL.Tcl_ResetResult( p.interp );
  }
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:33,代码来源:test_vfs_c.cs


示例7: md5file_cmd

    /*
    ** A TCL command to take the md5 hash of a file.  The argument is the
    ** name of the file.
    */
    static int md5file_cmd( object cd, Tcl_Interp interp, int argc, Tcl_Obj[] argv )
    {
      StreamReader _in = null;
      byte[] digest = new byte[16];
      StringBuilder zBuf = new StringBuilder( 10240 );

      if ( argc != 2 )
      {
        TCL.Tcl_AppendResult( interp, "wrong # args: should be \"", argv[0],
        " FILENAME\"", 0 );
        return TCL.TCL_ERROR;
      }
      Debugger.Break(); // TODO --   _in = fopen( argv[1], "rb" );
      if ( _in == null )
      {
        TCL.Tcl_AppendResult( interp, "unable to open file \"", argv[1],
        "\" for reading", 0 );
        return TCL.TCL_ERROR;
      }
      Debugger.Break(); // TODO
      //MD5Init( ctx );
      //for(;;){
      //  int n;
      //  n = fread(zBuf, 1, zBuf.Capacity, _in);
      //  if( n<=0 ) break;
      //  MD5Update(ctx, zBuf.ToString(), (unsigned)n);
      //}
      //fclose(_in);
      //MD5Final(digest, ctx);
      //  DigestToBase16(digest, zBuf);
      //Tcl_AppendResult( interp, zBuf );
      return TCL.TCL_OK;
    }
开发者ID:mbahar94,项目名称:fracture,代码行数:37,代码来源:test_md5_c.cs


示例8: utf8_to_utf8

 /*
 ** USAGE:  utf8_to_utf8  HEX
 **
 ** The argument is a UTF8 string represented _in hexadecimal.
 ** The UTF8 might not be well-formed.  Run this string through
 ** sqlite3Utf8to8() convert it back to hex and return the result.
 */
 static int utf8_to_utf8(
 object clientdata,
 Tcl_Interp interp,
 int objc,
 Tcl_Obj[] objv
 ){
 #if SQLITE_DEBUG
   int n = 0;
   int nOut;
   string zOrig;
   byte[] z;
   if( objc!=2 ){
     TCL.Tcl_WrongNumArgs(interp, 1, objv, "HEX");
     return TCL.TCL_ERROR;
   }
   zOrig = TCL.Tcl_GetStringFromObj(objv[1], out n);
   z = new byte[2 * n + 1];//sqlite3Malloc( n + 3 );
   nOut = sqlite3TestHexToBin( zOrig, n, z );
   //z[n] = 0;
   nOut = sqlite3Utf8To8(z);
   sqlite3TestBinToHex( z, zOrig.Length );
   TCL.Tcl_AppendResult(interp, Encoding.ASCII.GetString(z,0,n));
   //sqlite3_free( z );
   return TCL.TCL_OK;
 #else
   Tcl_AppendResult(interp, 
       "[utf8_to_utf8] unavailable - SQLITE_DEBUG not defined", 0
   );
   return TCL.TCL_ERROR;
 #endif
 }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:38,代码来源:test_hexio_c.cs


示例9: autoinstall_test_funcs

 /*
 ** TCLCMD:  autoinstall_test_functions
 **
 ** Invoke this TCL command to use sqlite3_auto_extension() to cause
 ** the standard set of test functions to be loaded into each new
 ** database connection.
 */
 static int autoinstall_test_funcs(
 object clientdata,
 Tcl_Interp interp,
 int objc,
 Tcl_Obj[] objv
 )
 {
   //extern int Md5_Register(sqlite3);
   int rc = sqlite3_auto_extension( (dxInit)registerTestFunctions );
   if ( rc == SQLITE_OK )
   {
     rc = sqlite3_auto_extension( (dxInit)Md5_Register );
   }
   TCL.Tcl_SetObjResult( interp, TCL.Tcl_NewIntObj( rc ) );
   return TCL.TCL_OK;
 }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:23,代码来源:test_func_c.cs


示例10: hexio_get_int

    /*
    ** USAGE:   hexio_get_int   HEXDATA
    **
    ** Interpret the HEXDATA argument as a big-endian integer.  Return
    ** the value of that integer.  HEXDATA can contain between 2 and 8
    ** hexadecimal digits.
    */
    static int hexio_get_int(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      int val;
      int nIn = 0, nOut;
      string zIn;
      byte[] aOut;
      byte[] aNum = new byte[4];

      if ( objc != 2 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "HEXDATA" );
        return TCL.TCL_ERROR;
      }
      zIn = TCL.Tcl_GetStringFromObj( objv[1], out nIn );
      aOut = new byte[nIn / 2];// sqlite3Malloc( nIn / 2 );
      if ( aOut == null )
      {
        return TCL.TCL_ERROR;
      }
      nOut = sqlite3TestHexToBin( zIn, nIn, aOut );
      if ( nOut >= 4 )
      {
        aNum[0] = aOut[0]; // memcpy( aNum, aOut, 4 );
        aNum[1] = aOut[1];
        aNum[2] = aOut[2];
        aNum[3] = aOut[3];
      }
      else
      {
        //memset(aNum, 0, sizeof(aNum));
        //memcpy(&aNum[4-nOut], aOut, nOut);
        aNum[4 - nOut] = aOut[0];
        if ( nOut > 1 )
          aNum[4 - nOut + 1] = aOut[1];
        if ( nOut > 2 )
          aNum[4 - nOut + 2] = aOut[2];
        if ( nOut > 3 )
          aNum[4 - nOut + 3] = aOut[3];
      }
      aOut = null;// sqlite3DbFree( db, ref aOut );
      val = ( aNum[0] << 24 ) | ( aNum[1] << 16 ) | ( aNum[2] << 8 ) | aNum[3];
      TCL.Tcl_SetObjResult( interp, TCL.Tcl_NewIntObj( val ) );
      return TCL.TCL_OK;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:56,代码来源:test_hexio_c.cs


示例11: hexio_render_int32

    /*
    ** USAGE:   hexio_render_int32   INTEGER
    **
    ** Render INTEGER has a 32-bit big-endian integer _in hexadecimal.
    */
    static int hexio_render_int32(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      int val = 0;
      byte[] aNum = new byte[10];

      if ( objc != 2 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "INTEGER" );
        return TCL.TCL_ERROR;
      }
      if ( TCL.TCL_OK != TCL.Tcl_GetIntFromObj( interp, objv[1], out val ) )
        return TCL.TCL_ERROR;
      aNum[0] = (byte)( val >> 24 );
      aNum[1] = (byte)( val >> 16 );
      aNum[2] = (byte)( val >> 8 );
      aNum[3] = (byte)val;
      sqlite3TestBinToHex( aNum, 4 );
      TCL.Tcl_SetObjResult( interp, TCL.Tcl_NewStringObj( aNum, 8 ) );
      return TCL.TCL_OK;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:30,代码来源:test_hexio_c.cs


示例12: hexio_write

    /*
    ** Usage:   hexio_write  FILENAME  OFFSET  DATA
    **
    ** Write DATA into file FILENAME beginning at OFFSET from the
    ** beginning of the file.  DATA is expressed _in hexadecimal.
    */
    static int hexio_write(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      int offset = 0;
      int nIn = 0, nOut, written;
      string zFile;
      string zIn;
      byte[] aOut;
      FileStream _out;

      if ( objc != 4 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "FILENAME OFFSET HEXDATA" );
        return TCL.TCL_ERROR;
      }
      if ( TCL.TCL_OK != TCL.Tcl_GetIntFromObj( interp, objv[2], out offset ) )
        return TCL.TCL_ERROR;
      zFile = TCL.Tcl_GetString( objv[1] );
      zIn = TCL.Tcl_GetStringFromObj( objv[3], out nIn );
      aOut = new byte[nIn / 2 + 1];//sqlite3Malloc( nIn/2 );
      if ( aOut == null )
      {
        return TCL.TCL_ERROR;
      }
      nOut = sqlite3TestHexToBin( zIn, nIn, aOut );
      _out = new FileStream( zFile, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite );// fopen( zFile, "r+b" );
      //if( _out==0 ){
      //  _out = fopen(zFile, "r+");
      //}
      if ( _out == null )
      {
        TCL.Tcl_AppendResult( interp, "cannot open output file ", zFile );
        return TCL.TCL_ERROR;
      }
      _out.Seek( offset, SeekOrigin.Begin );// fseek( _out, offset, SEEK_SET );
      written = (int)_out.Position;
      _out.Write( aOut, 0, nOut );// written = fwrite( aOut, 1, nOut, _out );
      written = (int)_out.Position - written;
      aOut = null;// sqlite3DbFree( db, ref aOut );
      _out.Flush();
      _out.Close();// fclose( _out );
      TCL.Tcl_SetObjResult( interp, TCL.Tcl_NewIntObj( written ) );
      return TCL.TCL_OK;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:54,代码来源:test_hexio_c.cs


示例13: hexio_read

    /*
    ** Usage:   hexio_read  FILENAME  OFFSET  AMT
    **
    ** Read AMT bytes from file FILENAME beginning at OFFSET from the
    ** beginning of the file.  Convert that information to hexadecimal
    ** and return the resulting HEX string.
    */
    static int hexio_read(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      int offset = 0;
      int amt = 0, got;
      string zFile;
      byte[] zBuf;
      FileStream _in;

      if ( objc != 4 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "FILENAME OFFSET AMT" );
        return TCL.TCL_ERROR;
      }
      if ( TCL.TCL_OK != TCL.Tcl_GetIntFromObj( interp, objv[2], out offset ) )
        return TCL.TCL_ERROR;
      if ( TCL.TCL_OK != TCL.Tcl_GetIntFromObj( interp, objv[3], out amt ) )
        return TCL.TCL_ERROR;
      zFile = TCL.Tcl_GetString( objv[1] );
      zBuf = new byte[amt * 2 + 1];// sqlite3Malloc( amt * 2 + 1 );
      if ( zBuf == null )
      {
        return TCL.TCL_ERROR;
      }
      _in = new FileStream( zFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
      //if( _in==null){
      //  _in = fopen(zFile, "r");
      //}
      if ( _in == null )
      {
        TCL.Tcl_AppendResult( interp, "cannot open input file ", zFile );
        return TCL.TCL_ERROR;
      }
      _in.Seek( offset, SeekOrigin.Begin ); //fseek(_in, offset, SEEK_SET);
      got = _in.Read( zBuf, 0, amt ); // got = fread( zBuf, 1, amt, _in );
      _in.Flush();
      _in.Close();// fclose( _in );
      if ( got < 0 )
      {
        got = 0;
      }
      sqlite3TestBinToHex( zBuf, got );
      TCL.Tcl_AppendResult( interp, System.Text.Encoding.UTF8.GetString( zBuf, 0, zBuf.Length ).Substring( 0, got * 2 ) );
      zBuf = null;// sqlite3DbFree( db, ref zBuf );
      return TCL.TCL_OK;
    }
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:57,代码来源:test_hexio_c.cs


示例14: register_tclvar_module

/*
** Decode a pointer to an sqlite3 object.
*/
//extern int getDbPointer(Tcl_Interp *interp, string zA, sqlite3 **ppDb);

/*
** Register the echo virtual table module.
*/
static int register_tclvar_module(
  ClientData clientData,/* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp interp,    /* The TCL interpreter that invoked this command */
  int objc,             /* Number of arguments */
  Tcl_Obj[] objv        /* Command arguments */
){
  sqlite3 db=null;
  if( objc!=2 ){
    TCL.Tcl_WrongNumArgs(interp, 1, objv, "DB");
    return TCL.TCL_ERROR;
  }
  if( getDbPointer(interp, TCL.Tcl_GetString(objv[1]), out db) !=0) return TCL.TCL_ERROR;
#if !SQLITE_OMIT_VIRTUALTABLE
  sqlite3_create_module(db, "tclvar", tclvarModule, interp);
#endif
  return TCL.TCL_OK;
}
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:25,代码来源:test_tclvar_c.cs


示例15: testvfs_obj_cmd

static int testvfs_obj_cmd(
  ClientData cd,
  Tcl_Interp interp,
  int objc,
  Tcl_Obj[] objv
){
  Debugger.Break();//TODO
//  Testvfs p = (Testvfs)cd;

// TestvfsSubcmd[] aSubcmd = new TestvfsSubcmd[]  {
//    new TestvfsSubcmd( "shm",         DB_enum_CMD.CMD_SHM         ),
//    new TestvfsSubcmd( "delete",      DB_enum_CMD.CMD_DELETE      ),
//    new TestvfsSubcmd( "filter",      DB_enum_CMD.CMD_FILTER      ),
//    new TestvfsSubcmd( "ioerr",       DB_enum_CMD.CMD_IOERR       ),
//    new TestvfsSubcmd( "fullerr",     DB_enum_CMD.CMD_FULLERR     ),
//    new TestvfsSubcmd( "cantopenerr", DB_enum_CMD.CMD_CANTOPENERR ),
//    new TestvfsSubcmd( "script",      DB_enum_CMD.CMD_SCRIPT      ),
//    new TestvfsSubcmd( "devchar",     DB_enum_CMD.CMD_DEVCHAR     ),
//    new TestvfsSubcmd( "sectorsize",  DB_enum_CMD.CMD_SECTORSIZE  ),
//    new TestvfsSubcmd( 0, 0 )
//  };
//  int i=0;
  
//  if( objc<2 ){
//    TCL.Tcl_WrongNumArgs( interp, 1, objv, "SUBCOMMAND ..." );
//    return TCL.TCL_ERROR;
//  }
//  if ( TCL.Tcl_GetIndexFromObjStruct(
//        interp, objv[1], aSubcmd, aSubcmd.Length, "subcommand", 0, ref i) 
//  ){
//    return TCL.TCL_ERROR;
//  }
//  TCL.Tcl_ResetResult( interp );

//  switch( aSubcmd[i].eCmd ){
//    case DB_enum_CMD.CMD_SHM: {
//      Tcl_Obj pObj;
//      int i;
//      TestvfsBuffer pBuffer;
//      string zName;
//      if( objc!=3 && objc!=4 ){
//        TCL.Tcl_WrongNumArgs( interp, 2, objv, "FILE ?VALUE?" );
//        return TCL.TCL_ERROR;
//      }
//      zName = ckalloc(p.pParent.mxPathname);
//      p.pParent.xFullPathname(
//          p.pParent, TCL.Tcl_GetString(objv[2]), 
//          p.pParent.mxPathname, zName
//      );
//      for(pBuffer=p.pBuffer; pBuffer; pBuffer=pBuffer.pNext){
//        if( 0==strcmp(pBuffer.zFile, zName) ) break;
//      }
//      ckfree(zName);
//      if( null==pBuffer ){
//        TCL.Tcl_AppendResult( interp, "no such file: ", TCL.Tcl_GetString( objv[2] ), 0 );
//        return TCL.TCL_ERROR;
//      }
//      if( objc==4 ){
//        int n;
//        u8 *a = TCL.Tcl_GetByteArrayFromObj(objv[3], &n);
//        int pgsz = pBuffer.pgsz;
//        if( pgsz==0 ) pgsz = 65536;
//        for(i=0; ipgsz<n; i++){
//          int nByte = pgsz;
//          tvfsAllocPage(pBuffer, i, pgsz);
//          if( n-ipgsz<pgsz ){
//            nByte = n;
//          }
//          memcpy(pBuffer.aPage[i], &a[ipgsz], nByte);
//        }
//      }

//      pObj = TCL.Tcl_NewObj();
//      for(i=0; pBuffer.aPage[i]!=null; i++){
//        int pgsz = pBuffer.pgsz;
//        if( pgsz==0 ) pgsz = 65536;
//        TCL.Tcl_AppendObjToObj(pObj, TCL.Tcl_NewByteArrayObj(pBuffer.aPage[i], pgsz));
//      }
//      TCL.Tcl_SetObjResult( interp, pObj );
//      break;
//    }    
//    case DB_enum_CMD.CMD_FILTER: {
//VfsMethod[] vfsmethod = new VfsMethod[] {
//        new VfsMethod( "xShmOpen",      TESTVFS_SHMOPEN_MASK ),
//        new VfsMethod( "xShmLock",      TESTVFS_SHMLOCK_MASK ),
//        new VfsMethod( "xShmBarrier",   TESTVFS_SHMBARRIER_MASK ),
//        new VfsMethod( "xShmUnmap",     TESTVFS_SHMCLOSE_MASK ),
//        new VfsMethod( "xShmMap",       TESTVFS_SHMMAP_MASK ),
//        new VfsMethod( "xSync",         TESTVFS_SYNC_MASK ),
//        new VfsMethod( "xDelete",       TESTVFS_DELETE_MASK ),
//        new VfsMethod( "xWrite",        TESTVFS_WRITE_MASK ),
//        new VfsMethod( "xTruncate",     TESTVFS_TRUNCATE_MASK ),
//        new VfsMethod( "xOpen",         TESTVFS_OPEN_MASK ),
//        new VfsMethod( "xClose",        TESTVFS_CLOSE_MASK ),
//        new VfsMethod( "xAccess",       TESTVFS_ACCESS_MASK ),
//        new VfsMethod( "xFullPathname", TESTVFS_FULLPATHNAME_MASK ),
//};
//      Tcl_Obj[] apElem = null;
//      int nElem = 0;
//      int i;
//.........这里部分代码省略.........
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:101,代码来源:test_vfs_c.cs


示例16: abuse_create_function

    /*
    ** tclcmd:  abuse_create_function
    **
    ** Make various calls to sqlite3_create_function that do not have valid
    ** parameters.  Verify that the error condition is detected and reported.
    */
    static int abuse_create_function(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      //extern int getDbPointer(Tcl_Interp*, const char*, sqlite3*);
      sqlite3 db = null;
      int rc;
      int mxArg;

      if ( getDbPointer( interp, TCL.Tcl_GetString( objv[1] ), out db ) != 0 )
        return TCL.TCL_ERROR;

      rc = sqlite3_create_function( db, "tx", 1, SQLITE_UTF8, 0, tStep, tStep, tFinal );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      rc = sqlite3_create_function( db, "tx", 1, SQLITE_UTF8, 0, tStep, tStep, null );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      rc = sqlite3_create_function( db, "tx", 1, SQLITE_UTF8, 0, tStep, null, tFinal );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      rc = sqlite3_create_function( db, "tx", 1, SQLITE_UTF8, 0, null, null, tFinal );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      rc = sqlite3_create_function( db, "tx", 1, SQLITE_UTF8, 0, null, tStep, null );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      rc = sqlite3_create_function( db, "tx", -2, SQLITE_UTF8, 0, tStep, null, null );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      rc = sqlite3_create_function( db, "tx", 128, SQLITE_UTF8, 0, tStep, null, null );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      rc = sqlite3_create_function( db, "funcxx" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789",
      1, SQLITE_UTF8, 0, tStep, null, null );
      if ( rc != SQLITE_MISUSE )
        goto abuse_err;

      /* This last function registration should actually work.  Generate
      ** a no-op function (that always returns NULL) and which has the
      ** maximum-length function name and the maximum number of parameters.
      */
      sqlite3_limit( db, SQLITE_LIMIT_FUNCTION_ARG, 10000 );
      mxArg = sqlite3_limit( db, SQLITE_LIMIT_FUNCTION_ARG, -1 );
      rc = sqlite3_create_function( db, "nullx" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789" +
      "_123456789_123456789_123456789_123456789_123456789",
      mxArg, SQLITE_UTF8, 0, tStep, null, null );
      if ( rc != SQLITE_OK )
        goto abuse_err;

      return TCL.TCL_OK;

abuse_err:
      TCL.Tcl_AppendResult( interp, "sqlite3_create_function abused test failed"
      );
      return TCL.TCL_ERROR;
    }
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:82,代码来源:test_func_c.cs


示例17: testvfs_cmd

/*
** Usage:  testvfs VFSNAME ?SWITCHES?
**
** Switches are:
**
**   -noshm   BOOLEAN             (True to omit shm methods. Default false)
**   -default BOOLEAN             (True to make the vfs default. Default false)
**
** This command creates two things when it is invoked: an SQLite VFS, and
** a Tcl command. Both are named VFSNAME. The VFS is installed. It is not
** installed as the default VFS.
**
** The VFS passes all file I/O calls through to the underlying VFS.
**
** Whenever the xShmMap method of the VFS
** is invoked, the SCRIPT is executed as follows:
**
**   SCRIPT xShmMap    FILENAME ID
**
** The value returned by the invocation of SCRIPT above is interpreted as
** an SQLite error code and returned to SQLite. Either a symbolic 
** "SQLITE_OK" or numeric "0" value may be returned.
**
** The contents of the shared-memory buffer associated with a given file
** may be read and set using the following command:
**
**   VFSNAME shm FILENAME ?NEWVALUE?
**
** When the xShmLock method is invoked by SQLite, the following script is
** run:
**
**   SCRIPT xShmLock    FILENAME ID LOCK
**
** where LOCK is of the form "OFFSET NBYTE lock/unlock shared/exclusive"
*/
static int testvfs_cmd(
  ClientData cd,
  Tcl_Interp interp,
  int objc,
  Tcl_Obj[] objv
){
  Debugger.Break();//TODO
//  sqlite3_vfs tvfs_vfs = new sqlite3_vfs(
//    2,                            /* iVersion */
//    0,                            /* szOsFile */
//    0,                            /* mxPathname */
//    null,                         /* pNext */
//    null,                            /* zName */
//    0,                            /* pAppData */
//    tvfsOpen,                     /* xOpen */
//    tvfsDelete,                   /* xDelete */
//    tvfsAccess,                   /* xAccess */
//    tvfsFullPathname,             /* xFullPathname */
//#if !SQLITE_OMIT_LOAD_EXTENSION
//    tvfsDlOpen,                   /* xDlOpen */
//    tvfsDlError,                  /* xDlError */
//    tvfsDlSym,                    /* xDlSym */
//    tvfsDlClose,                  /* xDlClose */
//#else
//    null,                            /* xDlOpen */
//    null,                            /* xDlError */
//    null,                            /* xDlSym */
//    null,                            /* xDlClose */
//#endif //* SQLITE_OMIT_LOAD_EXTENSION */
//    tvfsRandomness,               /* xRandomness */
//    tvfsSleep,                    /* xSleep */
//    tvfsCurrentTime,              /* xCurrentTime */
//    null,                         /* xGetLastError */
//    null,                          /* xCurrentTimeInt64 */
//    null, null, null
//    );

//  Testvfs p;                     /* New object */
//  sqlite3_vfs pVfs;              /* New VFS */
//  string zVfs;
//  int nByte;                      /* Bytes of space to allocate at p */

//  int i;
//  int isNoshm = 0;                /* True if -noshm is passed */
//  int isDefault = 0;              /* True if -default is passed */
//  int szOsFile = 0;               /* Value passed to -szosfile */
//  int mxPathname = -1;            /* Value passed to -mxpathname */
//  int iVersion = 2;               /* Value passed to -iversion */

//  if( objc<2 || 0!=(objc%2) ) goto bad_args;
//  for(i=2; i<objc; i += 2){
//    int nSwitch;
//    string zSwitch;
//    zSwitch = TCL.Tcl_GetStringFromObj(objv[i], &nSwitch); 

//    if( nSwitch>2 && 0==strncmp("-noshm", zSwitch, nSwitch) ){
//      if ( TCL.Tcl_GetBooleanFromObj( interp, objv[i + 1], &isNoshm ) )
//      {
//        return TCL.TCL_ERROR;
//      }
//    }
//    else if( nSwitch>2 && 0==strncmp("-default", zSwitch, nSwitch) ){
//      if ( TCL.Tcl_GetBooleanFromObj( interp, objv[i + 1], &isDefault ) )
//      {
//        return TCL.TCL_ERROR;
//.........这里部分代码省略.........
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:101,代码来源:test_vfs_c.cs


示例18: test_initialize

    /*
    ** sqlite3_initialize
    */
    static int test_initialize(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv )
    {
      int rc;

      if ( objc != 1 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "" );
        return TCL.TCL_ERROR;
      }

      rc = sqlite3_initialize();
      TCL.Tcl_SetResult( interp, sqlite3TestErrorName( rc ), TCL.TCL_VOLATILE );
      return TCL.TCL_OK;
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:21,代码来源:test_mutex_c.cs


示例19: md5_cmd

    /*
    ** A TCL command for md5.  The argument is the text to be hashed.  The
    ** Result is the hash in base64.
    */
    static int md5_cmd( object cd, Tcl_Interp interp, int argc, Tcl_Obj[] argv )
    {
      MD5Context ctx = new MD5Context();
      byte[] digest = new byte[16];
      byte[] zBuf = new byte[32];


      if ( argc != 2 )
      {
        TCL.Tcl_AppendResult( interp, "wrong # args: should be \"", argv[0],
        " TEXT\"" );
        return TCL.TCL_ERROR;
      }
      MD5Init( ctx );
      MD5Update( ctx, Encoding.UTF8.GetBytes( argv[1].ToString() ), Encoding.UTF8.GetByteCount( argv[1].ToString() ) );
      MD5Final( digest, ctx );
      DigestToBase16( digest, zBuf );
      TCL.Tcl_AppendResult( interp, Encoding.UTF8.GetString( zBuf ) );
      return TCL.TCL_OK;
    }
开发者ID:mbahar94,项目名称:fracture,代码行数:24,代码来源:test_md5_c.cs


示例20: test_clear_mutex_counters


//.........这里部分代码省略.........
    //    counterMutexTry,
    //    counterMutexLeave,
    //    counterMutexHeld,
    //    counterMutexNotheld
    //  };

    //  if( objc!=2 ){
    //    TCL.Tcl_WrongNumArgs(interp, 1, objv, "BOOLEAN");
    //    return TCL.TCL_ERROR;
    //  }
    //  if( TCL.TCL_OK!=Tcl_GetBooleanFromObj(interp, objv[1], isInstall) ){
    //    return TCL.TCL_ERROR;
    //  }

    //  Debug.Assert(isInstall==0 || isInstall==1);
    //  Debug.Assert(g.isInstalled==0 || g.isInstalled==1);
    //  if( isInstall==g.isInstalled ){
    //    TCL.Tcl_AppendResult(interp, "mutex counters are ");
    //    TCL.Tcl_AppendResult(interp, isInstall?"already installed":"not installed");
    //    return TCL.TCL_ERROR;
    //  }

    //  if( isInstall ){
    //    Debug.Assert( g.m.xMutexAlloc==0 );
    //    rc = sqlite3_config(SQLITE_CONFIG_GETMUTEX, g.m);
    //    if( rc==SQLITE_OK ){
    //      sqlite3_config(SQLITE_CONFIG_MUTEX, counter_methods);
    //    }
    //    g.disableTry = 0;
    //  }else{
    //    Debug.Assert( g.m.xMutexAlloc );
    //    rc = sqlite3_config(SQLITE_CONFIG_MUTEX, g.m);
    //    memset(&g.m, 0, sizeof(sqlite3_mutex_methods));
    //  }

    //  if( rc==SQLITE_OK ){
    //    g.isInstalled = isInstall;
    //  }

    //  TCL.Tcl_SetResult(interp, (char *)sqlite3TestErrorName(rc), TCL.Tcl_VOLATILE);
    //  return TCL.TCL_OK;
    //}

    /*
    ** read_mutex_counters
    */
    //static int test_read_mutex_counters(
    //     object clientdata,
    //      Tcl_Interp interp,
    //      int objc,
    //      Tcl_Obj[] objv
    //){
    //  Tcl_Obj pRet;
    //  int ii;
    //  char *aName[8] = {
    //    "fast",        "recursive",   "static_master", "static_mem",
    //    "static_open", "static_prng", "static_lru",    "static_lru2"
    //  };

    //  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(pRet);

    //  return TCL.TCL_OK;
    //}

    /*
    ** clear_mutex_counters
    */
    static int test_clear_mutex_counters(
    object clientdata,
    Tcl_Interp interp,
    int objc,
    Tcl_Obj[] objv
    )
    {
      int ii;

      if ( objc != 1 )
      {
        TCL.Tcl_WrongNumArgs( interp, 1, objv, "" );
        return TCL.TCL_ERROR;
      }

      for ( ii = 0 ; ii < 8 ; ii++ )
      {
        g.aCounter[ii] = 0;
      }
      return TCL.TCL_OK;
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:101,代码来源:test_mutex_c.cs



注:本文中的Tcl_Obj类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TcmUri类代码示例发布时间:2022-05-24
下一篇:
C# Tcl_Interp类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap