Example #1
0
//appends an element onto the end of the element list
bool CLTANode::AppendElement(CLTANode* pElement, ILTAAllocator* pAllocator)
{
	ASSERT(pAllocator);
	ASSERT(IsList());
	
	//resize the array
	CLTANode** pNewBuffer = (CLTANode**)pAllocator->AllocateBlock(sizeof(CLTANode*) * (GetNumElements() + 1));

	//make sure it worked
	if(pNewBuffer == NULL)
	{
		return false;
	}

	//copy over the old data
	memcpy(pNewBuffer, m_pData, sizeof(CLTANode*) * GetNumElements());

	//add the new element onto the end
	pNewBuffer[GetNumElements()] = pElement;

	//delete the old buffer
	pAllocator->FreeBlock(m_pData);

	//and set up the new buffer
	m_pData = pNewBuffer;
	m_nFlags++;

	return true;
}
Example #2
0
void
End_Get_OdinFile(GMC_ARG_VOID)
{
   tp_FilHdr FilHdr;
   tps_FileName FileName;
   tp_Status Status;
   boolean ExecFlag, NeedsData;

   FORBIDDEN(Client_ToDo(CurrentClient) != NIL);
   FORBIDDEN(Client_Job(CurrentClient) != NIL);
   FilHdr = Client_FilHdr(CurrentClient);
   FORBIDDEN(FilHdr == NIL);
   ExecFlag = IsAutoExec(FilHdr);
   NeedsData = ExecFlag || Client_NeedsData(CurrentClient);
   Set_Client_FilHdr(CurrentClient, (tp_FilHdr)NIL, FALSE);
   (void)strcpy(FileName, "");
   Status = STAT_Unknown;
   if (Client_Interrupted(CurrentClient)) {
      Set_Client_Interrupted(CurrentClient, FALSE);
      goto done; }/*if*/;
   FilHdr = Deref(FilHdr);
   if (FilHdr == ERROR) {
      goto done; }/*if*/;
   Status = FilHdr_MinStatus(FilHdr, IK_Trans);
   if (IsList(FilHdr)) {
      goto done; }/*if*/;
   if (NeedsData) {
      FilHdr_DataFileName(FileName, FilHdr); }/*if*/;

done:;
   LocalEnd_Get_OdinFile(FileName, Status, ExecFlag);
   Ret_FilHdr(FilHdr);
   }/*End_Get_OdinFile*/
Example #3
0
    size_t Data::Size() const
    {
	if(!IsList())
	    throw Error::Invalid("Size(const Data& )","Not a list");

	return vec.size();
    }
Example #4
0
    void Data::Sort()
    {
	if(!IsList())
	    throw Error::Invalid("Sort()","Not a list");

	std::sort(vec.begin(),vec.end());
    }
Example #5
0
   GMC_DCL(tp_FilHdr, OrigFilHdr)
{
   tp_LocElm LocElm, LastLocElm;
   tps_FileName DestFileName;

   LocElm = NIL;

   if (!IsSource(DestFilHdr)) {
      SystemError("Destination of copy must be a source file or directory.\n");
      goto done; }/*if*/;

   FilHdr_HostFN(DestFileName, DestFilHdr, FALSE);
   if (!IsDirectory_FileName(DestFileName)) {
      if (IsList(OrigFilHdr)) {
	 SystemError("List objects can only be copied to directories.\n");
	 goto done; }/*if*/;
      LocElm = Make_CopyLocElm(OrigFilHdr, DestFilHdr, FilHdr);
      goto done; }/*if*/;

   LastLocElm = NIL;
   Get_CopyList(&LocElm, &LastLocElm, OrigFilHdr, DestFilHdr, FilHdr);
   Clr_UnionFlags(OrigFilHdr);

done:;
   Set_LocElm(FilHdr, LocElm);
   }/*Exec_CopyCmd*/
