Пример #1
0
int ProcessMp3Conversion(int pip0,int pip1,int Pid) {
     int ch,Asp;
     char buff[1000],Fifo[100];
     float TotSec=0.,CurSec=0.;
     Tools=1;
     TotSec=0;
     Pval=0;
     sprintf(Fifo,"Fifo%-d",getpid());
     MonPipe=pip0;
#if 0
     while((ch=GetLine(pip0,buff)) ) {
//         printf("%s\n",buff);
//         fflush(stdout);
         if(ch< 0) continue;
         if(buff[0]==' ') continue;
         if(CheckString(buff,(char *)"T:")) {
               sscanf(buff+2,"%f",&(TotSec));
               fprintf(stderr,"Totsec= %f\n",TotSec);
               continue;
         }
         if(CheckString(buff,(char *)"A:")) {
               sscanf(buff+2,"%f",&(CurSec));
               fprintf(stderr,"Totsec= %f %f\n",TotSec,CurSec);
               if(TotSec!=0 ) {
                 Pval = CurSec/TotSec*100.0;
               }
               continue;
         }
     }
#else
     Runmonitor();
#endif
//     fprintf(stderr,"mplayer over\n");
     return 1;
}
Пример #2
0
wxString wxTextValidator::IsValid(const wxString& val) const
{
    // wxFILTER_EMPTY is checked for in wxTextValidator::Validate

    if ( HasFlag(wxFILTER_ASCII) && !val.IsAscii() )
        return _("'%s' should only contain ASCII characters.");
    if ( HasFlag(wxFILTER_ALPHA) && !CheckString(wxIsalpha, val) )
        return _("'%s' should only contain alphabetic characters.");
    if ( HasFlag(wxFILTER_ALPHANUMERIC) && !CheckString(wxIsalnum, val) )
        return _("'%s' should only contain alphabetic or numeric characters.");
    if ( HasFlag(wxFILTER_DIGITS) && !CheckString(wxIsdigit, val) )
        return _("'%s' should only contain digits.");
    if ( HasFlag(wxFILTER_NUMERIC) && !wxIsNumeric(val) )
        return _("'%s' should be numeric.");
    if ( HasFlag(wxFILTER_INCLUDE_LIST) && m_includes.Index(val) == wxNOT_FOUND )
        return _("'%s' is invalid");
    if ( HasFlag(wxFILTER_INCLUDE_CHAR_LIST) && !ContainsOnlyIncludedCharacters(val) )
        return _("'%s' is invalid");
    if ( HasFlag(wxFILTER_EXCLUDE_LIST) && m_excludes.Index(val) != wxNOT_FOUND )
        return _("'%s' is invalid");
    if ( HasFlag(wxFILTER_EXCLUDE_CHAR_LIST) && ContainsExcludedCharacters(val) )
        return _("'%s' is invalid");

    return wxEmptyString;
}
Пример #3
0
bool QACheck::CheckItem(CatalogItemPtr item)
{
    if (!item->GetTranslation().empty() && CheckString(item, item->GetString(), item->GetTranslation()))
        return true;

    if (item->HasPlural())
    {
        unsigned count = item->GetNumberOfTranslations();
        for (unsigned i = 1; i < count; i++)
        {
            auto t = item->GetTranslation(i);
            if (!t.empty() && CheckString(item, item->GetPluralString(), t))
                return true;
        }
    }

    return false;
}
Пример #4
0
void __fastcall TOptionsForm::Button5Click(TObject *Sender)
{
   try
   {
   AcfParams.angle_init=CheckString(Edit18->Text.t_str());
   AcfParams.angle_step=CheckString(Edit19->Text.t_str());
   device.deviceSettings.Angle=CheckString(Edit9->Text.t_str());
   device.deviceSettings.Frequency=ComboBox1->ItemIndex;
   device.deviceSettings.Temperature=CheckString(Edit8->Text.t_str());
   device.deviceSettings.ReadDataBlock=Edit11->Text.ToInt();

   AcfParams.lfd=CheckBox1->Checked;
   AcfParams.feu=CheckBox2->Checked;

   if(! device.SetFrequency(device.deviceSettings.Frequency))
	 Abort();


   if (AcfParams.lfd) {
	 if(! device.SetPhotomultiplierState(AcfParams.lfd) )
		 Abort();
   }

   if(! device.SetTemperature(device.deviceSettings.Temperature ) )
	 Abort();

	  /*
   if (AcfParams.feu) {
	 MainForm->edtFEU_Init();
   }    */

   if (! device.SetAngle(device.deviceSettings.Angle))
	 Abort();

   }
   catch (...)
   {
	 ShowMessage("Прибор не подключен");
//	 Application->MessageBox(L"Прибор не подключен",L"Ошибка",MB_OK | MB_ICONERROR);
   }
}
Пример #5
0
// ID 유효성검사유효성검사
BOOL CRegNewUserDlg::CheckUserId(const CString& strSrcId, int nID/*=-1*/)
{
	// 1-20자리
	
	if( strSrcId.GetLength() > 20 )
	{
		AfxMessageBox("사용자ID는 20자리 이하의 영문 또는 영문,숫자 조합입니다", MB_ICONINFORMATION);
		
		if( nID != -1 )
		{
			GetDlgItem(nID)->SetFocus();
			((CEdit*)GetDlgItem(nID)) ->SetSel(0,-1);			
		}

		return FALSE;
	}
	else
	{
		// 숫자로 시작못함
		if( strSrcId.GetAt(0) >= '0' && strSrcId.GetAt(0) <= '9' )
		{
			AfxMessageBox("사용자ID는 숫자로 시작할 수 없습니다", MB_ICONINFORMATION);
			
			if( nID != -1 ){
				GetDlgItem(nID)->SetFocus();
				((CEdit*)GetDlgItem(nID))->SetSel(0,-1);
			}

			return FALSE;
		}

		int nAlphaCap, nAlphaLow, nNumeric, nOther;
		CheckString(strSrcId, nAlphaCap, nAlphaLow, nNumeric, nOther);

		// 특수문자금지!!
		if( nOther > 0 )
		{
			AfxMessageBox("사용자ID는 6-8자리의 영문 또는 영문,숫자 조합입니다\n특수문자 사용불가!!", MB_ICONINFORMATION);
			
			if( nID != -1 )
			{
				GetDlgItem(nID)->SetFocus();
				((CEdit*)GetDlgItem(nID))->SetSel(0,-1);
			}

			return FALSE;
		}		
	}
	

	return TRUE;
}
Пример #6
0
/*
Stops the robot.
Plays a sound.
Makes the robot charge straight ahead untill it is either interrupted,
the pressure sensor gets triggered or a certain amount of time has passed.
*/
void Charge(){
	int ccounter = 0;
	Straight(0);
  playSoundFile("charge.rso");
	wait1Msec(3000);
  Straight(100);
  while ((ccounter <2000)&&( s=="B")&& (SensorValue(S1)==0)){
  	ccounter ++;
   	wait1Msec(1);
   	CheckString();
	}
	s = "";
	Straight(0);
}
Пример #7
0
int SearchString(char *s1,char *s2) {
   int ch,ln,ret=-1,ln1,i=0;
   ln = strlen(s2);
   ln1 = strlen(s1);
   if(ln1<ln) ret=-1;
   else {
    i=0;
    for(i=0;i<=(ln1-ln);i++) {
      if(CheckString(s1+i,s2)){
        ret=i;
        break;
      }
    }
   }
   return ret;
}
LRESULT CCO2_View::Save_List_Item(WPARAM wParam,LPARAM lParam)
{
	int Changed_Item = (int)wParam;
	int Changed_SubItem = (int)lParam;
	int temp_write_reg = 0;
	int temp_reg_value = 0;
	CString temp_list_cstring;
	CString temp_cs_change_info;
	temp_list_cstring = m_co2_external_sensor_list.GetItemText(Changed_Item,Changed_SubItem);
	if(CheckString(temp_list_cstring)==false)
		return 1;
	temp_reg_value = _wtoi(temp_list_cstring);
	if(Changed_SubItem == CO2_EXTERNAL_PPM)
	{
		temp_write_reg = CO2_485_MODBUS_EXTERNAL_CO2_PPM_START + Changed_Item;
		temp_cs_change_info.Format(_T("External PPM"));
	}
	else if(Changed_SubItem == CO2_EXTERNAL_PRE_ALARM_SP)
	{
		temp_write_reg = CO2_485_MODBUS_EXT_PRE_ALARM_SETPOINT_START + Changed_Item;
		temp_cs_change_info.Format(_T("External Prepare Alarm Setpoint"));
	}
	else if(Changed_SubItem == CO2_EXTERNAL_ALARM_SP)
	{
		temp_write_reg = CO2_485_MODBUS_EXT_ALARM_SETPOINT_START + Changed_Item;
		temp_cs_change_info.Format(_T("Alarm Setpoint"));	
	}
	else if(Changed_SubItem == CO2_EXTERNAL_CAL_OFFSET)
	{
		temp_write_reg = CO2_485_MODBUS_EXT_CO2_OFFSET_START + Changed_Item;
		temp_cs_change_info.Format(_T("Calibrating Offset"));	
	}
	else
	{
		return -2;
	}

	if(temp_reg_value != product_register_value[temp_write_reg])
	{
		Post_Thread_Message(MY_WRITE_ONE,g_tstat_id,temp_write_reg,temp_reg_value,
			product_register_value[temp_write_reg],this->m_hWnd,IDC_LIST_CO2_EXTERNAL_SENSOR,temp_cs_change_info);
	}

		return 0;
}
Пример #9
0
	PClassActor *CheckActorType(const char *key)
	{
		if (namespace_bits == St)
		{
			return GetStrifeType(CheckInt(key));
		}
		else if (namespace_bits == Zd)
		{
			PClassActor *cls = PClass::FindActor(CheckString(key));
			if (cls == NULL)
			{
				sc.ScriptMessage("Unknown actor class '%s'", key);
				return NULL;
			}
			return cls;
		}
		return NULL;
	}
