本文整理汇总了C#中System.Thread.SetNilReturnValue方法的典型用法代码示例。如果您正苦于以下问题:C# Thread.SetNilReturnValue方法的具体用法?C# Thread.SetNilReturnValue怎么用?C# Thread.SetNilReturnValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Thread
的用法示例。
在下文中一共展示了Thread.SetNilReturnValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override int Execute( Thread l )
{
var tbl = (Table)l[1];
if( tbl == null )
throw new ArgumentNullException();
Value key, val;
if( tbl.GetNext( ref loc, out key, out val ) )
return l.SetReturnValues( key, val );
else
return l.SetNilReturnValue();
}
示例2: BToNumber
private static int BToNumber( Thread l )
{
var nval = l[1];
if( nval.ValueType == LValueType.Number )
return l.SetReturnValues( nval );
var nstr = nval.ToLString();
if( nstr.IsNil )
return l.SetNilReturnValue();
byte[] nbuf;
int nIndex, nCount;
nstr.UnsafeGetDataBuffer( out nbuf, out nIndex, out nCount );
double num;
if( l.StackTop < 2 )
{
if( !Helpers.StrToNum( nbuf, nIndex, nCount, out num ) )
return l.SetNilReturnValue();
}
else
{
int radix = (int)l[2];
if( radix < 2 || radix > 36 )
throw new ArgumentOutOfRangeException( "base out of range" );
if( !Helpers.StrToInt( nbuf, nIndex, nCount, out num, radix ) )
return l.SetNilReturnValue();
}
return l.SetReturnValues( num );
}
示例3: BINext
private static int BINext( Thread l )
{
l.StackTop = 2;
var tbl = (Table)l[1];
if( tbl == null )
throw new InvalidCastException();
var key = (int)(double)l[2] + 1;
Value val;
if( tbl.TryGetValue( key, out val ) )
return l.SetReturnValues( key, val );
else
return l.SetNilReturnValue();
}
示例4: BNext
private static int BNext( Thread l )
{
var tbl = (Table)l[1];
if( tbl == null )
throw new ArgumentNullException();
Value key = l[2];
Value val;
if( tbl.GetNext( ref key, out val ) )
return l.SetReturnValues( key, val );
else
return l.SetNilReturnValue();
}
示例5: FindCore
private static int FindCore( Thread l, bool isFind )
{
var str = (LString)l[1];
var pat = (LString)l[2];
int init = l.StackTop >= 3 ? StrIdxArg( str, (int)l[3] ) : 0;
if( init == -1 )
init = 0;
if( init == str.Length && init != 0 )
return l.SetNilReturnValue();
if( isFind && (l[4].ToBool() || !HasPatternSpecials( pat )) )
{
//do a plain search
int idx = str.IndexOf( pat, init );
if( idx != -1 )
return l.SetReturnValues( idx + 1, idx + pat.Length );
else
return l.SetNilReturnValue();
}
else
{
MatchState ms;
InitMatchState( out ms, l );
ms.Str = str.InternalData;
ms.StrInit = LString.BufferDataOffset;
ms.Pat = pat.InternalData;
int patInit = LString.BufferDataOffset;
bool anchor = patInit < ms.Pat.Length && ms.Pat[patInit] == (byte)'^';
if( anchor )
patInit++;
int sPos = LString.BufferDataOffset + init;
do {
Debug.Assert( ms.MatchDepth == MaxCCalls );
ms.Level = 0;
var res = SMatch( ref ms, sPos, patInit );
if( res != -1 )
{
if( isFind )
{
l.StackTop = 0;
l.Push( sPos - LString.BufferDataOffset + 1 );
l.Push( res - LString.BufferDataOffset );
return PushCaptures( ref ms, -1, -1 ) + 2;
}
else
{
return PushCaptures( ref ms, sPos, res );
}
}
} while( sPos++ < ms.Str.Length && !anchor );
RetireMatchState( ref ms );
return l.SetNilReturnValue();
}
}