std::list<String> CSettings::GetList(String strSetting)
{
	if(IsList(strSetting))
		return GetSetting(strSetting)->listValue;

	return std::list<String>();
}
Example #7
0
void CMyBCGPProp::SetValueByShort(LPCTSTR lpszShort, const _variant_t& varValue)
{
	POSITION pos = m_lstShortOptions.Find(lpszShort);
	if (pos == NULL)
	{
		return;
	}

	if (IsList())
	{
		int nIndex = 0;
		for (POSITION pos = m_lstShortOptions.GetHeadPosition(); pos != NULL; nIndex++)
		{
			if (lpszShort == m_lstShortOptions.GetNext(pos))
			{
				break;
			}
		}

		SetValue(GetOption(nIndex));

		if (m_pBuddyProp)
		{
			m_pBuddyProp->SetValue(varValue);
		}
	}
	else
	{
		SetValue(varValue);
	}
}
Example #8
0
void CMyBCGPProp::GetResultShort(CString& strValue)
{
	if (m_lstShortOptions.GetCount() == 0)
	{
		return;
	}

	CString strShort;
	if (IsList())
	{
		POSITION pos = m_lstShortOptions.FindIndex(GetSelectedOption());
		if (pos == NULL)
		{
			ASSERT(FALSE);
			return;
		}

		strShort = m_lstShortOptions.GetAt(pos);
	}
	else
	{
		strShort = m_lstShortOptions.GetHead();
	}

	if (!strShort.IsEmpty())
	{
		CString strFormatProperty = FormatProperty();
		if (IsText())
		{
			if (!strFormatProperty.IsEmpty())
			{
				strValue += STR_SHORT_PREFIX + strShort + STR_SHORT_TEXT_FALG + strFormatProperty;
			}
		} 
		else
		{
			strValue += STR_SHORT_PREFIX + strShort
				+ (IsList() ? _T("") : FormatProperty());
		}

		if (m_pBuddyProp)
		{
			strValue += m_pBuddyProp->FormatProperty();
		}
	}
}
Example #9
0
bool ICCItem::IsLambdaExpression (void)

//	IsLambdaExpression
//
//	Returns TRUE if this is a lambda expression

	{
	return (IsList() && GetCount() >= 1 && GetElement(0)->IsLambdaSymbol());
	}
Example #10
0
    void Data::DelList(int index)
    {
	if(!IsList())
	    throw Error::Invalid("DelList(int)","Not a list");
	if(index < 0 || index >= (int)vec.size())
	    throw Error::Invalid("DelList(int)","Index out of range");

	vec.erase(index);
    }
Example #11
0
    const Data& Data::operator[](int i) const
    {
	if(!IsList())
	    throw Error::Invalid("Data::operator[](int)","Not a list");

	if(i < 0 || i >= int(vec.size()))
	    throw Error::Range("Data::operator[](int)","Index "+ToString(i)+" out of range");

	return ((const cow_vector<Data>&)(vec))[size_t(i)];
    }
Example #12
0
    Data& Data::operator[](int i)
    {
	if(!IsList())
	    throw Error::Invalid("Data::operator[](int)","Not a list");

	if(i < 0 || i >= int(vec.size()))
	    throw Error::Range("Data::operator[](int)","Index out of range");

	return vec[size_t(i)];
    }
Example #13
0
    bool Data::HasKey(const Data& key) const
    {
	if(!IsList())
	    throw LangErr("Data::HasKey","object is not a list");

	bool is_old;

	KeyLookup(key,is_old);

	return is_old;
    }
    std::string SEXPR::AsString( size_t aLevel )
    {
        std::string result;

        if( IsList() )
        {
            if( aLevel != 0 )
            {
                result = "\n";
            }

            result.append( aLevel* 4, ' ' );
            aLevel++;
            result += "(";

            SEXPR_VECTOR const* list = GetChildren();

            for( std::vector<SEXPR *>::const_iterator it = list->begin(); it != list->end(); ++it )
            {
                result += (*it)->AsString( aLevel );

                if( it != list->end() - 1 )
                {
                    result += " ";
                }
            }
            result += ")";

            aLevel--;
        }
        else if( IsString() )
        {
            result += "\"" + GetString() + "\"";
        }
        else if( IsSymbol() )
        {
            result += GetSymbol();
        }
        else if( IsInteger() )
        {
            std::stringstream out;
            out << GetInteger();
            result += out.str();
        }
        else if( IsDouble() )
        {
            std::stringstream out;
            out << std::setprecision( 16 ) << GetDouble();
            result += out.str();
        }

        return result;
    }