Пример #10
0
void 
Scene::readScene(domVisual_sceneRef scene)
{
  const std::string scene_name = CheckString(scene->getName());
  std::ostringstream os;
  os << "Reading Collada scene '" << scene_name << "'";
  os << std::ends;
	this->scene_graph.printStatusMessage(os.str()); 	

  bool inserted;
  SceneGraph::IdVertexMap::iterator pos;
  SceneGraph::node_id_map_t node_id = get(SceneGraph::node_info_t(), this->scene_graph.node_graph);
  tie(pos, inserted) = this->scene_graph.id_vertex_map.insert(std::make_pair(scene->getId(), SceneGraph::Vertex()));
  if(inserted)
  {
    this->scene_graph.root = add_vertex(this->scene_graph.node_graph);
    node_id[this->scene_graph.root].id = scene->getId();
    node_id[this->scene_graph.root].sid = "";
    pos->second = this->scene_graph.root;
    this->scene_graph.all_nodes.insert(scene->getID(), Node());
    this->scene_graph.all_nodes.find(scene->getID())->name = scene_name;
  } else
    this->scene_graph.root = pos->second;

	// recurse through the scene, read and add nodes 
  const domNode_Array &nodes = scene->getNode_array();
	for(size_t i = 0; i < nodes.getCount(); ++i)
	{
		this->readNode(nodes.get(i), this->scene_graph.root);
	}

  // calculate bounding boxes for font elements
  for(int j = 0; j < this->scene_graph.all_nodes.size(); ++j)
  {
    Node *n = this->scene_graph.all_nodes.getAtIndex(j);
    if(n->is_font_node)
      n->calcBoundingBox(this->scene_graph.all_geometries);
  }
}
Пример #11
0
	const PClass *CheckActorType(const char *key)
	{
		if (namespace_bits == St)
		{
			return GetStrifeType(CheckInt(key));
		}
		else if (namespace_bits == Zd)
		{
			const PClass *cls = PClass::FindClass(CheckString(key));
			if (cls == NULL)
			{
				sc.ScriptMessage("Unknown actor class '%s'", key);
				return NULL;
			}
			if (!cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
			{
				sc.ScriptMessage("'%s' is not an actor type", key);
				return NULL;
			}
			return cls;
		}
		return NULL;
	}
Пример #12
0
void strStream::Output_Check()
{
    CheckString("Hello world!");
    CheckString(wxString("hi\0dden", 8));
}
Пример #13
0
	void ParseThing(FMapThing *th)
	{
		FString arg0str, arg1str;

		memset(th, 0, sizeof(*th));
		th->gravity = FRACUNIT;
		th->RenderStyle = STYLE_Count;
		th->alpha = -1;
		th->health = 1;
		sc.MustGetToken('{');
		while (!sc.CheckToken('}'))
		{
			FName key = ParseKey();
			switch(key)
			{
			case NAME_Id:
				th->thingid = CheckInt(key);
				break;

			case NAME_X:
				th->x = CheckFixed(key);
				break;

			case NAME_Y:
				th->y = CheckFixed(key);
				break;

			case NAME_Height:
				th->z = CheckFixed(key);
				break;

			case NAME_Angle:
				th->angle = (short)CheckInt(key);
				break;

			case NAME_Type:
				th->type = (short)CheckInt(key);
				break;

			case NAME_Conversation:
				CHECK_N(Zd | Zdt)
				th->Conversation = CheckInt(key);
				break;

			case NAME_Special:
				CHECK_N(Hx | Zd | Zdt | Va)
				th->special = CheckInt(key);
				break;

			case NAME_Gravity:
				CHECK_N(Zd | Zdt)
				th->gravity = CheckFixed(key);
				break;

			case NAME_Arg0:
			case NAME_Arg1:
			case NAME_Arg2:
			case NAME_Arg3:
			case NAME_Arg4:
				CHECK_N(Hx | Zd | Zdt | Va)
				th->args[int(key)-int(NAME_Arg0)] = CheckInt(key);
				break;

			case NAME_Arg0Str:
				CHECK_N(Zd);
				arg0str = CheckString(key);
				break;

			case NAME_Arg1Str:
				CHECK_N(Zd);
				arg1str = CheckString(key);
				break;

			case NAME_Skill1:
			case NAME_Skill2:
			case NAME_Skill3:
			case NAME_Skill4:
			case NAME_Skill5:
			case NAME_Skill6:
			case NAME_Skill7:
			case NAME_Skill8:
			case NAME_Skill9:
			case NAME_Skill10:
			case NAME_Skill11:
			case NAME_Skill12:
			case NAME_Skill13:
			case NAME_Skill14:
			case NAME_Skill15:
			case NAME_Skill16:
				if (CheckBool(key)) th->SkillFilter |= (1<<(int(key)-NAME_Skill1));
				else th->SkillFilter &= ~(1<<(int(key)-NAME_Skill1));
				break;

			case NAME_Class1:
			case NAME_Class2:
			case NAME_Class3:
			case NAME_Class4:
			case NAME_Class5:
			case NAME_Class6:
			case NAME_Class7:
			case NAME_Class8:
			case NAME_Class9:
			case NAME_Class10:
			case NAME_Class11:
			case NAME_Class12:
			case NAME_Class13:
			case NAME_Class14:
			case NAME_Class15:
			case NAME_Class16:
				CHECK_N(Hx | Zd | Zdt | Va)
				if (CheckBool(key)) th->ClassFilter |= (1<<(int(key)-NAME_Class1));
				else th->ClassFilter &= ~(1<<(int(key)-NAME_Class1));
				break;

			case NAME_Ambush:
				Flag(th->flags, MTF_AMBUSH, key); 
				break;

			case NAME_Dormant:
				CHECK_N(Hx | Zd | Zdt | Va)
				Flag(th->flags, MTF_DORMANT, key); 
				break;

			case NAME_Single:
				Flag(th->flags, MTF_SINGLE, key); 
				break;

			case NAME_Coop:
				Flag(th->flags, MTF_COOPERATIVE, key); 
				break;

			case NAME_Dm:
				Flag(th->flags, MTF_DEATHMATCH, key); 
				break;

			case NAME_Translucent:
				CHECK_N(St | Zd | Zdt | Va)
				Flag(th->flags, MTF_SHADOW, key); 
				break;

			case NAME_Invisible:
				CHECK_N(St | Zd | Zdt | Va)
				Flag(th->flags, MTF_ALTSHADOW, key); 
				break;

			case NAME_Friend:	// This maps to Strife's friendly flag
				CHECK_N(Dm | Zd | Zdt | Va)
				Flag(th->flags, MTF_FRIENDLY, key); 
				break;

			case NAME_Strifeally:
				CHECK_N(St | Zd | Zdt | Va)
				Flag(th->flags, MTF_FRIENDLY, key); 
				break;

			case NAME_Standing:
				CHECK_N(St | Zd | Zdt | Va)
				Flag(th->flags, MTF_STANDSTILL, key); 
				break;

			case NAME_Countsecret:
				CHECK_N(Zd | Zdt | Va)
				Flag(th->flags, MTF_SECRET, key); 
				break;

			case NAME_Renderstyle:
				{
				FName style = CheckString(key);
				switch (style)
				{
				case NAME_None:
					th->RenderStyle = STYLE_None;
					break;
				case NAME_Normal:
					th->RenderStyle = STYLE_Normal;
					break;
				case NAME_Fuzzy:
					th->RenderStyle = STYLE_Fuzzy;
					break;
				case NAME_SoulTrans:
					th->RenderStyle = STYLE_SoulTrans;
					break;
				case NAME_OptFuzzy:
					th->RenderStyle = STYLE_OptFuzzy;
					break;
				case NAME_Stencil:
					th->RenderStyle = STYLE_Stencil;
					break;
				case NAME_AddStencil:
					th->RenderStyle = STYLE_AddStencil;
					break;
				case NAME_Translucent:
					th->RenderStyle = STYLE_Translucent;
					break;
				case NAME_Add:
				case NAME_Additive:
					th->RenderStyle = STYLE_Add;
					break;
				case NAME_Shaded:
					th->RenderStyle = STYLE_Shaded;
					break;
				case NAME_AddShaded:
					th->RenderStyle = STYLE_AddShaded;
					break;
				case NAME_TranslucentStencil:
					th->RenderStyle = STYLE_TranslucentStencil;
					break;
				case NAME_Shadow:
					th->RenderStyle = STYLE_Shadow;
					break;
				case NAME_Subtract:
				case NAME_Subtractive:
					th->RenderStyle = STYLE_Subtract;
					break;
				default:
					break;
				}
				}
				break;

			case NAME_Alpha:
				th->alpha = CheckFixed(key);
				break;

			case NAME_FillColor:
				th->fillcolor = CheckInt(key);

			case NAME_Health:
				th->health = CheckInt(key);
				break;

			case NAME_Score:
				th->score = CheckInt(key);
				break;

			case NAME_Pitch:
				th->pitch = (short)CheckInt(key);
				break;

			case NAME_Roll:
				th->roll = (short)CheckInt(key);
				break;

			case NAME_ScaleX:
				th->scaleX = CheckFixed(key);
				break;

			case NAME_ScaleY:
				th->scaleY = CheckFixed(key);
				break;

			case NAME_Scale:
				th->scaleX = th->scaleY = CheckFixed(key);
				break;

			default:
				if (0 == strnicmp("user_", key.GetChars(), 5))
				{ // Custom user key - Sets an actor's user variable directly
					FMapThingUserData ud;
					ud.Property = key;
					ud.Value = CheckInt(key);
					MapThingsUserData.Push(ud);
				}
				break;
			}
		}
		if (arg0str.IsNotEmpty() && (P_IsACSSpecial(th->special) || th->special == 0))
		{
			th->args[0] = -FName(arg0str);
		}
		if (arg1str.IsNotEmpty() && (P_IsThingSpecial(th->special) || th->special == 0))
		{
			th->args[1] = -FName(arg1str);
		}
		// Thing specials are only valid in namespaces with Hexen-type specials
		// and in ZDoomTranslated - which will use the translator on them.
		if (namespc == NAME_ZDoomTranslated)
		{
			maplinedef_t mld;
			line_t ld;

			if (th->special != 0)	// if special is 0, keep the args (e.g. for bridge things)
			{
				// The trigger type is ignored here.
				mld.flags = 0;
				mld.special = th->special;
				mld.tag = th->args[0];
				P_TranslateLineDef(&ld, &mld);
				th->special = ld.special;
				memcpy(th->args, ld.args, sizeof (ld.args));
			}
		}
		else if (isTranslated)
		{
			th->special = 0;
			memset(th->args, 0, sizeof (th->args));
		}
	}
Пример #14
0
	void ParseLinedef(line_t *ld, int index)
	{
		bool passuse = false;
		bool strifetrans = false;
		bool strifetrans2 = false;
		FString arg0str, arg1str;

		memset(ld, 0, sizeof(*ld));
		ld->Alpha = FRACUNIT;
		ld->id = -1;
		ld->sidedef[0] = ld->sidedef[1] = NULL;
		if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
		if (level.flags2 & LEVEL2_WRAPMIDTEX) ld->flags |= ML_WRAP_MIDTEX;
		if (level.flags2 & LEVEL2_CHECKSWITCHRANGE) ld->flags |= ML_CHECKSWITCHRANGE;

		sc.MustGetToken('{');
		while (!sc.CheckToken('}'))
		{
			FName key = ParseKey();

			// This switch contains all keys of the UDMF base spec
			switch(key)
			{
			case NAME_V1:
				ld->v1 = (vertex_t*)(intptr_t)CheckInt(key);	// must be relocated later
				continue;

			case NAME_V2:
				ld->v2 = (vertex_t*)(intptr_t)CheckInt(key);	// must be relocated later
				continue;

			case NAME_Special:
				ld->special = CheckInt(key);
				if (namespc == NAME_Hexen)
				{
					if (ld->special < 0 || ld->special > 140 || !HexenLineSpecialOk[ld->special])
						ld->special = 0;	// NULL all specials which don't exist in Hexen
				}

				continue;

			case NAME_Id:
				ld->id = CheckInt(key);
				continue;

			case NAME_Sidefront:
				ld->sidedef[0] = (side_t*)(intptr_t)(1 + CheckInt(key));
				continue;

			case NAME_Sideback:
				ld->sidedef[1] = (side_t*)(intptr_t)(1 + CheckInt(key));
				continue;

			case NAME_Arg0:
			case NAME_Arg1:
			case NAME_Arg2:
			case NAME_Arg3:
			case NAME_Arg4:
				ld->args[int(key)-int(NAME_Arg0)] = CheckInt(key);
				continue;

			case NAME_Arg0Str:
				CHECK_N(Zd);
				arg0str = CheckString(key);
				continue;

			case NAME_Arg1Str:
				CHECK_N(Zd);
				arg1str = CheckString(key);
				continue;

			case NAME_Blocking:
				Flag(ld->flags, ML_BLOCKING, key); 
				continue;

			case NAME_Blockmonsters:
				Flag(ld->flags, ML_BLOCKMONSTERS, key); 
				continue;

			case NAME_Twosided:
				Flag(ld->flags, ML_TWOSIDED, key); 
				continue;

			case NAME_Dontpegtop:
				Flag(ld->flags, ML_DONTPEGTOP, key); 
				continue;

			case NAME_Dontpegbottom:
				Flag(ld->flags, ML_DONTPEGBOTTOM, key); 
				continue;

			case NAME_Secret:
				Flag(ld->flags, ML_SECRET, key); 
				continue;

			case NAME_Blocksound:
				Flag(ld->flags, ML_SOUNDBLOCK, key); 
				continue;

			case NAME_Dontdraw:
				Flag(ld->flags, ML_DONTDRAW, key); 
				continue;

			case NAME_Mapped:
				Flag(ld->flags, ML_MAPPED, key); 
				continue;

			case NAME_Jumpover:
				CHECK_N(St | Zd | Zdt | Va)
				Flag(ld->flags, ML_RAILING, key); 
				continue;

			case NAME_Blockfloaters:
				CHECK_N(St | Zd | Zdt | Va)
				Flag(ld->flags, ML_BLOCK_FLOATERS, key); 
				continue;

			case NAME_Translucent:
				CHECK_N(St | Zd | Zdt | Va)
				strifetrans = CheckBool(key); 
				continue;

			case NAME_Transparent:
				CHECK_N(St | Zd | Zdt | Va)
				strifetrans2 = CheckBool(key); 
				continue;

			case NAME_Passuse:
				CHECK_N(Dm | Zd | Zdt | Va)
				passuse = CheckBool(key); 
				continue;

			default:
				break;
			}

			// This switch contains all keys of the UDMF base spec which only apply to Hexen format specials
			if (!isTranslated) switch (key)
			{
			case NAME_Playercross:
				Flag(ld->activation, SPAC_Cross, key); 
				continue;

			case NAME_Playeruse:
				Flag(ld->activation, SPAC_Use, key); 
				continue;

			case NAME_Playeruseback:
				Flag(ld->activation, SPAC_UseBack, key); 
				continue;

			case NAME_Monstercross:
				Flag(ld->activation, SPAC_MCross, key); 
				continue;

			case NAME_Impact:
				Flag(ld->activation, SPAC_Impact, key); 
				continue;

			case NAME_Playerpush:
				Flag(ld->activation, SPAC_Push, key); 
				continue;

			case NAME_Missilecross:
				Flag(ld->activation, SPAC_PCross, key); 
				continue;

			case NAME_Monsteruse:
				Flag(ld->activation, SPAC_MUse, key); 
				continue;

			case NAME_Monsterpush:
				Flag(ld->activation, SPAC_MPush, key); 
				continue;

			case NAME_Repeatspecial:
				Flag(ld->flags, ML_REPEAT_SPECIAL, key); 
				continue;

			default:
				break;
			}

			// This switch contains all keys which are ZDoom specific
			if (namespace_bits & (Zd|Zdt|Va)) switch(key)
			{
			case NAME_Alpha:
				ld->Alpha = CheckFixed(key);
				continue;

			case NAME_Renderstyle:
			{
				const char *str = CheckString(key);
				if (!stricmp(str, "translucent")) ld->flags &= ~ML_ADDTRANS;
				else if (!stricmp(str, "add")) ld->flags |= ML_ADDTRANS;
				else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyle'\n", str);
				continue;
			}

			case NAME_Anycross:
				Flag(ld->activation, SPAC_AnyCross, key); 
				continue;

			case NAME_Monsteractivate:
				Flag(ld->flags, ML_MONSTERSCANACTIVATE, key); 
				continue;

			case NAME_Blockplayers:
				Flag(ld->flags, ML_BLOCK_PLAYERS, key); 
				continue;

			case NAME_Blockeverything:
				Flag(ld->flags, ML_BLOCKEVERYTHING, key); 
				continue;

			case NAME_Zoneboundary:
				Flag(ld->flags, ML_ZONEBOUNDARY, key); 
				continue;

			case NAME_Clipmidtex:
				Flag(ld->flags, ML_CLIP_MIDTEX, key); 
				continue;

			case NAME_Wrapmidtex:
				Flag(ld->flags, ML_WRAP_MIDTEX, key); 
				continue;

			case NAME_Midtex3d:
				Flag(ld->flags, ML_3DMIDTEX, key); 
				continue;

			case NAME_Checkswitchrange:
				Flag(ld->flags, ML_CHECKSWITCHRANGE, key); 
				continue;

			case NAME_Firstsideonly:
				Flag(ld->flags, ML_FIRSTSIDEONLY, key); 
				continue;

			case NAME_blockprojectiles:
				Flag(ld->flags, ML_BLOCKPROJECTILE, key); 
				continue;

			case NAME_blockuse:
				Flag(ld->flags, ML_BLOCKUSE, key); 
				continue;

			case NAME_blocksight:
				Flag(ld->flags, ML_BLOCKSIGHT, key); 
				continue;
			
			case NAME_blockhitscan:
				Flag(ld->flags, ML_BLOCKHITSCAN, key); 
				continue;
			
			// [Dusk] lock number
			case NAME_Locknumber:
				ld->locknumber = CheckInt(key);
				continue;

			default:
				break;
			}

			if (!strnicmp("user_", key.GetChars(), 5))
			{
				AddUserKey(key, UDMF_Line, index);
			}
		}

		if (isTranslated)
		{
			int saved = ld->flags;

			maplinedef_t mld;
			memset(&mld, 0, sizeof(mld));
			mld.special = ld->special;
			mld.tag = ld->id;
			P_TranslateLineDef(ld, &mld);
			ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY));
		}
		if (passuse && (ld->activation & SPAC_Use)) 
		{
			ld->activation = (ld->activation & ~SPAC_Use) | SPAC_UseThrough;
		}
		if (strifetrans && ld->Alpha == FRACUNIT)
		{
			ld->Alpha = FRACUNIT * 3/4;
		}
		if (strifetrans2 && ld->Alpha == FRACUNIT)
		{
			ld->Alpha = FRACUNIT * 1/4;
		}
		if (ld->sidedef[0] == NULL)
		{
			ld->sidedef[0] = (side_t*)(intptr_t)(1);
			Printf("Line %d has no first side.\n", index);
		}
		if (arg0str.IsNotEmpty() && (P_IsACSSpecial(ld->special) || ld->special == 0))
		{
			ld->args[0] = -FName(arg0str);
		}
		if (arg1str.IsNotEmpty() && (P_IsThingSpecial(ld->special) || ld->special == 0))
		{
			ld->args[1] = -FName(arg1str);
		}
	}
