当前位置: 首页>>代码示例>>C#>>正文


C# Tcl_Obj类代码示例

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


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


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