Esempio n. 1
0
static VALUE ReadT_START (int argc, VALUE *argv, VALUE self) {
  MQ_BUF MqBufferS_object = NULL;
  SETUP_mqctx
  if (argc < 0 || argc > 1)
    rb_raise(rb_eArgError,"usage: ReadT_START ?MqBufferS-Type-Arg?");
  if (argc == 1) {
    CheckType(argv[0],cMqBufferS,"usage: ReadT_START ?MqBufferS-Type-Arg?")
    MqBufferS_object = VAL2MqBufferS(argv[0]);
  }
  ErrorMqToRubyWithCheck(MqReadT_START(mqctx, MqBufferS_object));
  return Qnil;
}
Esempio n. 2
0
Port::Status
InputPort::GetStatus() const
{
    // Get the output port connected to this port.
    OutputPort *output = GetSource();
    // Check it the port is disconnected...
    if (output == NULL)
    {
        return m_is_required ? Required : Disconnected;
    }
    // Check if the type of this port is ok.
    return CheckType() ? Ok : TypeMismatch;
}
Esempio n. 3
0
    Type ReadFPValueFromLua( lua_State *L, int Index )
    {
        CheckType( L, Index, LUA_TNUMBER );

        int isnum;
        auto Val = lua_tonumberx( L, Index, &isnum );
        if( !isnum )
        {
            auto Str = lua_tostring( L, Index );
            SCRIPT_PARSING_ERROR( L, "Failed to convert parameter ", Str, " to floating point" );
        }
        return static_cast<Type>(Val);
    }
Esempio n. 4
0
void PyTuple_AddItem(PyObject* object, PyObject* item)
{
	if(!CheckType("PyTuple_AddItem", object, &PyTuple_Type))
		return;

	PyTupleObject* tupleObject = (PyTupleObject*)object;
	if((tupleObject->tuple).size() >= tupleObject->size)
	{
		cout << "[Error]PyTuple_AddItem : size over flow" << endl;
		return;
	}

	(tupleObject->tuple).push_back(item);
}
Esempio n. 5
0
void Core::CheckDataTypeSizes()
{
    CheckType(int8(), 8, "int8");
    CheckType(uint8(), 8, "uint8");
    CheckType(int16(), 16, "int16");
    CheckType(uint16(), 16, "uint16");
    CheckType(int32(), 32, "int32");
    CheckType(uint32(), 32, "uint32");
}
    IDeviceContext* EngineObjectParserBase::LoadDeviceContextFromRegistry( lua_State *L )
    {
        INIT_LUA_STACK_TRACKING( L );

        lua_pushstring( L, ScriptParser::DeviceContextRegistryKey );  // -0 | +1 -> +1
        lua_gettable(L, LUA_REGISTRYINDEX );                           // -1 | +1 -> +0
        CheckType( L, -1, LUA_TLIGHTUSERDATA );
        IDeviceContext* pContext = reinterpret_cast<IDeviceContext*>( lua_touserdata(L, -1) );
        lua_pop( L, 1 );                                               // -1 | +0 -> -1
        
        VERIFY( pContext != nullptr, "Device context is null" );

        CHECK_LUA_STACK_HEIGHT();

        return pContext;
    }
Esempio n. 7
0
bool cFileList::CheckExcludes(char *dir, char *file)
{
  if(!Excludes)
    return false;

  cFileOptListItem *eItem = Excludes->First();
  while(eItem)
  {
    if(RegIMatch(file, eItem->Regex()) && CheckType(dir, file, eItem->FileType()))
      return true;

    eItem = Excludes->Next(eItem);
  }

  return false;
}
Esempio n. 8
0
bool cFileList::CheckIncludes(char *dir, char *file)
{
  if(!Includes)
    return true;

  cFileOptListItem *iItem = Includes->First();
  while(iItem)
  {
    if(RegIMatch(file, iItem->Regex()) && CheckType(dir, file, iItem->FileType()))
      return true;

    iItem = Includes->Next(iItem);
  }

  return false;
}
Esempio n. 9
0
    Type ReadIntValueFromLua( lua_State *L, int Index )
    {
        CheckType( L, Index, LUA_TNUMBER );

        int isnum;
        auto Val = lua_tonumberx( L, Index, &isnum );
        if( !isnum )
        {
            auto Str = lua_tostring( L, Index );
            SCRIPT_PARSING_ERROR( L, "Failed to convert parameter ", Str, " to int" );
        }
        if( static_cast<Type>(Val) != Val )
        {
            SCRIPT_PARSING_ERROR( L, "Parameter value (", Val, ") is not integer. Truncating to int" );
        }
        return static_cast<Type>(Val);
    }