Example #15
0
bool CSettings::AddToList(String strSetting, String strValue)
{
	if(IsList(strSetting))
	{
		GetSetting(strSetting)->listValue.push_back(strValue);

		// Save the XML file
		Save();
		return true;
	}

	return false;
}
Example #16
0
function SafeSmart($drive) {
	if (IsNull(SmartTests[$drive])) {
		if (IsNull(SmartTests)) SmartTests = dict();
		$res = GetDiskSmartInfo($drive);
		if (IsList($res) && size($res)) {
			SmartTests[$drive] = 1;
			return $res;
		}
		SmartTests[$drive] = 0;
		return null;
	}
	else if (SmartTests[$drive] == 0) return null;
	else return GetDiskSmartInfo($drive);
}
Example #17
0
   GMC_DCL(tp_FilHdr, ListFilHdr)
{
   tp_LocElm FirstLE, LastLE;

   if (!(IsList(FilHdr) || IsPntr(FilHdr))) {
      SystemError("Input to :map must be a list.\n");
      return ERROR; }/*if*/;

   FirstLE = NIL; LastLE = NIL;
   Get_Map(&FirstLE, &LastLE, FilHdr, FilHdr_FilPrm(ListFilHdr),
	   FilTyp_ArgFilTyp(FilHdr_FilTyp(ListFilHdr)), ListFilHdr);
   Clr_UnionFlags(FilHdr);
   return FirstLE;
   }/*Make_MapLocElm*/
Example #18
0
    const Data& Data::operator[](const Data& key) const
    {
	if(!IsList())
	    throw Error::Invalid("Data::operator[](const Data&)","Not a dictionary.");

	if(!HasKey(key))
	    return Null;

	bool is_old;
	size_t i;

	i=KeyLookup(key,is_old);
		
	return ((const cow_vector<Data>&)(vec))[size_t(i)][1];
    }
Example #19
0
    bool Data::DelEntry(const Data& entry)
    {
	if(!IsList())
	    throw Error::Invalid("DelEntry(int)","Not a list");

	bool already_exist;
	size_t pos=KeyLookup(entry,already_exist);

	if(!already_exist)
	    return false;

	DelList(pos);

	return true;
    }
Example #20
0
    Data Data::Keys() const
    {
	if(!IsList())
	    return Null;

	Data ret;		
	ret.MakeList(Size());
		
	for(size_t i=0; i<Size(); i++)
	    if(!(*this)[i].IsList(2))
		return Null;
	    else
		ret[i]=(*this)[i][0];

	return ret;
    }
Example #21
0
bool CSettings::SetEx(String strSetting, String strValue)
{
	if(IsBool(strSetting))
		SetBool(strSetting, strValue.ToBoolean());
	else if(IsInteger(strSetting))
		SetInteger(strSetting, strValue.ToInteger());
	else if(IsFloat(strSetting))
		SetFloat(strSetting, strValue.ToFloat());
	else if(IsString(strSetting))
		SetString(strSetting, strValue);
	else if(IsList(strSetting))
		AddToList(strSetting, strValue);
	else
		return false;

	return true;
}
Example #22
0
LPCTSTR CMyBCGPProp::GetSelectedPreviewOption() const
{
	if (m_lstPreviewOptions.GetCount() == 0)
	{
		return NULL;
	}

	if (IsList())
	{
		POSITION pos = m_lstPreviewOptions.FindIndex(GetSelectedOption());
		if (pos == NULL)
		{
			ASSERT(FALSE);
			return NULL;
		}

		return m_lstPreviewOptions.GetAt(pos);
	}
	return m_lstPreviewOptions.GetHead();
}
Example #23
0
    Data* Data::FindKey(const Data& key)
    {
	if(!IsList())
	    throw LangErr("Data::FindKey","object is not a list");

	bool is_old;
	size_t i;

	i=KeyLookup(key,is_old);

	if(!is_old)
	{
	    Data pair;

	    pair.MakeList(2);
	    pair.vec[0]=key;
			
	    return InsertAt(i,pair);
	}
		
	return &vec[i];
    }
Example #24
0
    Data* Data::InsertAt(int pos,const Data& object)
    {
	if(!IsList())
	    throw LangErr("Data::InsertAt","object is not a list");

	size_t i = size_t(pos);

	// note size_t is unsigned, so no need to check if i < 0
	if(i > vec.size())
	    throw LangErr("Data::InsertAt","invalid position");
			
	if(i==vec.size())
	{
	    vec.push_back(object);
	    return &vec[vec.size()-1];
	}
	else
	{
	    vec.insert(i,object);
	    return &vec[i];
	}
    }