Пример #15
0
	void ParseSidedef(side_t *sd, intmapsidedef_t *sdt, int index)
	{
		fixed_t texofs[2]={0,0};

		memset(sd, 0, sizeof(*sd));
		sdt->bottomtexture = "-";
		sdt->toptexture = "-";
		sdt->midtexture = "-";
		sd->SetTextureXScale(FRACUNIT);
		sd->SetTextureYScale(FRACUNIT);

		sc.MustGetToken('{');
		while (!sc.CheckToken('}'))
		{
			FName key = ParseKey();
			switch(key)
			{
			case NAME_Offsetx:
				texofs[0] = CheckInt(key) << FRACBITS;
				continue;

			case NAME_Offsety:
				texofs[1] = CheckInt(key) << FRACBITS;
				continue;

			case NAME_Texturetop:
				sdt->toptexture = CheckString(key);
				continue;

			case NAME_Texturebottom:
				sdt->bottomtexture = CheckString(key);
				continue;

			case NAME_Texturemiddle:
				sdt->midtexture = CheckString(key);
				continue;

			case NAME_Sector:
				sd->sector = (sector_t*)(intptr_t)CheckInt(key);
				continue;

			default:
				break;
			}

			if (namespace_bits & (Zd|Zdt|Va)) switch(key)
			{
			case NAME_offsetx_top:
				sd->SetTextureXOffset(side_t::top, CheckFixed(key));
				continue;

			case NAME_offsety_top:
				sd->SetTextureYOffset(side_t::top, CheckFixed(key));
				continue;

			case NAME_offsetx_mid:
				sd->SetTextureXOffset(side_t::mid, CheckFixed(key));
				continue;

			case NAME_offsety_mid:
				sd->SetTextureYOffset(side_t::mid, CheckFixed(key));
				continue;

			case NAME_offsetx_bottom:
				sd->SetTextureXOffset(side_t::bottom, CheckFixed(key));
				continue;

			case NAME_offsety_bottom:
				sd->SetTextureYOffset(side_t::bottom, CheckFixed(key));
				continue;

			case NAME_scalex_top:
				sd->SetTextureXScale(side_t::top, CheckFixed(key));
				continue;

			case NAME_scaley_top:
				sd->SetTextureYScale(side_t::top, CheckFixed(key));
				continue;

			case NAME_scalex_mid:
				sd->SetTextureXScale(side_t::mid, CheckFixed(key));
				continue;

			case NAME_scaley_mid:
				sd->SetTextureYScale(side_t::mid, CheckFixed(key));
				continue;

			case NAME_scalex_bottom:
				sd->SetTextureXScale(side_t::bottom, CheckFixed(key));
				continue;

			case NAME_scaley_bottom:
				sd->SetTextureYScale(side_t::bottom, CheckFixed(key));
				continue;

			case NAME_light:
				sd->SetLight(CheckInt(key));
				continue;

			case NAME_lightabsolute:
				Flag(sd->Flags, WALLF_ABSLIGHTING, key);
				continue;

			case NAME_lightfog:
				Flag(sd->Flags, WALLF_LIGHT_FOG, key);
				continue;

			case NAME_nofakecontrast:
				Flag(sd->Flags, WALLF_NOFAKECONTRAST, key);
				continue;

			case NAME_smoothlighting:
				Flag(sd->Flags, WALLF_SMOOTHLIGHTING, key);
				continue;

			case NAME_Wrapmidtex:
				Flag(sd->Flags, WALLF_WRAP_MIDTEX, key);
				continue;

			case NAME_Clipmidtex:
				Flag(sd->Flags, WALLF_CLIP_MIDTEX, key);
				continue;

			case NAME_Nodecals:
				Flag(sd->Flags, WALLF_NOAUTODECALS, key);
				continue;

			default:
				break;

			}
			if (!strnicmp("user_", key.GetChars(), 5))
			{
				AddUserKey(key, UDMF_Side, index);
			}
		}
		// initialization of these is delayed to allow separate offsets and add them with the global ones.
		sd->AddTextureXOffset(side_t::top, texofs[0]);
		sd->AddTextureXOffset(side_t::mid, texofs[0]);
		sd->AddTextureXOffset(side_t::bottom, texofs[0]);
		sd->AddTextureYOffset(side_t::top, texofs[1]);
		sd->AddTextureYOffset(side_t::mid, texofs[1]);
		sd->AddTextureYOffset(side_t::bottom, texofs[1]);
	}