Esempio n. 10
0
CValueConvert<SRunTimeSqlCP, CDB_Object>::operator const CTime&(void) const
{
    CheckNULL(m_Value);
    CheckType(m_Value, eDB_SmallDateTime, eDB_DateTime);

    EDB_Type cur_type = m_Value.GetType();
    
    if (cur_type == eDB_SmallDateTime) {
        return static_cast<const CDB_SmallDateTime&>(m_Value).Value();
    } else if (cur_type == eDB_DateTime) {
        return static_cast<const CDB_DateTime&>(m_Value).Value();
    } else {
        ReportTypeConvError(cur_type, "CTime");
    }

    static CSafeStaticPtr<CTime> value;
    return value.Get();
}
Esempio n. 11
0
void Type3Machine::EnterChar(char ch, int pos, int line)
{
	if (_currentLexemePosition == -100)
	{
		_currentLexemePosition = pos;
		_curlexline = line;
	}
	if (!_start)
	{
		CheckStart(ch);
		if (!_start) _isError = true;
		return;
	}

	if (((_step - 1) > 0) && (_step - 1 != 0) && (_buffer[_step - 1] == _buffer[0]) && ch != '\\')
	{
		_isFinished = true;
		CheckType();
		return;
	}

	int listcount = _words->count();
	_isFinished = true;
	for (int i = 0; i < listcount; i++)
	{
		if (strchr((char*)_words->get(i), ch) != nullptr)
		{
			_isFinished = false;
			_buffer[_step++] = ch;
			_buffer[_step] = '\0';
			break;
		}
	}

	if (_isFinished)
	{
		if (_buffer[strlen(_buffer) - 1] != _buffer[0])
		{
			_isFinished = false;
			_isError = true;
		}
	}
}
Esempio n. 12
0
    void ParseNumericArray( lua_State *L, int StackIndex, std::vector< Uint8 >& RawData )
    {
        typedef typename VALUE_TYPE2CType<VTType>::CType ElemType;
        CheckType( L, StackIndex, LUA_TTABLE );
        auto ArraySize = lua_rawlen( L, StackIndex );

        auto ElemSize = sizeof( ElemType );
        RawData.reserve( ArraySize * ElemSize );

        ParseLuaArray( L, StackIndex, &RawData, [ &]( void* pBasePointer, int StackIndex, int NewArrayIndex )
        {
            VERIFY( pBasePointer == &RawData, "Sanity check failed" );
            auto CurrIndex = RawData.size() / ElemSize;
            if(static_cast<int>(CurrIndex) != NewArrayIndex - 1 )
                SCRIPT_PARSING_ERROR( L, "Explicit array indices are not allowed in array initialization. Provided index ", NewArrayIndex - 1, " conflicts with actual index ", CurrIndex, "." );
            RawData.resize( (CurrIndex + 1) * ElemSize );
            auto CurrValue = ReadValueFromLua<double>( L, StackIndex );
            reinterpret_cast<ElemType&>(RawData[CurrIndex * ElemSize]) = static_cast<ElemType>(CurrValue);
        } );
    }
Esempio n. 13
0
 //---------------------------------------------------------------------------
 const matrix_type& Value::GetArray() const
 {
   CheckType('m');
   assert(m_pvVal!=nullptr);
   return *m_pvVal;
 }
Esempio n. 14
0
 //---------------------------------------------------------------------------
 bool Value::GetBool() const
 {
   CheckType('b');
   return m_val.real()==1;
 }
