本文整理汇总了C#中tcl.lang.TclObject类的典型用法代码示例。如果您正苦于以下问题:C# TclObject类的具体用法?C# TclObject怎么用?C# TclObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TclObject类属于tcl.lang命名空间,在下文中一共展示了TclObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: cmdProc
/// <summary> This procedure is invoked to process the "eval" Tcl command.
/// See the user documentation for details on what it does.
///
/// </summary>
/// <param name="interp">the current interpreter.
/// </param>
/// <param name="argv">command arguments.
/// </param>
/// <exception cref=""> TclException if script causes error.
/// </exception>
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
if ( argv.Length < 2 )
{
throw new TclNumArgsException( interp, 1, argv, "arg ?arg ...?" );
}
try
{
if ( argv.Length == 2 )
{
interp.eval( argv[1], 0 );
}
else
{
string s = Util.concat( 1, argv.Length - 1, argv );
interp.eval( s, 0 );
}
}
catch ( TclException e )
{
if ( e.getCompletionCode() == TCL.CompletionCode.ERROR )
{
interp.addErrorInfo( "\n (\"eval\" body line " + interp.errorLine + ")" );
}
throw;
}
return TCL.CompletionCode.RETURN;
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:40,代码来源:EvalCmd.cs
示例2: cmdProc
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] objv )
{
TclObject varValue = null;
if ( objv.Length < 2 )
{
throw new TclNumArgsException( interp, 1, objv, "varName ?value value ...?" );
}
else if ( objv.Length == 2 )
{
interp.resetResult();
interp.setResult( interp.getVar( objv[1], 0 ) );
}
else
{
for ( int i = 2; i < objv.Length; i++ )
{
varValue = interp.setVar( objv[1], objv[i], TCL.VarFlag.APPEND_VALUE );
}
if ( varValue != null )
{
interp.resetResult();
interp.setResult( varValue );
}
else
{
interp.resetResult();
}
}
return TCL.CompletionCode.RETURN;
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:32,代码来源:AppendCmd.cs
示例3: Procedure
internal Procedure( Interp interp, NamespaceCmd.Namespace ns, string name, TclObject args, TclObject b, string sFileName, int sLineNumber )
{
this.ns = ns;
srcFileName = sFileName;
srcLineNumber = sLineNumber;
// Break up the argument list into argument specifiers, then process
// each argument specifier.
int numArgs = TclList.getLength( interp, args );
argList = new TclObject[numArgs][];
for ( int i = 0; i < numArgs; i++ )
{
argList[i] = new TclObject[2];
}
for ( int i = 0; i < numArgs; i++ )
{
// Now divide the specifier up into name and default.
TclObject argSpec = TclList.index( interp, args, i );
int specLen = TclList.getLength( interp, argSpec );
if ( specLen == 0 )
{
throw new TclException( interp, "procedure \"" + name + "\" has argument with no name" );
}
if ( specLen > 2 )
{
throw new TclException( interp, "too many fields in argument " + "specifier \"" + argSpec + "\"" );
}
argList[i][0] = TclList.index( interp, argSpec, 0 );
argList[i][0].preserve();
if ( specLen == 2 )
{
argList[i][1] = TclList.index( interp, argSpec, 1 );
argList[i][1].preserve();
}
else
{
argList[i][1] = null;
}
}
if ( numArgs > 0 && ( argList[numArgs - 1][0].ToString().Equals( "args" ) ) )
{
isVarArgs = true;
}
else
{
isVarArgs = false;
}
body = new CharPointer( b.ToString() );
body_length = body.length();
}
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:60,代码来源:Procedure.cs
示例4: cmdProc
/// <summary> This procedure is invoked to process the "seek" Tcl command.
/// See the user documentation for details on what it does.
/// </summary>
public TCL.CompletionCode cmdProc(Interp interp, TclObject[] argv)
{
Channel chan; /* The channel being operated on this method */
int mode; /* Stores the search mode, either beg, cur or end
* of file. See the TclIO class for more info */
if (argv.Length != 3 && argv.Length != 4)
{
throw new TclNumArgsException(interp, 1, argv, "channelId offset ?origin?");
}
// default is the beginning of the file
mode = TclIO.SEEK_SET;
if (argv.Length == 4)
{
int index = TclIndex.get(interp, argv[3], validOrigins, "origin", 0);
switch (index)
{
case OPT_START: {
mode = TclIO.SEEK_SET;
break;
}
case OPT_CURRENT: {
mode = TclIO.SEEK_CUR;
break;
}
case OPT_END: {
mode = TclIO.SEEK_END;
break;
}
}
}
chan = TclIO.getChannel(interp, argv[1].ToString());
if (chan == null)
{
throw new TclException(interp, "can not find channel named \"" + argv[1].ToString() + "\"");
}
long offset = TclInteger.get(interp, argv[2]);
try
{
chan.seek(interp, offset, mode);
}
catch (System.IO.IOException e)
{
// FIXME: Need to figure out Tcl specific error conditions.
// Should we also wrap an IOException in a ReflectException?
throw new TclRuntimeError("SeekCmd.cmdProc() Error: IOException when seeking " + chan.ChanName + ":" + e.Message);
}
return TCL.CompletionCode.RETURN;
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:64,代码来源:SeekCmd.cs
示例5: cmdProc
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
string dirName;
if ( argv.Length > 2 )
{
throw new TclNumArgsException( interp, 1, argv, "?dirName?" );
}
if ( argv.Length == 1 )
{
dirName = "~";
}
else
{
dirName = argv[1].ToString();
}
if ( ( JACL.PLATFORM == JACL.PLATFORM_WINDOWS ) && ( dirName.Length == 2 ) && ( dirName[1] == ':' ) )
{
dirName = dirName + "/";
}
// Set the interp's working dir.
interp.setWorkingDir( dirName );
return TCL.CompletionCode.RETURN;
}
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:28,代码来源:CdCmd.cs
示例6: cmdProc
/// <summary> This procedure is invoked to process the "tell" Tcl command.
/// See the user documentation for details on what it does.
///
/// </summary>
/// <param name="interp">the current interpreter.
/// </param>
/// <param name="argv">command arguments.
/// </param>
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
Channel chan; /* The channel being operated on this method */
if ( argv.Length != 2 )
{
throw new TclNumArgsException( interp, 1, argv, "channelId" );
}
chan = TclIO.getChannel( interp, argv[1].ToString() );
if ( chan == null )
{
throw new TclException( interp, "can not find channel named \"" + argv[1].ToString() + "\"" );
}
try
{
interp.setResult( TclInteger.newInstance( (int)chan.tell() ) );
}
catch ( IOException e )
{
throw new TclException( interp, "Error in TellCmd" );
}
return TCL.CompletionCode.RETURN;
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:37,代码来源:TellCmd.cs
示例7: cmdProc
public TCL.CompletionCode cmdProc(Interp interp, TclObject[] argv)
{
if (argv.Length != 2)
{
throw new TclNumArgsException(interp, 1, argv, "name");
}
VwaitTrace trace = new VwaitTrace();
Var.traceVar(interp, argv[1], TCL.VarFlag.GLOBAL_ONLY | TCL.VarFlag.TRACE_WRITES | TCL.VarFlag.TRACE_UNSETS, trace);
int foundEvent = 1;
while (!trace.done && (foundEvent != 0))
{
foundEvent = interp.getNotifier().doOneEvent(TCL.ALL_EVENTS);
}
Var.untraceVar(interp, argv[1], TCL.VarFlag.GLOBAL_ONLY | TCL.VarFlag.TRACE_WRITES | TCL.VarFlag.TRACE_UNSETS, trace);
// Clear out the interpreter's result, since it may have been set
// by event handlers.
interp.resetResult();
if (foundEvent == 0)
{
throw new TclException(interp, "can't wait for variable \"" + argv[1] + "\": would wait forever");
}
return TCL.CompletionCode.RETURN;
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:30,代码来源:VwaitCmd.cs
示例8: TclNumArgsException
/// <summary> Creates a TclException with the appropiate Tcl error
/// message for having the wring number of arguments to a Tcl command.
/// <p>
/// Example: <pre>
///
/// if (argv.length != 3) {
/// throw new TclNumArgsException(interp, 1, argv, "option name");
/// }
/// </pre>
///
/// </summary>
/// <param name="interp">current Interpreter.
/// </param>
/// <param name="argc">the number of arguments to copy from the offending
/// command to put into the error message.
/// </param>
/// <param name="argv">the arguments of the offending command.
/// </param>
/// <param name="message">extra message to appear in the error message that
/// explains the proper usage of the command.
/// </param>
/// <exception cref=""> TclException is always thrown.
/// </exception>
public TclNumArgsException( Interp interp, int argc, TclObject[] argv, string message )
: base(TCL.CompletionCode.ERROR)
{
if ( interp != null )
{
StringBuilder buff = new StringBuilder( 50 );
buff.Append( "wrong # args: should be \"" );
for ( int i = 0; i < argc; i++ )
{
if ( argv[i].InternalRep is TclIndex )
{
buff.Append( argv[i].InternalRep.ToString() );
}
else
{
buff.Append( argv[i].ToString() );
}
if ( i < ( argc - 1 ) )
{
buff.Append( " " );
}
}
if ( ( message != null ) )
{
buff.Append( " " + message );
}
buff.Append( "\"" );
interp.setResult( buff.ToString() );
}
}
开发者ID:R4P3NET,项目名称:TS3SRV-ASE,代码行数:54,代码来源:TclNumArgsException.cs
示例9: cmdProc
/// <summary> See Tcl user documentation for details.</summary>
public TCL.CompletionCode cmdProc(Interp interp, TclObject[] argv)
{
if ((argv.Length < 2) || (argv.Length > 3))
{
throw new TclNumArgsException(interp, 1, argv, "script ?count?");
}
int count;
if (argv.Length == 2)
{
count = 1;
}
else
{
count = TclInteger.get(interp, argv[2]);
}
long startTime = System.DateTime.Now.Ticks;
for (int i = 0; i < count; i++)
{
interp.eval(argv[1], 0);
}
long endTime = System.DateTime.Now.Ticks;
long uSecs = (((endTime - startTime) / 10) / count);
if (uSecs == 1)
{
interp.setResult(TclString.newInstance("1 microsecond per iteration"));
}
else
{
interp.setResult(TclString.newInstance(uSecs + " microseconds per iteration"));
}
return TCL.CompletionCode.RETURN;
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:36,代码来源:TimeCmd.cs
示例10: cmdProc
public TCL.CompletionCode cmdProc(Interp interp, TclObject[] argv)
{
if (argv.Length < 2 || argv.Length > 4)
{
throw new TclNumArgsException(interp, 1, argv, "message ?errorInfo? ?errorCode?");
}
if (argv.Length >= 3)
{
string errorInfo = argv[2].ToString();
if (!errorInfo.Equals(""))
{
interp.addErrorInfo(errorInfo);
interp.errAlreadyLogged = true;
}
}
if (argv.Length == 4)
{
interp.setErrorCode(argv[3]);
}
interp.setResult(argv[1]);
throw new TclException(TCL.CompletionCode.ERROR);
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:27,代码来源:ErrorCmd.cs
示例11: cmdProc
/// <summary> This procedure is invoked to process the "flush" Tcl command.
/// See the user documentation for details on what it does.
///
/// </summary>
/// <param name="interp">the current interpreter.
/// </param>
/// <param name="argv">command arguments.
/// </param>
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
Channel chan; /* The channel being operated on this method */
if ( argv.Length != 2 )
{
throw new TclNumArgsException( interp, 1, argv, "channelId" );
}
chan = TclIO.getChannel( interp, argv[1].ToString() );
if ( chan == null )
{
throw new TclException( interp, "can not find channel named \"" + argv[1].ToString() + "\"" );
}
try
{
chan.flush( interp );
}
catch ( IOException e )
{
throw new TclRuntimeError( "FlushCmd.cmdProc() Error: IOException when flushing " + chan.ChanName );
}
return TCL.CompletionCode.RETURN;
}
开发者ID:R4P3NET,项目名称:TS3SRV-ASE,代码行数:34,代码来源:FlushCmd.cs
示例12: cmdProc
/// <summary> Evaluates a Tcl expression. See Tcl user documentation for
/// details.
/// </summary>
/// <exception cref=""> TclException If malformed expression.
/// </exception>
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
if ( argv.Length < 2 )
{
throw new TclNumArgsException( interp, 1, argv, "arg ?arg ...?" );
}
if ( argv.Length == 2 )
{
interp.setResult( interp.expr.eval( interp, argv[1].ToString() ) );
}
else
{
StringBuilder sbuf = new StringBuilder();
sbuf.Append( argv[1].ToString() );
for ( int i = 2; i < argv.Length; i++ )
{
sbuf.Append( ' ' );
sbuf.Append( argv[i].ToString() );
}
interp.setResult( interp.expr.eval( interp, sbuf.ToString() ) );
}
return TCL.CompletionCode.RETURN;
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:33,代码来源:ExprCmd.cs
示例13: cmdProc
/// <summary> This procedure is invoked to process the "gets" Tcl command.
/// See the user documentation for details on what it does.
///
/// </summary>
/// <param name="interp">the current interpreter.
/// </param>
/// <param name="argv">command arguments.
/// </param>
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
bool writeToVar = false; // If true write to var passes as arg
string varName = ""; // The variable to write value to
Channel chan; // The channel being operated on
int lineLen;
TclObject line;
if ( ( argv.Length < 2 ) || ( argv.Length > 3 ) )
{
throw new TclNumArgsException( interp, 1, argv, "channelId ?varName?" );
}
if ( argv.Length == 3 )
{
writeToVar = true;
varName = argv[2].ToString();
}
chan = TclIO.getChannel( interp, argv[1].ToString() );
if ( chan == null )
{
throw new TclException( interp, "can not find channel named \"" + argv[1].ToString() + "\"" );
}
try
{
line = TclString.newInstance( new StringBuilder( 64 ) );
lineLen = chan.read( interp, line, TclIO.READ_LINE, 0 );
if ( lineLen < 0 )
{
// FIXME: Need more specific posix error codes!
if ( !chan.eof() && !chan.isBlocked( interp ) )
{
throw new TclPosixException( interp, TclPosixException.EIO, true, "error reading \"" + argv[1].ToString() + "\"" );
}
lineLen = -1;
}
if ( writeToVar )
{
interp.setVar( varName, line, 0 );
interp.setResult( lineLen );
}
else
{
interp.setResult( line );
}
}
catch ( IOException e )
{
throw new TclRuntimeError( "GetsCmd.cmdProc() Error: IOException when getting " + chan.ChanName + ": " + e.Message );
}
return TCL.CompletionCode.RETURN;
}
开发者ID:R4P3-NET,项目名称:AccountingServerEmulatorSource,代码行数:68,代码来源:GetsCmd.cs
示例14: cmdProc
/// <summary> This procedure is invoked to process the "break" Tcl command.
/// See the user documentation for details on what it does.
/// </summary>
/// <exception cref=""> TclException is always thrown.
/// </exception>
public TCL.CompletionCode cmdProc(Interp interp, TclObject[] argv)
{
if (argv.Length != 1)
{
throw new TclNumArgsException(interp, 1, argv, null);
}
throw new TclException(interp, null, TCL.CompletionCode.BREAK);
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:14,代码来源:BreakCmd.cs
示例15: Tcl_GetIndexFromObjStruct
static int Tcl_GetIndexFromObjStruct( Interp interp, TclObject to, BackupSubCommand[] table, int len, string msg, int flags, ref int index )
{
string zCmd = to.ToString();
for ( index = 0 ; index < len ; index++ )
{
if ( zCmd == table[index].zCmd ) return 0;
}
return 1;
}
开发者ID:mbahar94,项目名称:fracture,代码行数:9,代码来源:test_backup_c.cs
示例16: cmdProc
/// <summary> See Tcl user documentation for details.</summary>
/// <exception cref=""> TclException If incorrect number of arguments.
/// </exception>
public TCL.CompletionCode cmdProc(Interp interp, TclObject[] argv)
{
if (argv.Length != 2)
{
throw new TclNumArgsException(interp, 1, argv, "list");
}
interp.setResult(TclInteger.newInstance(TclList.getLength(interp, argv[1])));
return TCL.CompletionCode.RETURN;
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:13,代码来源:LlengthCmd.cs
示例17: cmdProc
/// <summary> Tcl_UpvarObjCmd -> UpvarCmd.cmdProc
///
/// This procedure is invoked to process the "upvar" Tcl command.
/// See the user documentation for details on what it does.
/// </summary>
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] objv )
{
CallFrame frame;
string frameSpec, otherVarName, myVarName;
int p;
int objc = objv.Length, objv_index;
int result;
if ( objv.Length < 3 )
{
throw new TclNumArgsException( interp, 1, objv, "?level? otherVar localVar ?otherVar localVar ...?" );
}
// Find the call frame containing each of the "other variables" to be
// linked to.
frameSpec = objv[1].ToString();
// Java does not support passing a reference by refernece so use an array
CallFrame[] frameArr = new CallFrame[1];
result = CallFrame.getFrame( interp, frameSpec, frameArr );
frame = frameArr[0];
objc -= ( result + 1 );
if ( ( objc & 1 ) != 0 )
{
throw new TclNumArgsException( interp, 1, objv, "?level? otherVar localVar ?otherVar localVar ...?" );
}
objv_index = result + 1;
// Iterate over each (other variable, local variable) pair.
// Divide the other variable name into two parts, then call
// MakeUpvar to do all the work of linking it to the local variable.
for ( ; objc > 0; objc -= 2, objv_index += 2 )
{
myVarName = objv[objv_index + 1].ToString();
otherVarName = objv[objv_index].ToString();
int otherLength = otherVarName.Length;
p = otherVarName.IndexOf( (System.Char)'(' );
if ( ( p != -1 ) && ( otherVarName[otherLength - 1] == ')' ) )
{
// This is an array variable name
Var.makeUpvar( interp, frame, otherVarName.Substring( 0, ( p ) - ( 0 ) ), otherVarName.Substring( p + 1, ( otherLength - 1 ) - ( p + 1 ) ), 0, myVarName, 0 );
}
else
{
// This is a scalar variable name
Var.makeUpvar( interp, frame, otherVarName, null, 0, myVarName, 0 );
}
}
interp.resetResult();
return TCL.CompletionCode.RETURN;
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:63,代码来源:UpvarCmd.cs
示例18: cmdProc
/// <summary> This procedure is invoked to process the "while" Tcl command.
/// See the user documentation for details on what it does.
///
/// </summary>
/// <param name="interp">the current interpreter.
/// </param>
/// <param name="argv">command arguments.
/// </param>
/// <exception cref=""> TclException if script causes error.
/// </exception>
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
if ( argv.Length != 3 )
{
throw new TclNumArgsException( interp, 1, argv, "test command" );
}
string test = argv[1].ToString();
TclObject command = argv[2];
{
while ( interp.expr.evalBoolean( interp, test ) )
{
try
{
interp.eval( command, 0 );
}
catch ( TclException e )
{
switch ( e.getCompletionCode() )
{
case TCL.CompletionCode.BREAK:
goto loop_brk;
case TCL.CompletionCode.CONTINUE:
continue;
case TCL.CompletionCode.ERROR:
interp.addErrorInfo( "\n (\"while\" body line " + interp.errorLine + ")" );
throw;
default:
throw;
}
}
}
}
loop_brk:
;
interp.resetResult();
return TCL.CompletionCode.RETURN;
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:61,代码来源:WhileCmd.cs
示例19: cmdProc
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
targetInterp.preserve();
targetInterp.nestLevel++;
targetInterp.resetResult();
targetInterp.allowExceptions();
// Append the arguments to the command prefix and invoke the command
// in the target interp's global namespace.
TclObject[] prefv = TclList.getElements( interp, prefix );
TclObject cmd = TclList.newInstance();
cmd.preserve();
TclList.replace( interp, cmd, 0, 0, prefv, 0, prefv.Length - 1 );
TclList.replace( interp, cmd, prefv.Length, 0, argv, 1, argv.Length - 1 );
TclObject[] cmdv = TclList.getElements( interp, cmd );
TCL.CompletionCode result = targetInterp.invoke( cmdv, Interp.INVOKE_NO_TRACEBACK );
cmd.release();
targetInterp.nestLevel--;
// Check if we are at the bottom of the stack for the target interpreter.
// If so, check for special return codes.
if ( targetInterp.nestLevel == 0 )
{
if ( result == TCL.CompletionCode.RETURN )
{
result = targetInterp.updateReturnInfo();
}
if ( result != TCL.CompletionCode.OK && result != TCL.CompletionCode.ERROR )
{
try
{
targetInterp.processUnexpectedResult( result );
}
catch ( TclException e )
{
result = e.getCompletionCode();
}
}
}
targetInterp.release();
interp.transferResult( targetInterp, result );
return TCL.CompletionCode.RETURN;
}
开发者ID:Jaden-J,项目名称:csharp-sqlite,代码行数:49,代码来源:InterpAliasCmd.cs
示例20: set
// The new value for the object.
public static void set( TclObject tobj, double d )
{
tobj.invalidateStringRep();
InternalRep rep = tobj.InternalRep;
if ( rep is TclDouble )
{
TclDouble tdouble = (TclDouble)rep;
tdouble.value = d;
}
else
{
tobj.InternalRep = new TclDouble( d );
}
}
开发者ID:R4P3NET,项目名称:TS3SRV-ASE,代码行数:16,代码来源:TclDouble.cs
注:本文中的tcl.lang.TclObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论