Пример #16
0
	void ParseSector(sector_t *sec, int index)
	{
		int lightcolor = -1;
		int fadecolor = -1;
		int desaturation = -1;
		int fplaneflags = 0, cplaneflags = 0;
		double fp[4] = { 0 }, cp[4] = { 0 };

		memset(sec, 0, sizeof(*sec));
		sec->lightlevel = 160;
		sec->SetXScale(sector_t::floor, FRACUNIT);	// [RH] floor and ceiling scaling
		sec->SetYScale(sector_t::floor, FRACUNIT);
		sec->SetXScale(sector_t::ceiling, FRACUNIT);
		sec->SetYScale(sector_t::ceiling, FRACUNIT);
		sec->SetAlpha(sector_t::floor, FRACUNIT);
		sec->SetAlpha(sector_t::ceiling, FRACUNIT);
		sec->thinglist = NULL;
		sec->touching_thinglist = NULL;		// phares 3/14/98
		sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1;
		sec->nextsec = -1;	//jff 2/26/98 add fields to support locking out
		sec->prevsec = -1;	// stair retriggering until build completes
		sec->heightsec = NULL;	// sector used to get floor and ceiling height
		sec->sectornum = index;
		if (floordrop) sec->Flags = SECF_FLOORDROP;
		// killough 3/7/98: end changes

		sec->gravity = 1.f;	// [RH] Default sector gravity of 1.0
		sec->ZoneNumber = 0xFFFF;

		// killough 8/28/98: initialize all sectors to normal friction
		sec->friction = ORIG_FRICTION;
		sec->movefactor = ORIG_FRICTION_FACTOR;

		sc.MustGetToken('{');
		while (!sc.CheckToken('}'))
		{
			FName key = ParseKey();
			switch(key)
			{
			case NAME_Heightfloor:
				sec->SetPlaneTexZ(sector_t::floor, CheckInt(key) << FRACBITS);
				continue;

			case NAME_Heightceiling:
				sec->SetPlaneTexZ(sector_t::ceiling, CheckInt(key) << FRACBITS);
				continue;

			case NAME_Texturefloor:
				SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex, false);
				continue;

			case NAME_Textureceiling:
				SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex, false);
				continue;

			case NAME_Lightlevel:
				sec->lightlevel = sector_t::ClampLight(CheckInt(key));
				continue;

			case NAME_Special:
				sec->special = (short)CheckInt(key);
				if (isTranslated) sec->special = P_TranslateSectorSpecial(sec->special);
				else if (namespc == NAME_Hexen)
				{
					if (sec->special < 0 || sec->special > 255 || !HexenSectorSpecialOk[sec->special])
						sec->special = 0;	// NULL all unknown specials
				}
				continue;

			case NAME_Id:
				sec->tag = (short)CheckInt(key);
				continue;

			default:
				break;
			}

			if (namespace_bits & (Zd|Zdt|Va)) switch(key)
			{
				case NAME_Xpanningfloor:
					sec->SetXOffset(sector_t::floor, CheckFixed(key));
					continue;

				case NAME_Ypanningfloor:
					sec->SetYOffset(sector_t::floor, CheckFixed(key));
					continue;

				case NAME_Xpanningceiling:
					sec->SetXOffset(sector_t::ceiling, CheckFixed(key));
					continue;

				case NAME_Ypanningceiling:
					sec->SetYOffset(sector_t::ceiling, CheckFixed(key));
					continue;

				case NAME_Xscalefloor:
					sec->SetXScale(sector_t::floor, CheckFixed(key));
					continue;

				case NAME_Yscalefloor:
					sec->SetYScale(sector_t::floor, CheckFixed(key));
					continue;

				case NAME_Xscaleceiling:
					sec->SetXScale(sector_t::ceiling, CheckFixed(key));
					continue;

				case NAME_Yscaleceiling:
					sec->SetYScale(sector_t::ceiling, CheckFixed(key));
					continue;

				case NAME_Rotationfloor:
					sec->SetAngle(sector_t::floor, CheckAngle(key));
					continue;

				case NAME_Rotationceiling:
					sec->SetAngle(sector_t::ceiling, CheckAngle(key));
					continue;

				case NAME_Lightfloor:
					sec->SetPlaneLight(sector_t::floor, CheckInt(key));
					continue;

				case NAME_Lightceiling:
					sec->SetPlaneLight(sector_t::ceiling, CheckInt(key));
					continue;

				case NAME_Alphafloor:
					sec->SetAlpha(sector_t::floor, CheckFixed(key));
					continue;

				case NAME_Alphaceiling:
					sec->SetAlpha(sector_t::ceiling, CheckFixed(key));
					continue;

				case NAME_Renderstylefloor:
				{
					const char *str = CheckString(key);
					if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::floor, PLANEF_ADDITIVE, 0);
					else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ADDITIVE);
					else sc.ScriptMessage("Unknown value \"%s\" for 'renderstylefloor'\n", str);
					continue;
				}

				case NAME_Renderstyleceiling:
				{
					const char *str = CheckString(key);
					if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::ceiling, PLANEF_ADDITIVE, 0);
					else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ADDITIVE);
					else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyleceiling'\n", str);
					continue;
				}

				case NAME_Lightfloorabsolute:
					if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
					else sec->ChangeFlags(sector_t::floor, PLANEF_ABSLIGHTING, 0);
					continue;

				case NAME_Lightceilingabsolute:
					if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING);
					else sec->ChangeFlags(sector_t::ceiling, PLANEF_ABSLIGHTING, 0);
					continue;

				case NAME_Gravity:
					sec->gravity = float(CheckFloat(key));
					continue;

				case NAME_Lightcolor:
					lightcolor = CheckInt(key);
					continue;

				case NAME_Fadecolor:
					fadecolor = CheckInt(key);
					continue;

				case NAME_Desaturation:
					desaturation = int(255*CheckFloat(key));
					continue;

				case NAME_Silent:
					Flag(sec->Flags, SECF_SILENT, key);
					continue;

				case NAME_NoRespawn:
					Flag(sec->Flags, SECF_NORESPAWN, key);
					continue;

				case NAME_Nofallingdamage:
					Flag(sec->Flags, SECF_NOFALLINGDAMAGE, key);
					continue;

				case NAME_Dropactors:
					Flag(sec->Flags, SECF_FLOORDROP, key);
					continue;

				case NAME_SoundSequence:
					sec->SeqName = CheckString(key);
					sec->seqType = -1;
					continue;

				case NAME_hidden:
					Flag(sec->MoreFlags, SECF_HIDDEN, key);
					break;

				case NAME_Waterzone:
					Flag(sec->MoreFlags, SECF_UNDERWATER, key);
					break;

				case NAME_floorplane_a:
					fplaneflags |= 1;
					fp[0] = CheckFloat(key);
					break;

				case NAME_floorplane_b:
					fplaneflags |= 2;
					fp[1] = CheckFloat(key);
					break;

				case NAME_floorplane_c:
					fplaneflags |= 4;
					fp[2] = CheckFloat(key);
					break;

				case NAME_floorplane_d:
					fplaneflags |= 8;
					fp[3] = CheckFloat(key);
					break;

				case NAME_ceilingplane_a:
					cplaneflags |= 1;
					cp[0] = CheckFloat(key);
					break;

				case NAME_ceilingplane_b:
					cplaneflags |= 2;
					cp[1] = CheckFloat(key);
					break;

				case NAME_ceilingplane_c:
					cplaneflags |= 4;
					cp[2] = CheckFloat(key);
					break;

				case NAME_ceilingplane_d:
					cplaneflags |= 8;
					cp[3] = CheckFloat(key);
					break;

				default:
					break;
			}
				
			if (!strnicmp("user_", key.GetChars(), 5))
			{
				AddUserKey(key, UDMF_Sector, index);
			}
		}

		sec->secretsector = !!(sec->special&SECRET_MASK);
		
		// Reset the planes to their defaults if not all of the plane equation's parameters were found.
		if (fplaneflags != 15)
		{
			sec->floorplane.a = sec->floorplane.b = 0;
			sec->floorplane.d = -sec->GetPlaneTexZ(sector_t::floor);
			sec->floorplane.c = FRACUNIT;
			sec->floorplane.ic = FRACUNIT;
		}
		else
		{
			double ulen = TVector3<double>(fp[0], fp[1], fp[2]).Length();

			// normalize the vector, it must have a length of 1
			sec->floorplane.a = FLOAT2FIXED(fp[0] / ulen);
			sec->floorplane.b = FLOAT2FIXED(fp[1] / ulen);
			sec->floorplane.c = FLOAT2FIXED(fp[2] / ulen);
			sec->floorplane.d = FLOAT2FIXED(fp[3] / ulen);
			sec->floorplane.ic = FLOAT2FIXED(ulen / fp[2]);
		}
		if (cplaneflags != 15)
		{
			sec->ceilingplane.a = sec->ceilingplane.b = 0;
			sec->ceilingplane.d = sec->GetPlaneTexZ(sector_t::ceiling);
			sec->ceilingplane.c = -FRACUNIT;
			sec->ceilingplane.ic = -FRACUNIT;
		}
		else
		{
			double ulen = TVector3<double>(cp[0], cp[1], cp[2]).Length();

			// normalize the vector, it must have a length of 1
			sec->floorplane.a = FLOAT2FIXED(cp[0] / ulen);
			sec->floorplane.b = FLOAT2FIXED(cp[1] / ulen);
			sec->floorplane.c = FLOAT2FIXED(cp[2] / ulen);
			sec->floorplane.d = FLOAT2FIXED(cp[3] / ulen);
			sec->floorplane.ic = FLOAT2FIXED(ulen / cp[2]);
		}

		if (lightcolor == -1 && fadecolor == -1 && desaturation == -1)
		{
			// [RH] Sectors default to white light with the default fade.
			//		If they are outside (have a sky ceiling), they use the outside fog.
			if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside))
			{
				if (fogMap == NULL)
					fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0);
				sec->ColorMap = fogMap;
			}
			else
			{
				if (normMap == NULL)
					normMap = GetSpecialLights (PalEntry (255,255,255), level.fadeto, NormalLight.Desaturate);
				sec->ColorMap = normMap;
			}
		}
		else
		{
			if (lightcolor == -1) lightcolor = PalEntry(255,255,255);
			if (fadecolor == -1) 
			{
				if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside))
					fadecolor = level.outsidefog;
				else
					fadecolor = level.fadeto;
			}
			if (desaturation == -1) desaturation = NormalLight.Desaturate;

			sec->ColorMap = GetSpecialLights (lightcolor, fadecolor, desaturation);
		}
	}
Пример #17
0
/*-------------------------------------------------------------------------*/
APIRET ReadText( INT check )
{
    APIRET           rc;
    INT              i = 0, len = 0;
    INT              x = maxXtext - 1;
    CHAR             last = '\n', *s, *string;
    INDEXTXT        *top, *start;

    FreeTxtIndex();

    string = malloc( MAX_BUFFER );

    if( string == NULL )
        return( ERROR_NOT_ENOUGH_MEMORY );

    if( mode == FILE_TYPE_PKT )
        FidoMsgGetStrSeek( PktFile, Current -> telltxt, SEEK_SET );

    if( mode == FILE_TYPE_MSG )
    {
        if(( rc = OpenFile( Current -> name )) != NO_ERROR )
            return( rc );
        if( fread( &msg, sizeof( msg ), 1, PktFile ) != 1 )
        {
            free( string );
            CloseFile();
            ShowError( "Error read file '%s'", ShowPath( Current -> name, 50 ));
            return( ERROR_READ_FAULT );
        }
        FidoMsgGetStrSeek( PktFile, 0, SEEK_CUR );
    }
        
    intl = origin = id = 0;
    MsgID.Zone = -1;
    
    while( last && FidoMsgGetStr( string, MAX_BUFFER - 1, PktFile, &last ) != NULL )
    {
        if( check )
            CheckString( string, i, Current );

        start = NULL;

        while( 1 )
        {
            len = strlen( string );
            s = &string[ len ];

            if( len > x )
            {
                if(( s = StrChar( string, x, ' ' )) == NULL )
                    if(( s = StrChar( string, x, ',' )) == NULL )
                        if(( s = StrChar( string, x, '.' )) == NULL )
                            if(( s = StrChar( string, x, ';' )) == NULL )
                                s = StrChar( string, x, ':' );
                if( s == NULL )
                {
                    len = x;
                    s = &string[len];
                }
                else
                {
                    len = s - string + 1;
                    s++;
                }
            }

            AddNextStruct( txtIndex, top );

            if( top == NULL )
            {
                free( string );
                return( ERROR_NOT_ENOUGH_MEMORY );
            }

            top -> str = malloc( len + 1 );
            memcpy( top -> str, string, len + 1 );
            top -> str[len] = 0;

            if( !start )
            {
                start = top;
                start -> color = GetLineColor( i, string );
            }
            else
                top -> color = start -> color;

            memcpy( string, s, strlen( s ) + 1 );

            txtcount++;

            if( string[0] == 0 )
                break;
        }
        i++;
        s = &start -> str[1];
    }

    free( string );
    
    if( check )
        CheckString( NULL, 0, Current );
    
    if( mode == FILE_TYPE_MSG )
        CloseFile();

    return( NO_ERROR );
}
Пример #18
0
APIRET CreateMsgList( CHAR *path )
{
    INT           i, done, line;
    INT           attr = _A_NORMAL | _A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_ARCH;
    static CHAR   File[_MAX_PATH];
    CHAR         *string, last;
    struct find_t find;
    INDEXPKT     *top, *index, **inew;
    
    InitMem();

    mode = FILE_TYPE_MSG;

    string = malloc( MAX_BUFFER );

    if( string == NULL )
        return( ERROR_NOT_ENOUGH_MEMORY );

    _splitpath( path, drive, dir, NULL, NULL );
    strcpy( File, drive ); strcat( File, dir ); StrAddSlash( File ); strcat( File, "*.msg" );
    
    WActive( wscan );

    for( done=_dos_findfirst(File,attr,&find); !done; done=_dos_findnext(&find))
    {
        _splitpath( find.name, NULL, NULL, fname, NULL );
        strcpy( File, path ); StrAddSlash( File ); strcat( File, find.name );

        if( OpenFile( File ))
            continue;
        
        if( !( pktcount % 5 ))
        {
            WSetXY ( wscan, 19, 2 );
            if( pktcount == 0 )
                WPrintf( wscan, "%4u", 1 );
            else
                WPrintf( wscan, "%4u", pktcount );
        }

        fread( &msg, sizeof( msg ), 1, PktFile );
        
        AddNextStruct( pktIndex, top );

        if( top == NULL )
        {
            free( string );
            return( ERROR_NOT_ENOUGH_MEMORY );
        }
        
        top -> size = filelength( fileno( PktFile ));
        
        strcpy( string, msg.to   ); string[ MAX_TO ]   = 0; top -> to   = strdup( string );
        strcpy( string, msg.from ); string[ MAX_FROM ] = 0; top -> from = strdup( string );
        strcpy( string, msg.subj ); string[ MAX_SUBJ ] = 0; top -> subj = strdup( string );
        strcpy( string, msg.date ); string[ MAX_DATE ] = 0; top -> date = strdup( string );
        
        top -> AddrFrom.Zone      = 0;
        top -> AddrFrom.Net       = msg.orig_net;
        top -> AddrFrom.Node      = msg.orig_node;
        top -> AddrFrom.Point     = 0;
        top -> AddrFrom.Domain[0] = 0;
        
        top -> AddrTo.Zone        = 0;
        top -> AddrTo.Net         = msg.dest_net;
        top -> AddrTo.Node        = msg.dest_node;
        top -> AddrTo.Point       = 0;
        top -> AddrTo.Domain[0]   = 0;
        
        top -> attr               = msg.attrib;
        top -> number             = atol( fname );
        top -> name               = strdup( find.name );
        top -> area               = NULL;
        top -> sel                = ' ';
        top -> change             = 0;

        FidoMsgGetStrSeek( PktFile, 0, SEEK_CUR );

        i = line = 0;
        
        while( FidoMsgGetStr( string, MAX_BUFFER - 1, PktFile, &last ) != NULL )
        {
            CheckString( string, i, top );
            
			if( !Quick )
				break;
			
			if( i && strncmp( string, "AREA:", 5 ))
            {
                if( line < MAX_LINE && string[0] != '\001' && StrSkipSpace( string ))
                {
                    top -> quick[line] = strdup( string );
                    top -> color[line] = GetLineColor( i, string );
                    line++;
                }
            }
            if( last == 0 || line >= MAX_LINE )
                break;
            i++;
        }
        
        CloseFile();
        CheckString( NULL, 0, top );
        
        pktcount++;
    }
    
    _dos_findclose( &find );
    free( string );

    if( pktcount == 0 )
    {
        WDeactive( wscan );
        return( 0 );
    }

    if( cfgCurrent.sort )
    {
        inew = calloc( pktcount, sizeof( *inew ));

        if( inew == NULL )
            return( ERROR_NOT_ENOUGH_MEMORY );

        for( i = 0, index = pktIndex; index; index = index -> next, i++ )
            inew[i] = index;

        MShellSort( inew, pktcount, sizeof( *inew ), SortNumber );
    
        pktIndex = inew[0];
    
        for( i = 1; i < pktcount; i++ )
            inew[i-1] -> next = inew[i];
        inew[i-1] -> next = NULL;

        free( inew );

        pktOrigin = malloc( pktcount * sizeof( *pktOrigin ));

        if( pktOrigin == NULL )
            return( ERROR_NOT_ENOUGH_MEMORY );
    
        for( i = 0, index = pktIndex; index; index = index -> next, i++ )
            pktOrigin[i] = index;

    }

    WDeactive( wscan );

    return( NO_ERROR );
}
Пример #19
0
/**
 * \brief IOCtl for /Devices/ip/routes/#
 */