Esempio n. 15
0
 //---------------------------------------------------------------------------
 const string_type& Value::GetString() const
 {
   CheckType('s');
   assert(m_psVal!=nullptr);
   return *m_psVal;
 }
Esempio n. 16
0
 Bool ReadValueFromLua<Bool>( lua_State *L, int Index )
 {
     CheckType( L, Index, LUA_TBOOLEAN );
     auto Val = lua_toboolean( L, Index );
     return Val ? True : False;
 }
Esempio n. 17
0
File: VM.cpp Progetto: Gwill/luna
    void VM::ExecuteFrame()
    {
        CallInfo *call = &state_->calls_.back();
        Closure *cl = call->func_->closure_;
        Function *proto = cl->GetPrototype();
        Value *a = nullptr;
        Value *b = nullptr;
        Value *c = nullptr;

        while (call->instruction_ < call->end_)
        {
            state_->CheckRunGC();
            Instruction i = *call->instruction_++;

            switch (Instruction::GetOpCode(i)) {
                case OpType_LoadNil:
                    a = GET_REGISTER_A(i);
                    GET_REAL_VALUE(a)->SetNil();
                    break;
                case OpType_LoadBool:
                    a = GET_REGISTER_A(i);
                    GET_REAL_VALUE(a)->SetBool(Instruction::GetParamB(i) ? true : false);
                    break;
                case OpType_LoadInt:
                    a = GET_REGISTER_A(i);
                    assert(call->instruction_ < call->end_);
                    a->num_ = (*call->instruction_++).opcode_;
                    a->type_ = ValueT_Number;
                    break;
                case OpType_LoadConst:
                    a = GET_REGISTER_A(i);
                    b = GET_CONST_VALUE(i);
                    *GET_REAL_VALUE(a) = *b;
                    break;
                case OpType_Move:
                    a = GET_REGISTER_A(i);
                    b = GET_REGISTER_B(i);
                    *GET_REAL_VALUE(a) = *GET_REAL_VALUE(b);
                    break;
                case OpType_Call:
                    a = GET_REGISTER_A(i);
                    if (Call(a, i)) return ;
                    break;
                case OpType_GetUpvalue:
                    a = GET_REGISTER_A(i);
                    b = GET_UPVALUE_B(i)->GetValue();
                    *GET_REAL_VALUE(a) = *b;
                    break;
                case OpType_SetUpvalue:
                    a = GET_REGISTER_A(i);
                    b = GET_UPVALUE_B(i)->GetValue();
                    *b = *a;
                    break;
                case OpType_GetGlobal:
                    a = GET_REGISTER_A(i);
                    b = GET_CONST_VALUE(i);
                    *GET_REAL_VALUE(a) = state_->global_.table_->GetValue(*b);
                    break;
                case OpType_SetGlobal:
                    a = GET_REGISTER_A(i);
                    b = GET_CONST_VALUE(i);
                    state_->global_.table_->SetValue(*b, *a);
                    break;
                case OpType_Closure:
                    a = GET_REGISTER_A(i);
                    GenerateClosure(a, i);
                    break;
                case OpType_VarArg:
                    a = GET_REGISTER_A(i);
                    CopyVarArg(a, i);
                    break;
                case OpType_Ret:
                    a = GET_REGISTER_A(i);
                    return Return(a, i);
                case OpType_JmpFalse:
                    a = GET_REGISTER_A(i);
                    if (GET_REAL_VALUE(a)->IsFalse())
                        call->instruction_ += -1 + Instruction::GetParamsBx(i);
                    break;
                case OpType_JmpTrue:
                    a = GET_REGISTER_A(i);
                    if (!GET_REAL_VALUE(a)->IsFalse())
                        call->instruction_ += -1 + Instruction::GetParamsBx(i);
                    break;
                case OpType_JmpNil:
                    a = GET_REGISTER_A(i);
                    if (a->type_ == ValueT_Nil)
                        call->instruction_ += -1 + Instruction::GetParamsBx(i);
                    break;
                case OpType_Jmp:
                    call->instruction_ += -1 + Instruction::GetParamsBx(i);
                    break;
                case OpType_Neg:
                    a = GET_REGISTER_A(i);
                    CheckType(a, ValueT_Number, "neg");
                    a->num_ = -a->num_;
                    break;
                case OpType_Not:
                    a = GET_REGISTER_A(i);
                    a->SetBool(a->IsFalse() ? true : false);
                    break;
                case OpType_Len:
                    a = GET_REGISTER_A(i);
                    if (a->type_ == ValueT_Table)
                        a->num_ = a->table_->ArraySize();
                    else if (a->type_ == ValueT_String)
                        a->num_ = a->str_->GetLength();
                    else
                        ReportTypeError(a, "length of");
                    a->type_ = ValueT_Number;
                    break;
                case OpType_Add:
                    GET_REGISTER_ABC(i);
                    CheckArithType(b, c, "add");
                    a->num_ = b->num_ + c->num_;
                    a->type_ = ValueT_Number;
                    break;
                case OpType_Sub:
                    GET_REGISTER_ABC(i);
                    CheckArithType(b, c, "sub");
                    a->num_ = b->num_ - c->num_;
                    a->type_ = ValueT_Number;
                    break;
                case OpType_Mul:
                    GET_REGISTER_ABC(i);
                    CheckArithType(b, c, "multiply");
                    a->num_ = b->num_ * c->num_;
                    a->type_ = ValueT_Number;
                    break;
                case OpType_Div:
                    GET_REGISTER_ABC(i);
                    CheckArithType(b, c, "div");
                    a->num_ = b->num_ / c->num_;
                    a->type_ = ValueT_Number;
                    break;
                case OpType_Pow:
                    GET_REGISTER_ABC(i);
                    CheckArithType(b, c, "power");
                    a->num_ = pow(b->num_, c->num_);
                    a->type_ = ValueT_Number;
                    break;
                case OpType_Mod:
                    GET_REGISTER_ABC(i);
                    CheckArithType(b, c, "mod");
                    a->num_ = fmod(b->num_, c->num_);
                    a->type_ = ValueT_Number;
                    break;
                case OpType_Concat:
                    GET_REGISTER_ABC(i);
                    Concat(a, b, c);
                    break;
                case OpType_Less:
                    GET_REGISTER_ABC(i);
                    CheckInequalityType(b, c, "compare(<)");
                    if (b->type_ == ValueT_Number)
                        a->SetBool(b->num_ < c->num_);
                    else
                        a->SetBool(*b->str_ < *c->str_);
                    break;
                case OpType_Greater:
                    GET_REGISTER_ABC(i);
                    CheckInequalityType(b, c, "compare(>)");
                    if (b->type_ == ValueT_Number)
                        a->SetBool(b->num_ > c->num_);
                    else
                        a->SetBool(*b->str_ > *c->str_);
                    break;
                case OpType_Equal:
                    GET_REGISTER_ABC(i);
                    a->SetBool(*b == *c);
                    break;
                case OpType_UnEqual:
                    GET_REGISTER_ABC(i);
                    a->SetBool(*b != *c);
                    break;
                case OpType_LessEqual:
                    GET_REGISTER_ABC(i);
                    CheckInequalityType(b, c, "compare(<=)");
                    if (b->type_ == ValueT_Number)
                        a->SetBool(b->num_ <= c->num_);
                    else
                        a->SetBool(*b->str_ <= *c->str_);
                    break;
                case OpType_GreaterEqual:
                    GET_REGISTER_ABC(i);
                    CheckInequalityType(b, c, "compare(>=)");
                    if (b->type_ == ValueT_Number)
                        a->SetBool(b->num_ >= c->num_);
                    else
                        a->SetBool(*b->str_ >= *c->str_);
                    break;
                case OpType_NewTable:
                    a = GET_REGISTER_A(i);
                    a->table_ = state_->NewTable();
                    a->type_ = ValueT_Table;
                    break;
                case OpType_SetTable:
                    GET_REGISTER_ABC(i);
                    CheckTableType(a, b, "set", "to");
                    if (a->type_ == ValueT_Table)
                        a->table_->SetValue(*b, *c);
                    else if (a->type_ == ValueT_UserData)
                        a->user_data_->GetMetatable()->SetValue(*b, *c);
                    else
                        assert(0);
                    break;
                case OpType_GetTable:
                    GET_REGISTER_ABC(i);
                    CheckTableType(a, b, "get", "from");
                    if (a->type_ == ValueT_Table)
                        *c = a->table_->GetValue(*b);
                    else if (a->type_ == ValueT_UserData)
                        *c = a->user_data_->GetMetatable()->GetValue(*b);
                    else
                        assert(0);
                    break;
                case OpType_ForInit:
                    GET_REGISTER_ABC(i);
                    ForInit(a, b, c);
                    break;
                case OpType_ForStep:
                    GET_REGISTER_ABC(i);
                    i = *call->instruction_++;
                    if ((c->num_ > 0.0 && a->num_ > b->num_) ||
                        (c->num_ <= 0.0 && a->num_ < b->num_))
                        call->instruction_ += -1 + Instruction::GetParamsBx(i);
                    break;
                default:
                    break;
            }
        }

        Value *new_top = call->func_;
        // Reset top value
        state_->stack_.SetNewTop(new_top);
        // Set expect results
        if (call->expect_result_ != EXP_VALUE_COUNT_ANY)
            state_->stack_.SetNewTop(new_top + call->expect_result_);

        // Pop current CallInfo, and return to last CallInfo
        state_->calls_.pop_back();
    }