int COHScriptObject::EditorGroupingCategory() {
  // Category 0: autoplayer / OpenPPL
  if (p_function_collection->IsOpenPPLProfile()  && IsMainOpenPPLFunction()) return 0;
  if (!p_function_collection->IsOpenPPLProfile() && IsAutoplayerFunction())  return 0;
  // Category 1: Secondary (f$chat,..) DLL, notes)
  if (IsSecondaryFunction()) return 1;
  if (IsNotesOrDLL()) return 1;
  // Category 2: Hopper funvtions (f$sitin, f$close, ...)
  if (IsHopperFunction()) return 2;
  // Category 3: Ini-fucntions
  if (IsIniFunction()) return 3;
  // Category 4: PrWin functions
  if (IsPrWinFunction()) return 4;
  // Category 5: ICM-functions
  if (IsICMConfigurationFunction()) return 5;
  // Category 6: debug-functions
  if (IsDebugFunction()) return 6;
  // Category 7: hand-lists
  if (IsList()) return 7;
  // Category 8: other user defined functions
  if (IsUserDefinedFunction()) return 8;
  // Treat undefined as user-defined;
  return 7;
}
static int
p_text_to_string(value v, type t, value vs, type ts)
{
    pword	*pw, *list;
    char	*s;
    int		len;
    pword	*old_tg = Gbl_Tg;

    if (IsRef(t))
    {
	Bip_Error(PDELAY_1);
    }

    if (IsString(t))
    {
	Kill_DE;
	Return_Unify_Pw(v, t, vs, ts);
    }

    if (IsAtom(t))	/* not including [] ! */
    {
	Kill_DE;
	Return_Unify_String(vs, ts, DidString(v.did));
    }

    if (IsNil(t))
    {
	Kill_DE;
	Return_Unify_String(vs, ts, empty_string);
    }

    if (IsList(t))		/* make a string from a list	*/
    {
	int element_type = 0;
	list = v.ptr;		/* space for the string header	*/
	Push_Buffer(1);		/* make minimum buffer		*/
	s = (char *) BufferStart(old_tg);	/* start of the new string */
	for(;;)			/* loop through the list	*/
	{
	    int c;
	    pw = list++;
	    Dereference_(pw);		/* get the list element	*/
	    if (IsRef(pw->tag))		/* check it		*/
	    {
		Gbl_Tg = old_tg;
		Push_var_delay(vs.ptr, ts.all);
		Push_var_delay(pw, pw->tag.all);
		Bip_Error(PDELAY);
	    }
	    else if (IsInteger(pw->tag))	/* char code */
	    {
		element_type |= 1;
		c = pw->val.nint;
		if (c < 0 || 255 < c)
		{
		    Gbl_Tg = old_tg;
		    Bip_Error(RANGE_ERROR);
		}
	    }
	    else if (IsAtom(pw->tag))		/* char atom */
	    {
		element_type |= 2;
		if (DidLength(pw->val.did) != 1)
		{
		    Gbl_Tg = old_tg;
		    Bip_Error(RANGE_ERROR);
		}
		c = DidName(pw->val.did)[0];
	    }
	    else
	    {
		Gbl_Tg = old_tg;
		Bip_Error(TYPE_ERROR);
	    }
	    *s++ = c;
	    if (s == (char *) Gbl_Tg)	/* we need another pword */
	    {
		Gbl_Tg += 1;
		Check_Gc;
	    }
	    Dereference_(list);		/* get the list tail	*/
	    if (IsRef(list->tag))
	    {
		Gbl_Tg = old_tg;
		Push_var_delay(vs.ptr, ts.all);
		Push_var_delay(list, list->tag.all);
		Bip_Error(PDELAY);
	    }
	    else if (IsList(list->tag))
		list = list->val.ptr;
	    else if (IsNil(list->tag))
		break;			/* end of the list	*/
	    else
	    {
		Gbl_Tg = old_tg;
		Bip_Error(TYPE_ERROR);
	    }
	}
	if (element_type != 1 && element_type != 2)	/* mixed type list? */
	{
	    Gbl_Tg = old_tg;
	    Bip_Error(TYPE_ERROR);
	}
	*s = '\0';			/* terminate the string		*/
	Set_Buffer_Size(old_tg, s - (char *)(old_tg + 1) + 1);
	Kill_DE;
	Return_Unify_String(vs, ts, old_tg);
    }

    Bip_Error(TYPE_ERROR);
}
Example #27
0
    void Data::AddList(const Data& item)
    {
	if(!IsList())
	    throw Error::Invalid("AddList(const Data& )","Not a list");
	vec.push_back(item);
    }