int IPStack_Route_IOCtl(tVFS_Node *Node, int ID, void *Data)
{
	tRoute	*rt = Node->ImplPtr;
	 int	addrSize = IPStack_GetAddressSize(rt->AddressType);

	ENTER("pNode iID pData", Node, ID, Data);
	
	switch(ID)
	{
	// --- Standard IOCtls (0-3) ---
	BASE_IOCTLS(DRV_TYPE_MISC, STR(IDENT), VERSION, casIOCtls_Route)
	
	// Get Next Hop
	case 4:
		if( !CheckMem(Data, addrSize) )	LEAVE_RET('i', -1);
		memcpy(Data, rt->NextHop, addrSize);
		LEAVE_RET('i', 1);
	// Set Next Hop
	case 5:
		if( Threads_GetUID() != 0 )	LEAVE_RET('i', -1);
		if( !CheckMem(Data, addrSize) )	LEAVE_RET('i', -1);
		memcpy(rt->NextHop, Data, addrSize);
		LEAVE_RET('i', 1);

	// Get interface name
	case 6:
		if( !rt->Interface ) {
			if(Data && !CheckMem(Data, 1) )
				LEAVE_RET('i', -1);
			if(Data)
				*(char*)Data = 0;
			LEAVE_RET('i', 0);
		}
		if( Data ) {
			if( !CheckMem(Data, strlen(rt->Interface->Name) + 1) )
				LEAVE_RET('i', -1);
			strcpy(Data, rt->Interface->Name);
		}
		LEAVE_RET('i', strlen(rt->Interface->Name));
	// Set interface name
	case 7:
		if( Threads_GetUID() != 0 )
			LEAVE_RET('i', -1);
		if( !CheckString(Data) )
			LEAVE_RET('i', -1);
		else
		{
			tInterface	*iface;
			tVFS_Node	*tmp;
			tmp = IPStack_Root_FindDir(NULL, Data);
			if(!tmp)
				LEAVE_RET('i', -1);
			iface = tmp->ImplPtr;
			if(tmp->Type->Close)	tmp->Type->Close(tmp);
			
			if( iface->Type != rt->AddressType )
				LEAVE_RET('i', -1);

			// TODO: Other checks?		
	
			rt->Interface = iface;
		}
		LEAVE_RET('i', 0);

	default:
		LEAVE_RET('i', -1);
	}
}
Пример #20
0
	bool ParsePage()
	{
		FStrifeDialogueNode *node = new FStrifeDialogueNode;
		FStrifeDialogueReply **replyptr = &node->Children;
		memset(node, 0, sizeof(*node));
		//node->ItemCheckCount[0] = node->ItemCheckCount[1] = node->ItemCheckCount[2] = -1;

		node->ThisNodeNum = StrifeDialogues.Push(node);
		node->ItemCheckNode = -1;

		FString SpeakerName;
		FString Dialogue;

		while (!sc.CheckToken('}'))
		{
			bool block = false;
			FName key = ParseKey(true, &block);
			if (!block)
			{
				switch(key)
				{
				case NAME_Name:
					SpeakerName = CheckString(key);
					break;

				case NAME_Panel:
					node->Backdrop = TexMan.CheckForTexture (CheckString(key), FTexture::TEX_MiscPatch);
					break;

				case NAME_Voice:
					{
						const char * name = CheckString(key);
						if (name[0] != 0)
						{
							FString soundname = "svox/";
							soundname += name;
							node->SpeakerVoice = FSoundID(S_FindSound(soundname));
							if (node->SpeakerVoice == 0 && namespace_bits == Zd)
							{
								node->SpeakerVoice = FSoundID(S_FindSound(name));
							}
						}
					}
					break;

				case NAME_Dialog:
					Dialogue = CheckString(key);
					break;

				case NAME_Drop:
					node->DropType = CheckActorType(key);
					break;

				case NAME_Link:
					node->ItemCheckNode = CheckInt(key);
					break;


				}
			}
			else
			{
				switch(key)
				{
				case NAME_Ifitem:
					if (!ParseIfItem(node)) return false;
					break;

				case NAME_Choice:
					if (!ParseChoice(replyptr)) return false;
					break;

				default:
					sc.UnGet();
					Skip();
				}
			}
		}
		node->SpeakerName = ncopystring(SpeakerName);
		node->Dialogue = ncopystring(Dialogue);
		return true;
	}