TEST(property_type, CheckType_size) {
    EXPECT_TRUE(CheckType("size", ""));
    EXPECT_FALSE(CheckType("size", "ab"));
    EXPECT_FALSE(CheckType("size", "abcd"));
    EXPECT_FALSE(CheckType("size", "0"));

    EXPECT_TRUE(CheckType("size", "512g"));
    EXPECT_TRUE(CheckType("size", "512k"));
    EXPECT_TRUE(CheckType("size", "512m"));

    EXPECT_FALSE(CheckType("size", "512gggg"));
    EXPECT_FALSE(CheckType("size", "512mgk"));
    EXPECT_FALSE(CheckType("size", "g"));
    EXPECT_FALSE(CheckType("size", "m"));
}
Esempio n. 19
0
static VALUE ReadProxy (VALUE self, VALUE mqs) {
  SETUP_mqctx
  CheckType(mqs, cMqS, "usage: ReadProxy MqS-Type-Arg");
  ErrorMqToRubyWithCheck(MqReadProxy(mqctx, VAL2MqS(mqs)));
  return Qnil;
}
Esempio n. 20
0
void ParseUnary()
{
  while(Token==TOK_SUB || Token==TOK_NOT || Token==TOK_NEG || 
        Token==TOK_MUL || Token==TOK_AND ||
        Token==TOK_INC || Token==TOK_DEC)
  {
    Match();
    Out(" ");
  }

  if(IsScopedName())
    ParseScopedName();
  else
  {
    switch(Token)
    {
    case TOK_VALUE:
      Match();
      break;
    case TOK_OPEN:      
      Match();
      if(CheckType())       // cast
      {
        ParseFunctionPtrType();
        //ParseType();
        Match(TOK_CLOSE);
        ParseExpr();
      }
      else                      // subexpression
      {
        ParseExpr();
        Match(TOK_CLOSE);
      }
      break;
    case TOK_SIZEOF:
      Match();
      if(Token==TOK_OPEN)
      {
        Match(TOK_OPEN);
        ParseSizeofExpr();
        Match(TOK_CLOSE);
      }
      else
      {
        Out("(");
        ParseSizeofExpr();
        Out(")");
      }
      break;
    case TOK_NEW:
      Match();
      Out(" ");
      ParseType();
      break;
    default:
      Error("expression");
      break;
    }
  }
/*
  if(Token==TOK_LT)
  {
    ScanSafe();
    Scan();
    if(CheckType())
    {
      Out("<");
      ParseType();
      Match(TOK_GT);
    }
    else
    {
      ScanRestore();
    }
  }
*/
  if(Token==TOK_LT && ACheckType())
  {
    Match(TOK_LT);
    ParseType();
    Match(TOK_GT);
  }
  while(Token==TOK_INC || Token==TOK_DEC || Token==TOK_DOT || Token==TOK_OPEN || Token==TOK_SOPEN || (Token==TOK_LT && Peek()==TOK_TYPE))
  {
    switch(Token)
    {
    case TOK_LT:
      Match(TOK_LT);
      Match(TOK_TYPE);
      Match(TOK_GT);
      break;
    case TOK_INC:
    case TOK_DEC:
      Match();
      Out(" ");
      break;
    case TOK_DOT:
      Match(TOK_DOT);
      Match(TOK_NAME);
      break;
    case TOK_OPEN:
      Match();
      if(Token!=TOK_CLOSE)
      {
        ParseExpr();
        while(Token!=TOK_CLOSE)
        {
          Match(TOK_COMMA);
          ParseExpr();
        }
      }
      Match();
      break;
    case TOK_SOPEN:
      Match(TOK_SOPEN);
      ParseExpr();
      Match(TOK_SCLOSE);
      break;
    }
  }
}
Esempio n. 21
0
void ParseStatement()
{
  sInt elsemod;

  if(CheckType())
  {
    NewLine();
    ParseDecl();
    return;
  }
  switch(Token)
  {
  case TOK_PRE:
    Out("\n");
    Match();
    break;
  case TOK_WHILE:
    NewLine();
    Match();
    Match(TOK_OPEN);
    ParseAssignExpr();
    Match(TOK_CLOSE);
    ParseCondBlock();
    //ParseStatement();
    break;

  case TOK_SWITCH:
    NewLine();
    Match();
    Match(TOK_OPEN);
    ParseAssignExpr();
    Match(TOK_CLOSE);
    ParseSwitchBlock();
    break;
    /*
  case TOK_CASE:
    NewLine(-1);
    Match();
    Out(" ");
    if(Token==TOK_VALUE)
    {
      Match();
      Match(TOK_COLON);
    }
    else if(Token==TOK_LABEL)
    {
      Match();
    }
    else
    {
      Error("case label");
    }
    break;
    */

  case TOK_BREAK:
    NewLine();
    Match();
    Match(TOK_SEMI);
    break;
  case TOK_RETURN:
    NewLine();
    Match();
    Out(" ");
    if(Token!=TOK_SEMI)
      ParseAssignExpr();
    Match(TOK_SEMI);
    break;
  case TOK_IF:
    NewLine();
    Match(TOK_IF);
    Match(TOK_OPEN);
    ParseAssignExpr();
    Match(TOK_CLOSE);
    ParseCondBlock(&elsemod,sFALSE);
    if(Token==TOK_ELSE)
    {
      NewLine();
      Match(TOK_ELSE);
      ParseCondBlock(&elsemod,sTRUE);
    }
    else
    {
      if(Mode == 1)
      {
        NewLine();
        OutF("else");
        OutBOpen();
        NewLine();
        OutF("sLekktor_%s.Set(%d);",LekktorName,elsemod);
        OutBClose();
      }
    }
    break;

  case TOK_ASM:
    NewLine();
    Match(TOK_ASM);
    InlineAssembly();
    if(Token==TOK_SEMI)
      Match();
    break;

  case TOK_FOR:
    NewLine();
    Match(TOK_FOR);
    Match(TOK_OPEN);
    if(Token!=TOK_SEMI)
    {
      if(CheckType())
      {
        ParseDecl();
      }
      else
      {
        ParseAssignExpr();
        Match(TOK_SEMI);
      }
    }
    else
      Match();
    if(Token!=TOK_SEMI)
      ParseAssignExpr();
    Match(TOK_SEMI);
    if(Token!=TOK_CLOSE)
      ParseAssignExpr();
    Match(TOK_CLOSE);
    ParseCondBlock();
    break;
  case TOK_DO:
    NewLine();
    Match(TOK_DO);
    ParseCondBlock();
    NewLine();
    Match(TOK_WHILE);
    Match(TOK_OPEN);
    ParseAssignExpr();
    Match(TOK_CLOSE);
    Match(TOK_SEMI);
    break;
  case TOK_BOPEN:
    ParseBlock();
    break;
  case TOK_DELETEA:
  case TOK_DELETE:
    NewLine();
    Match();
    Out(" ");
    ParseExpr();
    Match(TOK_SEMI);
    break;
  case TOK_GOTO:
    NewLine();
    Match(TOK_GOTO);
    Out(" ");    
    Match(TOK_NAME);
    Match(TOK_SEMI);
    break;
  case TOK_SEMI:
    NewLine();
    Match();
    break;
  case TOK_TYPEDEF:
    NewLine();
    Match();
    Out(" ");
    intypedef = sTRUE;
    gottype = sFALSE;
    ParseFunctionPtrType();
    intypedef = sFALSE;
    Out(" ");
    if(Token == TOK_NAME)
    {
      AddType(Value);
      Match();
    }
    else if(!gottype)
      Error("typedef error");
    Match(TOK_SEMI);
    break;
  case TOK_NAMESPACE:
    NewLine();
    Match();
    Out(" ");
    if(Token==TOK_NAME) // name may be omitted
      Match(TOK_NAME);
    ParseBlock();
    break;
  case TOK_USING:
    NewLine();
    Match();
    Out(" ");
    if(Token==TOK_NAMESPACE)
    {
      Match();
      Out(" ");
    }
    ParseScopedName();
    Match(TOK_SEMI);
    break;
  case TOK_VCTRY:
    NewLine();
    Match();
    ParseStatement();
    if(Token == TOK_VCEXCEPT)
    {
      NewLine();
      Match();
      Match(TOK_OPEN);
      ParseExpr();
      Match(TOK_CLOSE);
      ParseStatement();
    }
    break;
  case TOK_NAME:
    if(Peek() == TOK_COLON)
    {
      NewLine();
      Match();
      Match();
      break;
    }
    // fall-through
  /*case TOK_LABEL:
    NewLine();
    Match();
    break;*/
  default:
    NewLine();
    ParseAssignExpr();
    Match(TOK_SEMI);
    break;
  }
}
Esempio n. 22
0
//============================================================================
//起動
//============================================================================
void CResourceManager::Run()
{
	for(;;)
	{
		CFileData *pFile = NULL;
		Sint32 ActivePage = -1;
		
		/*終了チェック*/
		if( m_Event.IsSignal() )
		{
			break;
		}
		
		/*今回取得するリストを取得*/
		m_CS.Enter();
		
		/*これから処理するページ*/
		ActivePage = m_Page;
		
		/*ページ切り替え*/
		m_Page = 1 - m_Page;
		
		/*先頭を取得*/
		pFile = m_pQueTop[ActivePage];
		
		m_CS.Leave();
		
		if( pFile == NULL )
		{
			::Sleep( 250 );
			
			continue;
		}
		
		while( pFile != NULL )
		{
			/*リソースタイプを判別*/
			CheckType( pFile );
			
			/*次を取得*/
			CFileData *pNext = pFile->GetNext();
			
			/*現在のものを削除*/
			delete pFile;
			
			pFile = pNext;
			
		}
		
		/*リスト初期化*/
		m_pQueTop[ActivePage] = NULL;
		
	}
	
	//----------------------------------------------------------------------------
	//キューの中身をクリア
	//----------------------------------------------------------------------------
	for( Sint32 i = 0;i < QUE_MAX;++i )
	{
		CFileData *pFile = m_pQueTop[i];
		
		while( pFile != NULL )
		{
			CFileData *pNext = pFile->GetNext();
			delete pFile ;
			pFile = pNext;
		}
		
		m_pQueTop[i] = NULL;
	}

	
}