Example #28
0
BOOL CMyBCGPProp::IsText() const
{
	return (m_varValue.vt == VT_BSTR) && !IsList();
}
static int
p_string_list(value vs, type ts, value vl, type tl)
{
    register pword	*pw, *list;
    register char	*s;
    register int	len;
    pword		*old_tg = Gbl_Tg;

    if (IsRef(ts))			/* no string given	*/
    {
	if (IsRef(tl))			/* we need at least one	*/
	{
	    Bip_Error(PDELAY_1_2);
	}
	else if (IsList(tl))		/* make a string from a list	*/
	{
	    list = vl.ptr;		/* space for the string header	*/
	    Push_Buffer(1);		/* make minimum buffer		*/
	    s = (char *) BufferStart(old_tg);	/* start of the new string */
	    for(;;)			/* loop through the list	*/
	    {
		pw = list++;
		Dereference_(pw);		/* get the list element	*/
		if (IsRef(pw->tag))		/* check it		*/
		{
		    Gbl_Tg = old_tg;
		    Push_var_delay(vs.ptr, ts.all);
		    Push_var_delay(pw, pw->tag.all);
		    Bip_Error(PDELAY);
		}
		else if (!IsInteger(pw->tag))
		{
		    Gbl_Tg = old_tg;
		    Bip_Error(TYPE_ERROR);
		}
		else if (pw->val.nint < 0  ||  pw->val.nint > 255)
		{
		    Gbl_Tg = old_tg;
		    Bip_Error(RANGE_ERROR);
		}
		*s++ = pw->val.nint;
		if (s == (char *) Gbl_Tg)	/* we need another pword */
		{
		    Gbl_Tg += 1;
		    Check_Gc;
		}
		Dereference_(list);		/* get the list tail	*/
		if (IsRef(list->tag))
		{
		    Gbl_Tg = old_tg;
		    Push_var_delay(vs.ptr, ts.all);
		    Push_var_delay(list, list->tag.all);
		    Bip_Error(PDELAY);
		}
		else if (IsList(list->tag))
		    list = list->val.ptr;
		else if (IsNil(list->tag))
		    break;			/* end of the list	*/
		else
		{
		    Gbl_Tg = old_tg;
		    Bip_Error(TYPE_ERROR);
		}
	    }
	    *s = '\0';			/* terminate the string		*/
	    Set_Buffer_Size(old_tg, s - (char *)(old_tg + 1) + 1);
	    Kill_DE;
	    Return_Unify_String(vs, ts, old_tg);
	}
	else if (IsNil(tl))
	{
	    Kill_DE;
	    Return_Unify_String(vs, ts, empty_string);
	}
	else
	{
	    Bip_Error(TYPE_ERROR);
	}
    }
    else if (IsString(ts))
    {
	Kill_DE;
	Check_Output_List(tl);
	s = StringStart(vs);		/* get a pointer to the string	*/
	len = StringLength(vs);
	if (len == 0)
	{
	    Return_Unify_Nil(vl, tl);
	}
	/* Additional a-priori overflow check because adding to TG may
	 * may wrap around the address space and break Check_Gc below
	 */
	Check_Available_Pwords(2*len);
	pw = Gbl_Tg;			/* reserve space for the list	*/
	Gbl_Tg += 2*len;
	Check_Gc;
	pw->val.nint = *s++ & 0xFFL;	/* construct the list	*/
	pw++->tag.kernel = TINT;
	while (--len > 0)
	{
	    pw->val.ptr = pw + 1;
	    pw++->tag.kernel = TLIST;
	    pw->val.nint = *s++ & 0xFFL;
	    pw++->tag.kernel = TINT;
	}
	pw->tag.kernel = TNIL;
	Return_Unify_List(vl, tl, old_tg);
    }
    else
    {
	Bip_Error(TYPE_ERROR);
    }
}
Example #30
0
   GMC_DCL(tp_Date, DepModDate)
{
   tps_ExecSpc _ExecSpc; tp_ExecSpc ExecSpc = &_ExecSpc;
   tp_Job Job;
   tp_Tool Tool;
   tp_TClass TClass;
   tp_InpFilHdrs Inputs;
   tp_OutFilHdrs Outputs;
   tp_FileName OldErrFileName;
   tp_FilDsc OldErrFD;
   tps_FileName InFileName, OutFileName;
   tps_Str StrBuf;
   tp_FilDsc InFD, OutFD;
   tp_Status MinStatus;
   tp_FilHdr ElmFilHdr, DestFilHdr, OprFilHdr;
   tp_LocElm LocElm, FirstLE, LastLE;
   tp_FilElm FilElm;
   int i;
   boolean ErrFlag, OldIsIPC;

   Do_Log("Generating", FilHdr, LOGLEVEL_IntGenerate);
   MinStatus = DepStatus;

   Tool = FilHdr_Tool(FilHdr);
   FilHdr_ExecSpc(ExecSpc, FilHdr);
   Job = New_Job();
   ExecSpc->Job = Job;
   Inputs = ExecSpc->InpFilHdrs;
   Outputs = ExecSpc->OutFilHdrs;

   Save_ErrFile(&OldErrFileName, &OldIsIPC, &OldErrFD);
   Set_ErrFile(Job->ErrorFN, FALSE, (tp_FilDsc)NIL);
   Clr_ErrStatus(FilHdr);

   TClass = Tool_TClass(Tool);
   switch (TClass) {
      case TC_Str: {
	 break;}/*case*/;
      case TC_StructMem: {
	 FATALERROR("StructMem's should always be up-to-date");
	 break;}/*case*/;
      case TC_PrmValues: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 FirstLE = NIL; LastLE = NIL;
	 FilPVal_LocElm(&FirstLE, &LastLE,
			FilPrm_FilPVal(FilHdr_FilPrm(FilHdr)), FilHdr);
	 Set_LocElm(FilHdr, FirstLE);
	 break;}/*case*/;
      case TC_First: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 /*select*/{
	    if (FilHdr_LocElm(Inputs[0]) == 0) {
	       LocElm = Make_LocElm(NilStrFilHdr, RootFilPrm, FilHdr);
	    }else{
	       FilElm = LocElm_FilElm(FilHdr_LocElm(Inputs[0]));
	       ElmFilHdr = FilElm_FilHdr(FilElm);
	       Ret_FilElm(FilElm);
	       LocElm = Make_LocElm(ElmFilHdr, RootFilPrm, FilHdr);
	       Ret_FilHdr(ElmFilHdr); };}/*select*/;
	 Set_LocElm(FilHdr, LocElm);
	 break;}/*case*/;
      case TC_DrvDirElm: {
	 if (MinStatus > STAT_NoFile) {
	    Add_ErrStatus(FilHdr, STAT_NoFile);
	    MinStatus = STAT_NoFile; }/*if*/;
	 break;}/*case*/;
      case TC_VirDirElm: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 LocElm = 0;
	 ElmFilHdr = Do_Key(FilHdr_Father(Copy_FilHdr(Inputs[0])),
			    FilHdr_Key(StrBuf, FilHdr));
	 if (ElmFilHdr != ERROR) {
	    LocElm = Make_LocElm(ElmFilHdr, RootFilPrm, FilHdr);
	    Ret_FilHdr(ElmFilHdr); }/*if*/;
	 Set_LocElm(FilHdr, LocElm);
	 break;}/*case*/;
      case TC_Collect: {
	 FORBIDDEN(ExecSpc->NumInps < 1 || ExecSpc->NumOuts != 1);
	 FirstLE = NIL; LastLE = NIL;
	 for (i=0; i<ExecSpc->NumInps; i++) {
	    LocElm = Make_LocElm(Inputs[i], FilHdr_FilPrm(FilHdr), FilHdr);
	    Chain_LocElms(&FirstLE, &LastLE, LocElm);
	    }/*for*/;
	 Set_LocElm(FilHdr, FirstLE);
	 if (IsPntr(FilHdr)) Validate_IsPntr(FilHdr);
	 break;}/*case*/;
      case TC_ReadList: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Exec_List(FilHdr, Inputs[0], FilHdr_FilPrm(FilHdr), FALSE);
	 if (IsPntr(FilHdr)) Validate_IsPntr(FilHdr);
	 break;}/*case*/;
      case TC_SrcNames: case TC_OpNames: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 FilHdr_DataFileName(InFileName, Inputs[0]);
	 WriteSrcNames(OutFD, InFileName, (TClass == TC_OpNames));
	 Close(OutFD);
	 break;}/*case*/;
      case TC_ViewSpec: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Exec_List(FilHdr, Inputs[0], RootFilPrm, FALSE);
	 Validate_ViewSpec(FilHdr);
	 break;}/*case*/;
      case TC_CmptView: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Exec_CmptView(&ErrFlag, FilHdr, Inputs[0]);
	 if (ErrFlag) {
	    Add_ErrStatus(FilHdr, STAT_TgtValError);
	    if (MinStatus > STAT_TgtValError) {
	       MinStatus = STAT_TgtValError; }/*if*/; }/*if*/;
	 break;}/*case*/;
      case TC_Directory: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 ElmFilHdr = FilHdr_DirFilHdr(Copy_FilHdr(Inputs[0]));
	 Set_LocElm(FilHdr, Make_LocElm(ElmFilHdr, RootFilPrm, FilHdr));
	 Ret_FilHdr(ElmFilHdr);
	 break;}/*case*/;
      case TC_Name: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WritePrmOdinExpr(OutFD, Inputs[0], FilHdr_FilPrm(FilHdr));
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Names: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteNames(OutFD, Inputs[0], FilHdr_FilPrm(FilHdr));
	 Close(OutFD);
	 break;}/*case*/;
      case TC_FileName: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 /*select*/{
	    if (IsAtmc(Inputs[0])) {
	       Get_WorkFileName(OutFileName, Job, FilHdr);
	       OutFD = FileName_WFilDsc(OutFileName, TRUE);
	       FilHdr_DataFileName(InFileName, Inputs[0]);
	       Writeln(OutFD, InFileName);
	       Close(OutFD);
	    }else{
	       FilHdr_Error("Input to :filename must be atomic: <%s>.\n",
			    Inputs[0]); };}/*select*/;
	 break;}/*case*/;
      case TC_FileNames: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteFlat(OutFD, Inputs[0]);
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Cat: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteCat(OutFD, Inputs[0]);
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Union: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Set_LocElm(FilHdr, Make_UnionLocElm(Inputs[0], FilHdr));
	 break;}/*case*/;
      case TC_PntrHo: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Set_LocElm(FilHdr, Make_PntrHoLocElm(Inputs[0], FilHdr));
	 break;}/*case*/;
      case TC_Apply: {
	 FORBIDDEN(ExecSpc->NumInps != 2 || ExecSpc->NumOuts != 1);
	 OprFilHdr = Deref(Copy_FilHdr(Inputs[1]));
	 FilHdr_DataFileName(InFileName, OprFilHdr);
	 Push_ContextFilHdr(OprFilHdr);
	 Set_LocElm(FilHdr, Make_ApplyLocElm(Inputs[0], FilHdr, InFileName));
	 Pop_ContextFilHdr();
	 break;}/*case*/;
      case TC_DerefPrmVal: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Set_LocElm(FilHdr, Make_DerefPrmValLocElm(Inputs[0], FilHdr));
	 break;}/*case*/;
      case TC_Map: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Set_LocElm(FilHdr, Make_MapLocElm(Inputs[0], FilHdr));
	 break;}/*case*/;
      case TC_Recurse: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Set_LocElm(FilHdr, Make_RecurseLocElm(Inputs[0], FilHdr));
	 break;}/*case*/;
      case TC_Extract: case TC_Delete: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Set_LocElm(FilHdr, Make_ExDelLocElm(Inputs[0], FilHdr,
					     (TClass == TC_Extract)));
	 break;}/*case*/;
      case TC_PntrElm: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 LocElm = 0;
	 ElmFilHdr = Do_Key(Copy_FilHdr(Inputs[0]), FilHdr_Key(StrBuf, FilHdr));
	 if (ElmFilHdr != ERROR) {
	    LocElm = Make_LocElm(ElmFilHdr, RootFilPrm, FilHdr);
	    Ret_FilHdr(ElmFilHdr); }/*if*/;
	 Set_LocElm(FilHdr, LocElm);
	 break;}/*case*/;
      case TC_Error: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteReport(OutFD, Inputs[0], STAT_TgtValError);
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Warning: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteReport(OutFD, Inputs[0], STAT_Warning);
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Label: {
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 Writeln(OutFD, FilHdr_Label(StrBuf, Inputs[0], FALSE));
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Labels: {
	 FORBIDDEN(!IsList(Inputs[0]));
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteLabels(OutFD, Inputs[0]);
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Id: {
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteInt(OutFD, (int)FilHdr_LocHdr(Inputs[0]));
	 Writeln(OutFD, "");
	 Close(OutFD);
	 break;}/*case*/;
      case TC_Depend: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 FirstLE = NIL; LastLE = NIL;
	 GetDepend(&FirstLE, &LastLE, Inputs[0], FilHdr);
	 Set_LocElm(FilHdr, FirstLE);
	 break;}/*case*/;
      case TC_InternalPntr: {
	 break;}/*case*/;
      case TC_TargetsPtr: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Exec_TargetsPtr(FilHdr, Inputs[0]);
	 break;}/*case*/;
      case TC_TargetsInc: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Exec_List(FilHdr, Inputs[0], RootFilPrm, TRUE);
	 break;}/*case*/;
      case TC_Targets: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 FilHdr_DataFileName(InFileName, Inputs[0]);
	 Push_ContextFilHdr(Copy_FilHdr(Inputs[0]));
	 Exec_Targets(OutFD, InFileName);
	 Pop_ContextFilHdr();
	 Close(OutFD);
	 break;}/*case*/;
      case TC_ActTargets: case TC_VirTargets: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 FilHdr_DataFileName(InFileName, Inputs[0]);
	 InFD = FileName_RFilDsc(InFileName, FALSE);
	 LocElm = NIL;
	 if (InFD != NIL) {
	    Push_ContextFilHdr(Copy_FilHdr(FilHdr));
	    LocElm = Make_TargetsLocElm(FilHdr, InFD, InFileName, DepModDate,
					 (TClass == TC_VirTargets));
	    Pop_ContextFilHdr();
	    Close(InFD); }/*if*/;
	 Set_LocElm(FilHdr, LocElm);
	 break;}/*case*/;
      case TC_VirDir: {
	 Exec_VirDir(FilHdr, Inputs[0]);
	 break;}/*case*/;
      case TC_CopyCmd: {
	 DestFilHdr = Deref(LocHdr_FilHdr
	    (FilPVal_LocHdr(FilPrm_FilPVal(FilHdr_FilPrm(FilHdr)))));
	 /*select*/{
	    if (DestFilHdr == ERROR) {
	       SystemError("+copydestdesc=(dest) parameter required.\n");
	    }else{
	       Exec_CopyCmd(FilHdr, DestFilHdr, Inputs[0]);
	       Ret_FilHdr(DestFilHdr); };}/*select*/;
	 break;}/*case*/;
      case TC_ExpandHooks: {
	 FORBIDDEN(ExecSpc->NumInps != 2 || ExecSpc->NumOuts != 1);
	 FilHdr_DataFileName(InFileName, Inputs[1]);
	 InFD = FileName_RFilDsc(InFileName, TRUE);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 ExpandHooks(OutFD, InFD, Inputs[0]);
	 Close(InFD); Close(OutFD);
	 break;}/*case*/;
      case TC_NestedHooks: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 2);
	 FilHdr_DataFileName(InFileName, Inputs[0]);
	 InFD = FileName_RFilDsc(InFileName, TRUE);
	 Get_WorkFileName(OutFileName, Job, Outputs[1]);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 NestedHooks(Outputs[0], Outputs[1], OutFD,
		     InFD, FilHdr_FilPrm(FilHdr));
	 Close(InFD); Close(OutFD);
	 break;}/*case*/;
      case TC_TextDef: {
	 FilHdr_DataFileName(InFileName, Inputs[0]);
	 InFD = FileName_RFilDsc(InFileName, TRUE);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteTextDef(FilHdr, OutFD, OutFileName, InFD, InFileName);
	 Close(InFD); Close(OutFD);
	 break;}/*case*/;
      case TC_PrefixHelp: case TC_SuffixHelp: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteSrcFilTyps(OutFD, (TClass == TC_PrefixHelp));
	 Close(OutFD);
	 break;}/*case*/;
      case TC_DrvHelp: {
	 FORBIDDEN(ExecSpc->NumInps != 1 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WriteDrvHelp(OutFD, Inputs[0]);
	 Close(OutFD);
	 break;}/*case*/;
      case TC_PrmHelp: {
	 FORBIDDEN(ExecSpc->NumInps > 2 || ExecSpc->NumOuts != 1);
	 Get_WorkFileName(OutFileName, Job, FilHdr);
	 OutFD = FileName_WFilDsc(OutFileName, TRUE);
	 WritePrmHelp(OutFD, Inputs[0], FilHdr_FilPrm(FilHdr));
	 Close(OutFD);
	 break;}/*case*/;
      default: {
	 FATALERROR("illegal system tool"); }}/*switch*/;

   ErrFlag = IsErr();
   Set_ErrFile(OldErrFileName, OldIsIPC, OldErrFD);
   if (ErrFlag) {
      Add_StatusFile(FilHdr, STAT_Error, Job->ErrorFN);
      if (MinStatus > STAT_Error) {
	 MinStatus = STAT_Error; }/*if*/; }/*if*/;
   if (MinStatus == STAT_Error && IsTargets(FilHdr)) {
      MinStatus = STAT_TgtValError; }/*if*/;

   Do_Update(FilHdr, ExecSpc->OutFilHdrs, ExecSpc->NumOuts, Job,
	     MinStatus, DepModDate, TRUE);

   Ret_Job(Job);
   Ret_ExecSpc(ExecSpc);
   }/*ExecInternal*/