Пример #21
0
static bool
CheckURL(const char *url,
         const char *scheme,
         const char *host,
         const char *domain,
         const char *siteowner,
         const char *tld,
         const char *maintld,
         const char */* tldregion */,
         const char *port,
         const char *path,
         int pathdepth,
         const char *filename,
         const char *extension,
         const char *params,
         const char *query,
         const char *fragment,
         const char *address,
         const char *tokens,
         int verbose=0)
{
    if (verbose>0)
        printf("Checking with URL: '%s'\n", url);

    GlobalURL.SetURL((const unsigned char *)url);

    if (verbose>0)
        GlobalURL.Dump();
    //  GlobalURL.Dump();

    return
        CheckString("URL", (const unsigned char *)url, GlobalURL.GetURL()) &&
        CheckString("urltype", (const unsigned char *)scheme,
                    GlobalURL.GetScheme()) &&
        CheckString("host", (const unsigned char *)host,
                    GlobalURL.GetHost()) &&
        CheckString("domain", (const unsigned char *)domain,
                    GlobalURL.GetDomain()) &&
        CheckString("siteowner", (const unsigned char *)siteowner,
                    GlobalURL.GetSiteOwner()) &&
        CheckString("tld", (const unsigned char *)tld,
                    GlobalURL.GetTLD()) &&
        CheckString("maintld", (const unsigned char *)maintld,
                    GlobalURL.GetMainTLD()) &&
#if 0
        CheckString("tldregion", (const unsigned char *)tldregion,
                    GlobalURL.GetTLDRegion()) &&
#endif
        CheckString("port", (const unsigned char *)port,
                    GlobalURL.GetPort()) &&
        CheckString("path", (const unsigned char *)path,
                    GlobalURL.GetPath()) &&
        CheckInt("pathdepth", pathdepth,
                 GlobalURL.GetPathDepth()) &&
        CheckString("filename", (const unsigned char *)filename,
                    GlobalURL.GetFilename()) &&
        CheckString("extension", (const unsigned char *)extension,
                    GlobalURL.GetExtension()) &&
        CheckString("params", (const unsigned char *)params,
                    GlobalURL.GetParams()) &&
        CheckString("query", (const unsigned char *)query,
                    GlobalURL.GetQuery()) &&
        CheckString("fragment", (const unsigned char *)fragment,
                    GlobalURL.GetFragment()) &&
        CheckString("address", (const unsigned char *)address,
                    GlobalURL.GetAddress()) &&
        CheckString("TOKENS", (const unsigned char *)tokens,
                    (const unsigned char*)GetTokenString(GlobalURL));
}
Пример #22
0
SceneGraph::Vertex 
Scene::readNode(const domNodeRef node, SceneGraph::Vertex &parent)
{
  // just to experiment with fonts
  bool is_font_node = false;
  std::string::size_type pos = std::string(node->getId()).find(SceneGraph::font_name);
  if(pos != std::string::npos)
    is_font_node = true;

  SceneGraph::IdVertexMap::iterator findnode = this->scene_graph.id_vertex_map.find(node->getId());
  if(findnode != this->scene_graph.id_vertex_map.end())
    return findnode->second;

  this->scene_graph.printStatusMessage(std::string("  reading scene node ") + node->getID());
  size_t i;
  // Insert new node and connect to parent
  SceneGraph::NodeInfo new_node_info = {node->getId(), CheckString(node->getSid())};
  this->scene_graph.insertNode(parent,
                               CheckString(node->getName()),
                               node->getId(),
                               CheckString(node->getSid()));
  SceneGraph::node_id_map_t node_id_map = get(SceneGraph::node_info_t(), this->scene_graph.node_graph);
  // Read node transformations
  const SceneGraph::NodeInfo &parent_node_info = node_id_map[parent];
  const Node *parent_node = this->scene_graph.all_nodes.find(parent_node_info.id.c_str());
  Node &current_node = *this->scene_graph.all_nodes.find(new_node_info.id.c_str());
  current_node.is_font_node = is_font_node;
  SceneGraph::Vertex node_vertex = this->scene_graph.id_vertex_map.find(new_node_info.id)->second;

  this->readNodeTranforms(current_node, *parent_node, node);

  // Process Instance Geometries
  const domInstance_geometry_Array &geom_instances = node->getInstance_geometry_array();
	for(i = 0; i < geom_instances.getCount(); ++i)
		this->readInstanceGeometry(current_node, geom_instances[i]);

  // Process Instance Lights 
  const domInstance_light_Array &lia = node->getInstance_light_array();
	for(i = 0; i < lia.getCount(); ++i)
		this->readInstanceLight(current_node, lia[i]);
  if(!current_node.instance_lights.empty())
    this->scene_graph.light_nodes.push_back(new_node_info.id);

  // Process Instance Cameras 
  const domInstance_camera_Array &ica  = node->getInstance_camera_array();
	for(i = 0; i < ica.getCount(); ++i)
    this->readInstanceCamera(current_node, ica[i]);

  // Read in each child and recursively it's children 
  const domNode_Array &nodes = node->getNode_array();
  for(i = 0; i < nodes.getCount(); i++)
    this->readNode(nodes[i], node_vertex);

  // Read children <instance_nodes>, can be 0 or more
  const domInstance_node_Array &instance_nodes = node->getInstance_node_array();
  for(i = 0; i < instance_nodes.getCount(); i++)
  {
    domInstance_node *instance_node = instance_nodes[i];
    domNode *urlnode = (domNode*)(domElement*)instance_node->getUrl().getElement();
    if(urlnode)
      this->readNode(urlnode, node_vertex);
  }

  return node_vertex;
}
Пример #23
0
/*
The consequenses of giving commands through the app are happening here.
Several statusses are used to determine the possibl commands that can be given.
*/
task main(){
  	while (true){
  			/*
  			Standby			The robot stays still untill it is told to either follow the line or go over to manual mode.
  		 				FIRE:	Status goes to active.
  		 				A:		Status goes to manual.
  			*/
				while (status == "standby"){
					CheckString();
    			if( s == "FIRE"){
    				startTask(Follow);
    				status = "active";
    			}
    			if (s == "A"){
   					status = "manual";
   				}
    		}
    		/*
    		Active			The robot is following the line untill it is told to go standby or if it sees an object.
    					UP: 	Command to make the robot go straight on the next crossing.
    					LEFT:	Command to make the robot go left on the next crossing.
    					RIGHT:Command to make the robot go right on the next crossing.
    					FIRE:	Command to make the robot wait for a command on the next crossing.
    					C:		Status goes to standby.
    		*/
    		while (status == "active"){
    			CheckString();
					if( s == "C") {
    				status = "standby";
    				speed = 0;
		 		 		stopTask(Follow);
		 		 		StopSound();
    				Straight(speed);
   				}
   				if (s == "RIGHT"){
   					command = "right";
   				}
   				if  (s == "LEFT"){
   					command = "left";
   				}
   				if  (s == "UP"){
   					command = "straight";
   				}
   			}
   			/*
   			Engage			The robot has seen an object and is waiting for a command that decides if it will charge or evade said object.
   						FIRE:	Robot evades the object. (Evasion handled in task Follow)
   						B:		The robot Charges.
   						C:		Status goes to standby.
   			*/
   			while (status == "engage"){
   				CheckString();
   				if(s == "FIRE"){
   				}
   				if(s == "B"){
   					stopTask(Follow);
   					StopSound();
   					Charge();
   					s = "";
   					status = "standby";
   			  }
   			  if  (s == "C"){
   					CheckString();
   					status = "standby";
   					speed = 0;
		 		 		stopTask(Follow);
		 		 		stopTask(AvoidObject);
		 		 		StopSound();
    				Straight(speed);
   				}
   				if (SensorValue[S1] == 1){
   					status = "standby";
   					speed = 0;
		 		 		stopTask(Follow);
		 		 		stopTask(AvoidObject);
		 		 		StopSound();
    				Straight(speed);
   				}
				}
				/*
				Manual			The robot can be manually controlled untill it is told to go back to standby.
							UP:		The robot moves forward.
							RIGHT:Turn right.
							LEFT:	Turn left.
							DOWN:	The robot moves backward.
							FIRE:	Brake.
							B:		The robot charges.
							C:		Status goes to standby.
				*/
   			while(status == "manual"){
   				CheckString();
   				Straight(0);
   				while (s == "UP"){
   					startTask(Sound);
   					CheckString();
   					Straight(max_Speed);
   				}
   				while (s == "DOWN"){
   					startTask(Sound);
   					CheckString();
   					Straight((max_Speed/2)*-1);
   				}
   				while  (s == "LEFT"){
   					CheckString();
   					startTask(Sound);
   					motor[motorB]= 0;
   					motor[motorC]= max_Speed/2;
   				}
   				while (s == "RIGHT"){
   					startTask(Sound);
   					CheckString();
   					motor[motorC]= 0;
   					motor[motorB]= max_Speed/2;
   				}
   				if  (s == "C"){
   					CheckString();
   					status = "standby";
   					speed = 0;
		 		 		stopTask(Follow);
		 		 		StopSound();
    				Straight(speed);
   				}
   				while (s == "FIRE"){
   					StopSound();
   					CheckString();
   					motor[motorB]= 0;
   					motor[motorC]= 0;
   				}
   				if  (s == "B"){
   					StopSound();
   					Charge();
   				}
   			}
	wait1Msec(1);
	}
}
Пример #24
0
//---------------------------------------------------------------------------
void __fastcall TReportForm::Button1Click(TObject *Sender)
{
  TVirtualNode *t = VirtualStringTree1->GetFirstSelected(false);
  TReportData *data;
  ReportEditForm->Edit1->Text="";
  ReportEditForm->Edit2->Text="";
  ReportEditForm->Edit3->Text="";
  ReportEditForm->Edit4->Text="";

  if (!(t == NULL))
  {
	int level=VirtualStringTree1->GetNodeLevel(t);
	data=(TReportData *)VirtualStringTree1->GetNodeData(t);
	if (!(data == NULL))
	{
	  switch (level) {
		case 0: ReportEditForm->Edit1->Enabled=true;
				ReportEditForm->Edit1->Text=data->Name;
				ReportEditForm->Edit2->Enabled=false;
				ReportEditForm->Edit3->Enabled=false;
				ReportEditForm->Edit4->Enabled=false;
				break;
		case 1: ReportEditForm->Edit1->Enabled=false;
				ReportEditForm->Edit2->Enabled=true;
				ReportEditForm->Edit3->Enabled=true;
				ReportEditForm->Edit4->Enabled=true;
				ReportEditForm->Edit2->Text=FloatToStrF(data->pcs, ffFixed, 5, 2);
				ReportEditForm->Edit3->Text=FloatToStrF(data->pi, ffFixed, 5, 2);
				ReportEditForm->Edit4->Text=FloatToStr(data->angle);
				break;
	  }

	  if  (!(ReportEditForm->ShowModal() == mrOk))
		return;

	  switch (level) {
		  case 0: data->Name=ReportEditForm->Edit1->Text; break;
		  case 1: data->pcs=CheckString(ReportEditForm->Edit2->Text);
				  data->pi=CheckString(ReportEditForm->Edit3->Text);
				  data->angle=CheckString(ReportEditForm->Edit4->Text);
				  break;
	  }
	  RecalculateReport();
      VirtualStringTree1->Repaint();
	}
  }

/*   TVirtualNode *t;
   t=VirtualStringTree1->AddChild(NULL);
   TReportData *data;
   data=(TReportData *)VirtualStringTree1->GetNodeData(t);
   if (!(data == NULL)) {
//	 data->num=t->Index;
	 data->Name="Фигня";
	 data->pcs=1231;
	 data->pi=21;
	 data->angle=90;
	 data->rms=0.1212;
   }

   */
}
Пример #25
0
/*-------------------------------------------------------------------------*/
APIRET ReadPktFile( CHAR *netfile )
{
    APIRET           rc;
    INT              i, line;
    SHORT            sep;
    CHAR             last, *string;
    LONG             tell;
    PACKET           packet;
    INDEXPKT        *top;
#ifndef _LITE_
    INDEXPKT        *index, **inew;
    INT            (*func)() = NULL;
#endif

    if(( rc = OpenFile( netfile )) != 0 )
        return( rc );

    if( fread( &pkt, sizeof( pkt ), 1, PktFile ) != 1 )
    {
        CloseFile();
        ShowError( "Error read file '%s'", ShowPath( netfile, 50 ));
        return( ERROR_READ_FAULT );
    }
    if( pkt.ver != 2 )
    {
        CloseFile();
        ShowError( "File '%s' is't PKT", ShowPath( netfile, 50 ));
        return( ERROR_BAD_FORMAT );
    }

    string = malloc( MAX_BUFFER );

    if( string == NULL )
        return( ERROR_NOT_ENOUGH_MEMORY );

    WActive( wscan );

    while( 1 )
    {
        sep = 0;

        if( fread( &sep, sizeof( sep ), 1, PktFile ) != 1 )
        {
            ShowError( "Error structure in '%s'\nIncomplete pkt. Rest of packet ignored.", ShowPath( netfile, 50 ));
            BadPkt = 1;
            break;
        }

        tell = ftell( PktFile );
        
        if( sep == 0 )
        {
            if( fread( &sep, 1, 1, PktFile ) == 1 )
            {
                ShowError( "Error structure in '%s'\nFound more data, offset: 0x%08lX. Rest of packet ignored.", ShowPath( netfile, 50 ), tell );
                BadPkt = 1;
            }
            break;
        }

        if( sep != 2 )
        {
            ShowError( "Error structure in '%s'\nError separator: 0x%02hX, offset: 0x%08lX. Rest of packet ignored.", ShowPath( netfile, 50 ), sep, tell - 2 );
            BadPkt = 1;
            break;
        }

        if( fread( &packet, sizeof( packet ), 1, PktFile ) != 1 )
        {
            ShowError( "Error structure in '%s'\nIncomplete pkt. Rest of packet ignored.", ShowPath( netfile, 50 ));
            BadPkt = 1;
            break;
        }

        AddNextStruct( pktIndex, top );

        if( top == NULL )
        {
            free( string );
            WDeactive( wscan );
            return( ERROR_NOT_ENOUGH_MEMORY );
        }

        top -> tell = tell;

        if( !( pktcount % 5 ))
        {
            WSetXY ( wscan, 19, 2 );
            if( pktcount == 0 )
                WPrintf( wscan, "%4u", 1 );
            else
                WPrintf( wscan, "%4u", pktcount );
        }

        top -> AddrFrom.Zone      = 0;
        top -> AddrFrom.Net       = packet.orig_net;
        top -> AddrFrom.Node      = packet.orig_node;
        top -> AddrFrom.Point     = 0;
        top -> AddrFrom.Domain[0] = 0;

        top -> AddrTo.Zone        = 0;
        top -> AddrTo.Net         = packet.dest_net;
        top -> AddrTo.Node        = packet.dest_node;
        top -> AddrTo.Point       = 0;
        top -> AddrTo.Domain[0]   = 0;

        top -> attr               = packet.attr;

        strncpy( string, packet.date, sizeof( packet.date ));
        string[sizeof(packet.date)] = 0; top -> date = strdup( string );

        FidoMsgGetStrSeek( PktFile, 0, SEEK_CUR );

        FidoMsgGetStr( string, MAX_BUFFER - 1, PktFile, &last );
        string[ MAX_TO ] = 0; top -> to = strdup( string );

        FidoMsgGetStr( string, MAX_BUFFER - 1, PktFile, &last );
        string[ MAX_FROM ] = 0; top -> from = strdup( string );

        FidoMsgGetStr( string, MAX_BUFFER - 1, PktFile, &last );
        string[ MAX_SUBJ ] = 0; top -> subj = strdup( string );

        top -> area   = NULL;
        top -> sel    = ' ';
        top -> change = 0;

        for( i = 0; i < MAX_LINE; i++ )
            top -> quick[i] = NULL;

        top -> telltxt = FidoMsgGetStrTell();
        line = i = 0;

        while( FidoMsgGetStr( string, MAX_BUFFER - 1, PktFile, &last ) != NULL )
        {
            CheckString( string, i, top );

            if( i && strncmp( string, "AREA:", 5 ))
            {
                if( Quick && line < MAX_LINE && string[0] != '\001' && StrSkipSpace( string ))
                {
                    top -> quick[line] = strdup( string );
                    top -> color[line] = GetLineColor( i, string );
                    line++;
                }
            }
            if( last == 0 )
                break;
            i++;
        }

        CheckString( NULL, 0, top );

        top -> size = FidoMsgGetStrTell() - top -> telltxt - 1;
        fseek( PktFile, FidoMsgGetStrTell(), SEEK_SET );
        pktcount++;
    }

    free( string );

#ifndef _LITE_

    if( cfgCurrent.sort && pktcount )
    {
        pktOrigin = malloc( pktcount * sizeof( *pktOrigin ));
        if( pktOrigin )
            for( i = 0, index = pktIndex; index; index = index -> next, i++ )
                pktOrigin[i] = index;

        if( cfgCurrent.psort && ( inew = calloc( pktcount, sizeof( *inew ))) != NULL )
        {
            for( i = 0, index = pktIndex; index; index = index -> next, i++ )
                inew[i] = index;

            if( typesort.from ) func = SortFrom;
            if( typesort.to   ) func = SortTo;
            if( typesort.area ) func = SortArea;
            if( typesort.subj ) func = SortSubj;
            if( typesort.date ) func = SortDate;
            if( typesort.size ) func = SortSize;

            if( func )
                MShellSort( inew, pktcount, sizeof( *inew ), func );

            pktIndex = inew[0];
        
            for( i = 1; i < pktcount; i++ )
                inew[i-1] -> next = inew[i];
            inew[i-1] -> next = NULL;

            free( inew );
        }
    }

#endif
    
    WDeactive( wscan );

    return( NO_ERROR );
}
Пример #26
0
	bool ParseChoice(FStrifeDialogueReply **&replyptr)
	{
		FStrifeDialogueReply *reply = new FStrifeDialogueReply;
		memset(reply, 0, sizeof(*reply));

		reply->Next = *replyptr;
		*replyptr = reply;
		replyptr = &reply->Next;

		FString ReplyString;
		FString QuickYes;
		FString QuickNo;
		FString LogString;
		bool closeDialog = false;


		reply->NeedsGold = false;
		while (!sc.CheckToken('}'))
		{
			bool block = false;
			FName key = ParseKey(true, &block);
			if (!block)
			{
				switch(key)
				{
				case NAME_Text:
					ReplyString = CheckString(key);
					break;

				case NAME_Displaycost:
					reply->NeedsGold = CheckBool(key);
					break;

				case NAME_Yesmessage:
					QuickYes = CheckString(key);
					//if (!QuickYes.Compare("_")) QuickYes = "";
					break;

				case NAME_Nomessage:
					QuickNo = CheckString(key);
					break;

				case NAME_Log:
					if (namespace_bits == St)
					{
						const char *s = CheckString(key);
						if(strlen(s) < 4 || strnicmp(s, "LOG", 3) != 0)
						{
							sc.ScriptMessage("Log must be in the format of LOG# to compile, ignoring.");
						}
						else
						{
							reply->LogNumber = atoi(s + 3);
						}
					}
					else
					{
						LogString = CheckString(key);
					}
					break;

				case NAME_Giveitem:
					reply->GiveType = CheckActorType(key);
					break;

				case NAME_Nextpage:
					reply->NextNode = CheckInt(key);
					break;

				case NAME_Closedialog:
					closeDialog = CheckBool(key);
					break;

				case NAME_Special:
					reply->ActionSpecial = CheckInt(key);
					if (reply->ActionSpecial < 0 || reply->ActionSpecial > 255)
						reply->ActionSpecial = 0;
					break;

				case NAME_Arg0:
				case NAME_Arg1:
				case NAME_Arg2:
				case NAME_Arg3:
				case NAME_Arg4:
					reply->Args[int(key)-int(NAME_Arg0)] = CheckInt(key);
					break;


				}
			}
			else
			{
				switch(key)
				{
				case NAME_Cost:
					ParseCost(reply);
					break;

				default:
					sc.UnGet();
					Skip();
				}
			}
		}
		// Todo: Finalize
		if (reply->ItemCheck.Size() > 0)
		{
			if (reply->ItemCheck[0].Amount <= 0) reply->NeedsGold = false;
		}

		reply->Reply = ncopystring(ReplyString);
		reply->QuickYes = ncopystring(QuickYes);
		if (reply->ItemCheck.Size() > 0 && reply->ItemCheck[0].Item != NULL)
		{
			reply->QuickNo = ncopystring(QuickNo);
		}
		else
		{
			reply->QuickNo = NULL;
		}
		reply->LogString = ncopystring(LogString);
		if(!closeDialog) reply->NextNode *= -1;
		return true;
	}
Пример #27
0
	void ParseSector(sector_t *sec, int index)
	{
		int lightcolor = -1;
		int fadecolor = -1;
		int desaturation = -1;
		int fplaneflags = 0, cplaneflags = 0;
		double fp[4] = { 0 }, cp[4] = { 0 };
		FString tagstring;

		memset(sec, 0, sizeof(*sec));
		sec->lightlevel = 160;
		sec->SetXScale(sector_t::floor, 1.);	// [RH] floor and ceiling scaling
		sec->SetYScale(sector_t::floor, 1.);
		sec->SetXScale(sector_t::ceiling, 1.);
		sec->SetYScale(sector_t::ceiling, 1.);
		sec->SetAlpha(sector_t::floor, 1.);
		sec->SetAlpha(sector_t::ceiling, 1.);
		sec->thinglist = NULL;
		sec->touching_thinglist = NULL;		// phares 3/14/98
		sec->render_thinglist = NULL;
		sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1;
		sec->nextsec = -1;	//jff 2/26/98 add fields to support locking out
		sec->prevsec = -1;	// stair retriggering until build completes
		sec->heightsec = NULL;	// sector used to get floor and ceiling height
		sec->sectornum = index;
		sec->damageinterval = 32;
		sec->terrainnum[sector_t::ceiling] = sec->terrainnum[sector_t::floor] = -1;
		if (floordrop) sec->Flags = SECF_FLOORDROP;
		// killough 3/7/98: end changes

		sec->gravity = 1.;	// [RH] Default sector gravity of 1.0
		sec->ZoneNumber = 0xFFFF;

		// killough 8/28/98: initialize all sectors to normal friction
		sec->friction = ORIG_FRICTION;
		sec->movefactor = ORIG_FRICTION_FACTOR;

		sc.MustGetToken('{');
		while (!sc.CheckToken('}'))
		{
			FName key = ParseKey();
			switch(key)
			{
			case NAME_Heightfloor:
				sec->SetPlaneTexZ(sector_t::floor, CheckFloat(key));
				continue;

			case NAME_Heightceiling:
				sec->SetPlaneTexZ(sector_t::ceiling, CheckFloat(key));
				continue;

			case NAME_Texturefloor:
				SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex, false);
				continue;

			case NAME_Textureceiling:
				SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex, false);
				continue;

			case NAME_Lightlevel:
				sec->lightlevel = sector_t::ClampLight(CheckInt(key));
				continue;

			case NAME_Special:
				sec->special = (short)CheckInt(key);
				if (isTranslated) sec->special = P_TranslateSectorSpecial(sec->special);
				else if (namespc == NAME_Hexen)
				{
					if (sec->special < 0 || sec->special > 255 || !HexenSectorSpecialOk[sec->special])
						sec->special = 0;	// NULL all unknown specials
				}
				continue;

			case NAME_Id:
				tagManager.AddSectorTag(index, CheckInt(key));
				continue;

			default:
				break;
			}

			if (namespace_bits & (Zd|Zdt|Va)) switch(key)
			{
				case NAME_Xpanningfloor:
					sec->SetXOffset(sector_t::floor, CheckFloat(key));
					continue;

				case NAME_Ypanningfloor:
					sec->SetYOffset(sector_t::floor, CheckFloat(key));
					continue;

				case NAME_Xpanningceiling:
					sec->SetXOffset(sector_t::ceiling, CheckFloat(key));
					continue;

				case NAME_Ypanningceiling:
					sec->SetYOffset(sector_t::ceiling, CheckFloat(key));
					continue;

				case NAME_Xscalefloor:
					sec->SetXScale(sector_t::floor, CheckFloat(key));
					continue;

				case NAME_Yscalefloor:
					sec->SetYScale(sector_t::floor, CheckFloat(key));
					continue;

				case NAME_Xscaleceiling:
					sec->SetXScale(sector_t::ceiling, CheckFloat(key));
					continue;

				case NAME_Yscaleceiling:
					sec->SetYScale(sector_t::ceiling, CheckFloat(key));
					continue;

				case NAME_Rotationfloor:
					sec->SetAngle(sector_t::floor, CheckAngle(key));
					continue;

				case NAME_Rotationceiling:
					sec->SetAngle(sector_t::ceiling, CheckAngle(key));
					continue;

				case NAME_Lightfloor:
					sec->SetPlaneLight(sector_t::floor, CheckInt(key));
					continue;

				case NAME_Lightceiling:
					sec->SetPlaneLight(sector_t::ceiling, CheckInt(key));
					continue;

				case NAME_Alphafloor:
					sec->SetAlpha(sector_t::floor, CheckFloat(key));
					continue;

				case NAME_Alphaceiling:
					sec->SetAlpha(sector_t::ceiling, CheckFloat(key));
					continue;

				case NAME_Renderstylefloor:
				{
					const char *str = CheckString(key);
					if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::floor, PLANEF_ADDITIVE, 0);
					else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ADDITIVE);
					else sc.ScriptMessage("Unknown value \"%s\" for 'renderstylefloor'\n", str);
					continue;
				}

				case NAME_Renderstyleceiling:
				{
					const char *str = CheckString(key);
					if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::ceiling, PLANEF_ADDITIVE, 0);
					else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ADDITIVE);
					else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyleceiling'\n", str);
					continue;
				}

				case NAME_Lightfloorabsolute:
					if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
					else sec->ChangeFlags(sector_t::floor, PLANEF_ABSLIGHTING, 0);
					continue;

				case NAME_Lightceilingabsolute:
					if (CheckBool(key)) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING);
					else sec->ChangeFlags(sector_t::ceiling, PLANEF_ABSLIGHTING, 0);
					continue;

				case NAME_Gravity:
					sec->gravity = CheckFloat(key);
					continue;

				case NAME_Lightcolor:
					lightcolor = CheckInt(key);
					continue;

				case NAME_Fadecolor:
					fadecolor = CheckInt(key);
					continue;

				case NAME_Desaturation:
					desaturation = int(255*CheckFloat(key));
					continue;

				case NAME_Silent:
					Flag(sec->Flags, SECF_SILENT, key);
					continue;

				case NAME_NoRespawn:
					Flag(sec->Flags, SECF_NORESPAWN, key);
					continue;

				case NAME_Nofallingdamage:
					Flag(sec->Flags, SECF_NOFALLINGDAMAGE, key);
					continue;

				case NAME_Dropactors:
					Flag(sec->Flags, SECF_FLOORDROP, key);
					continue;

				case NAME_SoundSequence:
					sec->SeqName = CheckString(key);
					sec->seqType = -1;
					continue;

				case NAME_hidden:
					Flag(sec->MoreFlags, SECF_HIDDEN, key);
					break;

				case NAME_Waterzone:
					Flag(sec->MoreFlags, SECF_UNDERWATER, key);
					break;

				case NAME_floorplane_a:
					fplaneflags |= 1;
					fp[0] = CheckFloat(key);
					break;

				case NAME_floorplane_b:
					fplaneflags |= 2;
					fp[1] = CheckFloat(key);
					break;

				case NAME_floorplane_c:
					fplaneflags |= 4;
					fp[2] = CheckFloat(key);
					break;

				case NAME_floorplane_d:
					fplaneflags |= 8;
					fp[3] = CheckFloat(key);
					break;

				case NAME_ceilingplane_a:
					cplaneflags |= 1;
					cp[0] = CheckFloat(key);
					break;

				case NAME_ceilingplane_b:
					cplaneflags |= 2;
					cp[1] = CheckFloat(key);
					break;

				case NAME_ceilingplane_c:
					cplaneflags |= 4;
					cp[2] = CheckFloat(key);
					break;

				case NAME_ceilingplane_d:
					cplaneflags |= 8;
					cp[3] = CheckFloat(key);
					break;

				case NAME_damageamount:
					sec->damageamount = CheckInt(key);
					break;

				case NAME_damagetype:
					sec->damagetype = CheckString(key);
					break;

				case NAME_damageinterval:
					sec->damageinterval = CheckInt(key);
					if (sec->damageinterval < 1) sec->damageinterval = 1;
					break;

				case NAME_leakiness:
					sec->leakydamage = CheckInt(key);
					break;

				case NAME_damageterraineffect:
					Flag(sec->Flags, SECF_DMGTERRAINFX, key);
					break;

				case NAME_damagehazard:
					Flag(sec->Flags, SECF_HAZARD, key);
					break;

				case NAME_floorterrain:
					sec->terrainnum[sector_t::floor] = P_FindTerrain(CheckString(key));
					break;

				case NAME_ceilingterrain:
					sec->terrainnum[sector_t::ceiling] = P_FindTerrain(CheckString(key));
					break;

				case NAME_MoreIds:
					// delay parsing of the tag string until parsing of the sector is complete
					// This ensures that the ID is always the first tag in the list.
					tagstring = CheckString(key);
					break;

				default:
					break;
			}
			if ((namespace_bits & (Zd | Zdt)) && !strnicmp("user_", key.GetChars(), 5))
			{
				AddUserKey(key, UDMF_Sector, index);
			}
		}

		if (tagstring.IsNotEmpty())
		{
			FScanner sc;
			sc.OpenString("tagstring", tagstring);
			// scan the string as long as valid numbers can be found
			while (sc.CheckNumber())
			{
				if (sc.Number != 0)	tagManager.AddSectorTag(index, sc.Number);
			}
		}

		if (sec->damageamount == 0)
		{
			// If no damage is set, clear all other related properties so that they do not interfere
			// with other means of setting them.
			sec->damagetype = NAME_None;
			sec->damageinterval = 0;
			sec->leakydamage = 0;
			sec->Flags &= ~SECF_DAMAGEFLAGS;
		}
		
		// Reset the planes to their defaults if not all of the plane equation's parameters were found.
		if (fplaneflags != 15)
		{
			sec->floorplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::floor), sector_t::floor);
		}
		else
		{
			// normalize the vector, it must have a length of 1
			DVector3 n = DVector3(fp[0], fp[1], fp[2]).Unit();
			sec->floorplane.set(n.X, n.Y, n.Z, fp[3]);
		}
		if (cplaneflags != 15)
		{
			sec->ceilingplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::ceiling), sector_t::ceiling);
		}
		else
		{
			DVector3 n = DVector3(cp[0], cp[1], cp[2]).Unit();
			sec->ceilingplane.set(n.X, n.Y, n.Z, cp[3]);
		}

		if (lightcolor == -1 && fadecolor == -1 && desaturation == -1)
		{
			// [RH] Sectors default to white light with the default fade.
			//		If they are outside (have a sky ceiling), they use the outside fog.
			if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
			{
				if (fogMap == NULL)
					fogMap = GetSpecialLights(PalEntry(255, 255, 255), level.outsidefog, 0);
				sec->ColorMap = fogMap;
			}
			else
			{
				if (normMap == NULL)
					normMap = GetSpecialLights (PalEntry (255,255,255), level.fadeto, NormalLight.Desaturate);
				sec->ColorMap = normMap;
			}
		}
		else
		{
			if (lightcolor == -1) lightcolor = PalEntry(255,255,255);
			if (fadecolor == -1)
			{
				if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special & 0xff) == Sector_Outside))
					fadecolor = level.outsidefog;
				else
					fadecolor = level.fadeto;
			}
			if (desaturation == -1) desaturation = NormalLight.Desaturate;

			sec->ColorMap = GetSpecialLights (lightcolor, fadecolor, desaturation);
		}
	}
Пример #28
0
/*
================
idLexer::ReadNumber
================
*/
int idLexer::ReadNumber( idToken *token ) {
	int i;
	int dot;
	char c, c2;

	token->type = TT_NUMBER;
	token->subtype = 0;
	token->intvalue = 0;
	token->floatvalue = 0;

	c = *idLexer::script_p;
	c2 = *(idLexer::script_p + 1);

	if ( c == '0' && c2 != '.' && !(idLexer::flags & LEXFL_NOOXDIGITS) ) {
		// check for a hexadecimal number
		if ( c2 == 'x' || c2 == 'X' ) {
			token->AppendDirty( *idLexer::script_p++ );
			token->AppendDirty( *idLexer::script_p++ );
			c = *idLexer::script_p;
			while((c >= '0' && c <= '9') ||
						(c >= 'a' && c <= 'f') ||
						(c >= 'A' && c <= 'F')) {
				token->AppendDirty( c );
				c = *(++idLexer::script_p);
			}
			token->subtype = TT_HEX | TT_INTEGER;
		}
		// check for a binary number
		else if ( c2 == 'b' || c2 == 'B' ) {
			token->AppendDirty( *idLexer::script_p++ );
			token->AppendDirty( *idLexer::script_p++ );
			c = *idLexer::script_p;
			while( c == '0' || c == '1' ) {
				token->AppendDirty( c );
				c = *(++idLexer::script_p);
			}
			token->subtype = TT_BINARY | TT_INTEGER;
		}
		// its an octal number
		else {
			token->AppendDirty( *idLexer::script_p++ );
			c = *idLexer::script_p;
			while( c >= '0' && c <= '7' ) {
				token->AppendDirty( c );
				c = *(++idLexer::script_p);
			}
			token->subtype = TT_OCTAL | TT_INTEGER;
		}
	}
	else {
		// decimal integer or floating point number or ip address
		dot = 0;
		while( 1 ) {
			if ( c >= '0' && c <= '9' ) {
			}
			else if ( c == '.' ) {
				dot++;
			}
			else {
				break;
			}
			token->AppendDirty( c );
			c = *(++idLexer::script_p);
		}
		// if a floating point number
		if ( dot == 1 ) {
			token->subtype = TT_DECIMAL | TT_FLOAT;
			// check for floating point exponent
			if ( c == 'e' ) {
				c = *(++idLexer::script_p);
				if ( c == '-' ) {
					token->AppendDirty( c );
					c = *(++idLexer::script_p);
				}
				else if ( c == '+' ) {
					token->AppendDirty( c );
					c = *(++idLexer::script_p);
				}
				while( c >= '0' && c <= '9' ) {
					token->AppendDirty( c );
					c = *(++idLexer::script_p);
				}
			}
			// check for floating point exception infinite 1.#INF or indefinite 1.#IND or NaN
			else if ( c == '#' ) {
				c2 = 4;
				if ( CheckString( "INF" ) ) {
					token->subtype |= TT_INFINITE;
				}
				else if ( CheckString( "IND" ) ) {
					token->subtype |= TT_INDEFINITE;
				}
				else if ( CheckString( "NAN" ) ) {
					token->subtype |= TT_NAN;
				}
				else if ( CheckString( "QNAN" ) ) {
					token->subtype |= TT_NAN;
					c2++;
				}
				else if ( CheckString( "SNAN" ) ) {
					token->subtype |= TT_NAN;
					c2++;
				}
				for ( i = 0; i < c2; i++ ) {
					token->AppendDirty( c );
					c = *(++idLexer::script_p);
				}
				while( c >= '0' && c <= '9' ) {
					token->AppendDirty( c );
					c = *(++idLexer::script_p);
				}
				if ( !(idLexer::flags & LEXFL_ALLOWFLOATEXCEPTIONS) ) {
					token->AppendDirty( 0 );	// zero terminate for c_str
					idLexer::Error( "parsed %s", token->c_str() );
				}
			}
		}
		else if ( dot > 1 ) {
			if ( !( idLexer::flags & LEXFL_ALLOWIPADDRESSES ) ) {
				idLexer::Error( "more than one dot in number" );
				return 0;
			}
			if ( dot != 3 ) {
				idLexer::Error( "ip address should have three dots" );
				return 0;
			}
			token->subtype = TT_IPADDRESS;
		}
		else {
			token->subtype = TT_DECIMAL | TT_INTEGER;
		}
	}

	if ( token->subtype & TT_FLOAT ) {
		if ( c > ' ' ) {
			// single-precision: float
			if ( c == 'f' || c == 'F' ) {
				token->subtype |= TT_SINGLE_PRECISION;
				idLexer::script_p++;
			}
			// extended-precision: long double
			else if ( c == 'l' || c == 'L' ) {
				token->subtype |= TT_EXTENDED_PRECISION;
				idLexer::script_p++;
			}
			// default is double-precision: double
			else {
				token->subtype |= TT_DOUBLE_PRECISION;
			}
		}
		else {
			token->subtype |= TT_DOUBLE_PRECISION;
		}
	}
	else if ( token->subtype & TT_INTEGER ) {
		if ( c > ' ' ) {
			// default: signed long
			for ( i = 0; i < 2; i++ ) {
				// long integer
				if ( c == 'l' || c == 'L' ) {
					token->subtype |= TT_LONG;
				}
				// unsigned integer
				else if ( c == 'u' || c == 'U' ) {
					token->subtype |= TT_UNSIGNED;
				}
				else {
					break;
				}
				c = *(++idLexer::script_p);
			}
		}
	}
	else if ( token->subtype & TT_IPADDRESS ) {
		if ( c == ':' ) {
			token->AppendDirty( c );
			c = *(++idLexer::script_p);
			while( c >= '0' && c <= '9' ) {
				token->AppendDirty( c );
				c = *(++idLexer::script_p);
			}
			token->subtype |= TT_IPPORT;
		}
	}
	token->data[token->len] = '\0';
	return 1;
}
/**
 * Function name    CheckWstringLiteral
 * Description      checks whether Literal is an st literal of type Type
 * @param           CString Type
 * @param           CString Literal
 * @param           CString &ErrorMessage
 * @return          BOOL
 * @exception       -
 * @see             -
*/
BOOL CheckTypeOfLiteral(CString Type, CString Literal, CString &ErrorMessage)
{
    ErrorMessage = _T("");
/*
    if (Type.CompareNoCase(_T("BOOL")) == 0)
        return CheckBoolLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("BYTE")) == 0)
        return CheckByteLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("WORD")) == 0)
        return CheckWordLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("DWORD")) == 0)
        return CheckDwordLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("LWORD")) == 0)
        return CheckLwordLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("DINT")) == 0)
        return CheckDintLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("LINT")) == 0)
        return CheckLintLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("LREAL")) == 0)
        return CheckLrealLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("TIME")) == 0)
        return CheckTimeLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("DT")) == 0)
        return CheckDtLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("DATE")) == 0)
        return CheckDateLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("TOD")) == 0)
        return CheckTodLiteral(Literal, ErrorMessage);

    if (Type.CompareNoCase(_T("WSTRING")) == 0)
        return CheckWstringLiteral(Literal, ErrorMessage);
*/

    if ((Type.CompareNoCase(_T("BOOL")) == 0) ||
        (Type.CompareNoCase(_T("BYTE")) == 0) ||
        (Type.CompareNoCase(_T("WORD")) == 0) ||
        (Type.CompareNoCase(_T("DWORD")) == 0) ||
        (Type.CompareNoCase(_T("LWORD")) == 0) ||
        (Type.CompareNoCase(_T("INT")) == 0) ||
        (Type.CompareNoCase(_T("DINT")) == 0) ||
        (Type.CompareNoCase(_T("LINT")) == 0) ||
        (Type.CompareNoCase(_T("REAL")) == 0) ||
        (Type.CompareNoCase(_T("LREAL")) == 0) ||
        (Type.CompareNoCase(_T("TIME")) == 0) ||
        (Type.CompareNoCase(_T("TIME_OF_DAY")) == 0) ||
        (Type.CompareNoCase(_T("DATE_AND_TIME")) == 0) ||
        (Type.CompareNoCase(_T("DT")) == 0) ||
        (Type.CompareNoCase(_T("DATE")) == 0) ||
        (Type.CompareNoCase(_T("TOD")) == 0) ||
        (Type.CompareNoCase(_T("STRING")) == 0) ||
        (Type.CompareNoCase(_T("WSTRING")) == 0))     
    {
        BOOL result = CheckString(Literal, Type, ErrorMessage);
        return result;
    }
    else
    {
        return TRUE;
    }
}