Пример #1
0
/*
 * static int gnLink = 0;
 */
static int gnCountReceived;

/*/
 =======================================================================================================================
 *  Set up the post condition (applied after code has terminated)
 =======================================================================================================================
 */
Operation* CreatePostCondition_id3 (void) {
	Operation*	psPost;

	psPost = NULL;
	psPost = CreateBinary (OPBINARY_EQ, CreateVariable ("sent"), CreateVariable ("test"));

	gnCountReceived = 0;

	return psPost;
}

/*/
 =======================================================================================================================
 *  Apply the pre condition (applied before code is executed)
 =======================================================================================================================
 */
Operation* ApplyPreCondition_id3 (Operation* psOp) {
	int nCount;
	Operation*	psFind;
	Operation*	psTemp;
	char szTemp[1024];
	Operation*	psPost;

	psPost = NULL;

	printf ("Testing for %d variables...\n", gnCountReceived);

	psTemp = NULL;
	for (nCount = 0; (nCount < gnCountReceived) && (psTemp == NULL); nCount++) {
		sprintf (szTemp, "r[%d]", nCount);
		psFind = CreateVariable (szTemp);
		psTemp = NULL;
		psTemp = FindOperation (psOp, psFind);
		FreeRecursive (psFind);
		psFind = NULL;
	}

	if (psTemp) {
		psPost = CreateTruthValue (TRUE);
	} else {
		psPost = CreateTruthValue (FALSE);
	}

	return psPost;
}

/*/
 =======================================================================================================================
 *  Apply the mid condition for LIB SendInteger
 =======================================================================================================================
 */
void ApplyMidCondition_LibSendInteger_id3 (Operation **	 apsOp, int nPC, Operation*	 psM1, Operation*  psM2,
										   Operation*  psM3, Operation*	 psMem, Operation*	psM1set, Operation*	 psM2set) {
	Operation*	psFind;
	Operation*	psSub;

	psFind = NULL;
	psSub = NULL;

	/*
	 * channel = sc[nM3] ;
	 * send = nM2 ;
	 * ADD sent sent nM2 ;
	 * ADD sent sent nM2
	 */
	psFind = CreateVariable ("sent");

	/* Should really be dependant on nM3 */
	psSub = CreateBinary (OPBINARY_ADD, CreateVariable ("sent"), COPY (psM2));
	apsOp[nPC] = SubstituteOperation (COPY (apsOp[nPC + 1]), psFind, psSub);

	FreeRecursive (psFind);
	psFind = NULL;
	FreeRecursive (psSub);
	psSub = NULL;
}
Пример #2
0
	/* Should really be dependant on nM3 */
	psSub = CreateBinary (OPBINARY_ADD, CreateVariable ("sent"), COPY (psM2));
	apsOp[nPC] = SubstituteOperation (COPY (apsOp[nPC + 1]), psFind, psSub);

	FreeRecursive (psFind);
	psFind = NULL;
	FreeRecursive (psSub);
	psSub = NULL;
}

/*/
 =======================================================================================================================
 *  Apply the mid condition for LIB ReceiveInteger
 =======================================================================================================================
 */
void ApplyMidCondition_LibReceiveInteger_id3 (Operation **	apsOp, int nPC, Operation*	psM1, Operation*  psM2,
											  Operation*  psM3, Operation*	psMem, Operation*  psM1set,
											  Operation*  psM2set) {
	Operation*	psMemSub;
	Operation*	psSub;
	char szTemp[1024];

	psMemSub = NULL;
	psSub = NULL;

	/*
	 * channel = sc[nM3] ;
	 * receive = nM2 ;
	 * Establish a variable for the received data
	 */
	sprintf (szTemp, "r[%d]", gnCountReceived);
	gnCountReceived++;

	/* MOV *nM2 gnCountReceived */
	psSub = CreateVariable (szTemp);
	psMemSub = CreateTernary (OPTERNARY_SET, CreateMemory (), COPY (psM2set), CreateVariable (szTemp));
	apsOp[nPC] = SubstituteOperationPair (COPY (apsOp[nPC + 1]), psM2, psSub, psMem, psMemSub);
	FreeRecursive (psSub);
	psSub = NULL;
	FreeRecursive (psMemSub);
	psMemSub = NULL;
}
Пример #3
0
void InexorCefMouseManager::InitializeContext()
{
    CreateFunction("show", this);
    CreateFunction("hide", this);
    CreateFunction("setTexture", this);
    CreateVariable("visible", true);
    CreateVariable("x", true);
    CreateVariable("y", true);
}
Пример #4
0
/*
 * static int gnLink = 0;
 */
static int gnCountReceived;

/*/
 =======================================================================================================================
 *  Set up the post condition (applied after code has terminated)
 =======================================================================================================================
 */
Operation* CreatePostCondition_id3 (void) {
	Operation*	psPost;

	psPost = NULL;
	psPost = CreateBinary (OPBINARY_EQ, CreateVariable ("sent"), CreateVariable ("test"));

	gnCountReceived = 0;

	return psPost;
}
Пример #5
0
void FParser::ParseVarLine(int newvar_type, DFsScript *newvar_script, int start)
{
	int starttoken = start, endtoken;
	
	while(1)
    {
		endtoken = FindOperator(starttoken, NumTokens-1, ",");
		if(endtoken == -1) break;
		CreateVariable(newvar_type, newvar_script, starttoken, endtoken-1);
		starttoken = endtoken+1;  //start next after end of this one
    }
	// dont forget the last one
	CreateVariable(newvar_type, newvar_script, starttoken, NumTokens-1);
}
Пример #6
0
/*
 * static int gnLink = 0;
 */
static int gnCountReceived;

/*/
 =======================================================================================================================
 *  Set up the post condition (applied after code has terminated)
 =======================================================================================================================
 */
Operation* CreatePostCondition_id3 (void) {
	Operation*	psPost;

	psPost = NULL;
	psPost = CreateBinary (OPBINARY_EQ, CreateVariable ("sent"), CreateVariable ("test"));

	gnCountReceived = 0;

	return psPost;
}

/*/
 =======================================================================================================================
 *  Apply the pre condition (applied before code is executed)
 =======================================================================================================================
 */
Operation* ApplyPreCondition_id3 (Operation* psOp) {
	int nCount;
	Operation*	psFind;
	Operation*	psTemp;
	char szTemp[1024];
	Operation*	psPost;

	psPost = NULL;

	printf ("Testing for %d variables...\n", gnCountReceived);

	psTemp = NULL;
	for (nCount = 0; (nCount < gnCountReceived) && (psTemp == NULL); nCount++) {
		sprintf (szTemp, "r[%d]", nCount);
		psFind = CreateVariable (szTemp);
		psTemp = NULL;
		psTemp = FindOperation (psOp, psFind);
		FreeRecursive (psFind);
		psFind = NULL;
	}

	if (psTemp) {
		psPost = CreateTruthValue (TRUE);
	} else {
		psPost = CreateTruthValue (FALSE);
	}

	return psPost;
}
Пример #7
0
static struct asym *AddPredefinedConstant( const char *name, int value )
/**********************************************************************/
{
    struct asym *sym = CreateVariable( name, value );
    if (sym)
        sym->predefined = TRUE;
    return(sym);
}
void FScriptBlueprintCompiler::CreateClassVariablesFromBlueprint()
{
	Super::CreateClassVariablesFromBlueprint();

	UScriptBlueprint* Blueprint = ScriptBlueprint();
	UScriptBlueprintGeneratedClass* NewScripClass = CastChecked<UScriptBlueprintGeneratedClass>(NewClass);
	NewScripClass->ScriptProperties.Empty();

	for (auto& Field : ScriptDefinedFields)
	{
		UClass* InnerType = Field.Class;
		if (Field.Class->IsChildOf(UProperty::StaticClass()))
		{
			FString PinCategory;
			if (Field.Class->IsChildOf(UStrProperty::StaticClass()))
			{
				PinCategory = Schema->PC_String;
			}
			else if (Field.Class->IsChildOf(UFloatProperty::StaticClass()))
			{
				PinCategory = Schema->PC_Float;
			}
			else if (Field.Class->IsChildOf(UIntProperty::StaticClass()))
			{
				PinCategory = Schema->PC_Int;
			}
			else if (Field.Class->IsChildOf(UBoolProperty::StaticClass()))
			{
				PinCategory = Schema->PC_Boolean;
			}
			else if (Field.Class->IsChildOf(UObjectProperty::StaticClass()))
			{
				PinCategory = Schema->PC_Object;
				// @todo: some scripting extensions (that are strongly typed) can handle this better
				InnerType = UObject::StaticClass();
			}
			if (!PinCategory.IsEmpty())
			{
				FEdGraphPinType ScriptPinType(PinCategory, TEXT(""), InnerType, false, false);
				UProperty* ScriptProperty = CreateVariable(Field.Name, ScriptPinType);
				if (ScriptProperty != NULL)
				{
					ScriptProperty->SetMetaData(TEXT("Category"), *Blueprint->GetName());
					ScriptProperty->SetPropertyFlags(CPF_BlueprintVisible | CPF_Edit);
					NewScripClass->ScriptProperties.Add(ScriptProperty);
				}
			}
		}
	}

	CreateScriptContextProperty();
}
void FScriptBlueprintCompiler::CreateScriptContextProperty()
{
	// The only case we don't need a script context is if the script class derives form UScriptPluginComponent
	UClass* ContextClass = nullptr;
	if (Blueprint->ParentClass->IsChildOf(AActor::StaticClass()))
	{
		ContextClass = UScriptContextComponent::StaticClass();
	}
	else if (!Blueprint->ParentClass->IsChildOf(UScriptPluginComponent::StaticClass()))
	{
		ContextClass = UScriptContext::StaticClass();
	}

	if (ContextClass)
	{
		FEdGraphPinType ScriptContextPinType(Schema->PC_Object, TEXT(""), ContextClass, false, false);
		ContextProperty = CastChecked<UObjectProperty>(CreateVariable(TEXT("Generated_ScriptContext"), ScriptContextPinType));
		ContextProperty->SetPropertyFlags(CPF_ContainsInstancedReference | CPF_InstancedReference);
	}
}
Пример #10
0
EvalAtom::EvalAtom(std::wstring& src, 
						 EvalAtomType atomType)
{
	AtomType = atomType;
	Value    = 0.0;
	Index    = -1;
	Function = NULL;
	Operator = NULL;

	switch (atomType)
	{
		case EvalAtomType::Operator:
			CreateOperator(src);
			break;

		case EvalAtomType::Function:
			CreateFunction(src);
			break;

		case EvalAtomType::Variable:
			/**
			 * If identifier of variable will be found in 
			 * internal constants table we will store this
			 * constant, not variable. 
			 */
			if (EvalTable::IsConstExists(src))
			{
				AtomType = EvalAtomType::Constant;
				CreateNamedConstant(src);
			}
			else
			{ CreateVariable(src); }
			break;

		case EvalAtomType::Constant:
			CreateConstant(src);
			break;
	}
}
Пример #11
0
/* SizeStr()
 * defines a numeric variable which contains size of a string
 */
ret_code SizeStrDir( int i, struct asm_tok tokenarray[] )
/*******************************************************/
{
    struct asym *sym;
    int sizestr;

    DebugMsg1(("SizeStrDir entry\n"));
    DebugCmd( sizstrcnt++ );

    if ( i != 1 ) {
        return( EmitErr( SYNTAX_ERROR_EX, tokenarray[i].string_ptr ) );
    }
#if 0 /* this is checked in ParseLine() */
    if ( tokenarray[0].token != T_ID ) {
        return( EmitErr( SYNTAX_ERROR_EX, tokenarray[0].string_ptr ) );
    }
#endif
    if ( tokenarray[2].token != T_STRING || tokenarray[2].string_delim != '<' ) {
        return( TextItemError( &tokenarray[2] ) );
    }
    if ( Token_Count > 3 ) {
        DebugMsg(("SizeStrDir: syntax error, name=%s, Token_Count=%u\n", tokenarray[0].string_ptr, Token_Count));
        return( EmitErr( SYNTAX_ERROR_EX, tokenarray[3].string_ptr ) );
    }

    //sizestr = GetLiteralValue( StringBufferEnd, tokenarray[2].string_ptr );
    sizestr = tokenarray[2].stringlen;

    if ( sym = CreateVariable( tokenarray[0].string_ptr, sizestr ) ) {
        DebugMsg1(("SizeStrDir(%s) exit, value=%u\n", tokenarray[0].string_ptr, sizestr));
        LstWrite( LSTTYPE_EQUATE, 0, sym );
        return( NOT_ERROR );
    }
    return( ERROR );

}
Пример #12
0
ret_code SetCPU( enum cpu_info newcpu )
/*************************************/
{
    int temp;

    DebugMsg1(("SetCPU(%X) enter\n", newcpu ));
    if ( newcpu == P_86 || ( newcpu & P_CPU_MASK ) ) {
        /* reset CPU and EXT bits */
        ModuleInfo.curr_cpu &= ~( P_CPU_MASK | P_EXT_MASK | P_PM );

        /* set CPU bits */
        ModuleInfo.curr_cpu |= newcpu & ( P_CPU_MASK | P_PM );

        /* set default FPU bits if nothing is given and .NO87 not active */
        if ( (ModuleInfo.curr_cpu & P_FPU_MASK) != P_NO87 &&
            ( newcpu & P_FPU_MASK ) == 0 ) {
            ModuleInfo.curr_cpu &= ~P_FPU_MASK;
            if ( ( ModuleInfo.curr_cpu & P_CPU_MASK ) < P_286 )
                ModuleInfo.curr_cpu |= P_87;
            else if ( ( ModuleInfo.curr_cpu & P_CPU_MASK ) < P_386 )
                ModuleInfo.curr_cpu |= P_287;
            else
                ModuleInfo.curr_cpu |= P_387;
        }

    }
    if( newcpu & P_FPU_MASK ) {
        ModuleInfo.curr_cpu &= ~P_FPU_MASK;
        ModuleInfo.curr_cpu |= (newcpu & P_FPU_MASK);
    }
#if AMD64_SUPPORT
    /* enable MMX, K3D, SSEx for 64bit cpus */
    if ( ( newcpu & P_CPU_MASK ) == P_64 )
        ModuleInfo.curr_cpu |= P_EXT_ALL;
#endif
    if( newcpu & P_EXT_MASK ) {
        ModuleInfo.curr_cpu &= ~P_EXT_MASK;
        ModuleInfo.curr_cpu |= (newcpu & P_EXT_MASK);
    }

    /* set the Masm compatible @Cpu value */

    temp = ModuleInfo.curr_cpu & P_CPU_MASK;
    switch ( temp ) {
    case P_186: ModuleInfo.cpu = M_8086 | M_186; break;
    case P_286: ModuleInfo.cpu = M_8086 | M_186 | M_286; break;
    case P_386: ModuleInfo.cpu = M_8086 | M_186 | M_286 | M_386; break;
    case P_486: ModuleInfo.cpu = M_8086 | M_186 | M_286 | M_386 | M_486; break;
    case P_586: ModuleInfo.cpu = M_8086 | M_186 | M_286 | M_386 | M_486 | M_586; break;
    /* Masm's .686 directive doesn't set the Pentium flag! A bug? */
    //case P_686: ModuleInfo.cpu = M_8086 | M_186 | M_286 | M_386 | M_486 | M_586 | M_686; break;
#if AMD64_SUPPORT
    case P_64:
#endif
    case P_686: ModuleInfo.cpu = M_8086 | M_186 | M_286 | M_386 | M_486 | M_686; break;
    default: ModuleInfo.cpu = M_8086; break;
    }
    if ( ModuleInfo.curr_cpu & P_PM )
        ModuleInfo.cpu = ModuleInfo.cpu | M_PROT;

    temp = ModuleInfo.curr_cpu & P_FPU_MASK;
    switch (temp) {
    case P_87:  ModuleInfo.cpu = ModuleInfo.cpu | M_8087;     break;
    case P_287: ModuleInfo.cpu = ModuleInfo.cpu | M_8087 | M_287; break;
    case P_387: ModuleInfo.cpu = ModuleInfo.cpu | M_8087 | M_287 | M_387; break;
    }

    DebugMsg1(("SetCPU: ModuleInfo.curr_cpu=%X, @Cpu=%X\n", ModuleInfo.curr_cpu, ModuleInfo.cpu ));

    //MakeCPUConstant( newcpu );
    if ( ModuleInfo.model == MODEL_NONE )
#if AMD64_SUPPORT
        if ( ( ModuleInfo.curr_cpu & P_CPU_MASK) >= P_64 ) {
            SetDefaultOfssize( USE64 );
        } else
#endif
            SetDefaultOfssize( ((ModuleInfo.curr_cpu & P_CPU_MASK) >= P_386) ? USE32 : USE16 );

    /* Set @Cpu */
    /* differs from Codeinfo cpu setting */

    sym_Cpu = CreateVariable( "@Cpu", ModuleInfo.cpu );

    return( NOT_ERROR );
}
Пример #13
0
 Variable Object::CreateVariable(const QualifiedName& browseName, const Variant& value)
 {
   return CreateVariable(NodeId(), browseName, value);
 }
Пример #14
0
	void FKlawrBlueprintCompiler::KlawrCreateClassVariablesFromBlueprint(UKlawrBlueprintGeneratedClass* NewScripClass)
	{
		NewScripClass->ScriptProperties.Empty();
		NewScripClass->GetScriptDefinedFields(ScriptDefinedFields);

		for (auto& Field : ScriptDefinedFields)
		{
			UClass* InnerType = Field.Class;
			if (Field.Class->IsChildOf(UProperty::StaticClass()))
			{
				FString PinCategory;
				if (Field.Class->IsChildOf(UStrProperty::StaticClass()))
				{
					PinCategory = Schema->PC_String;
				}
				else if (Field.Class->IsChildOf(UFloatProperty::StaticClass()))
				{
					PinCategory = Schema->PC_Float;
				}
				else if (Field.Class->IsChildOf(UIntProperty::StaticClass()))
				{
					PinCategory = Schema->PC_Int;
				}
				else if (Field.Class->IsChildOf(UBoolProperty::StaticClass()))
				{
					PinCategory = Schema->PC_Boolean;
				}
				else if (Field.Class->IsChildOf(UObjectProperty::StaticClass()))
				{
					PinCategory = Schema->PC_Object;
					// @todo: some scripting extensions (that are strongly typed) can handle this better

					InnerType = Field.innerClass;
				}
				if (!PinCategory.IsEmpty())
				{
					FEdGraphPinType ScriptPinType(PinCategory, TEXT(""), InnerType, false, false);
					UProperty* ScriptProperty = CreateVariable(Field.Name, ScriptPinType);

					bool hasCategoryMeta = false;
					for (auto meta : Field.metas)
					{
						hasCategoryMeta |= meta.Key == TEXT("Category");
						ScriptProperty->SetMetaData(*meta.Key, *meta.Value);
					}

					if (ScriptProperty != NULL)
					{
						// If no Category meta is provided in the UPROPERTY attribute, generate one out of the class name
						if (!hasCategoryMeta)
						{
							ScriptProperty->SetMetaData(TEXT("Category"), *Blueprint->GetName());
						}
						ScriptProperty->SetPropertyFlags(CPF_BlueprintVisible | CPF_Edit);
						
						if (NewScripClass->GetAdvancedDisplay(*(Field.Name.ToString())))
						{
							ScriptProperty->SetPropertyFlags(CPF_AdvancedDisplay);
						}

						if (NewScripClass->GetSaveGame(*(Field.Name.ToString())))
						{
							ScriptProperty->SetPropertyFlags(CPF_SaveGame);
						}

						NewScripClass->ScriptProperties.Add(ScriptProperty);
					}
				}
			}
		}

		CreateScriptContextProperty();
	}
Пример #15
0
/* InStr()
 * defines a numeric variable which contains position of substring.
 * syntax:
 * name INSTR [pos,]string, substr
 */
ret_code InStrDir( int i, struct asm_tok tokenarray[] )
/*****************************************************/
{
    struct asym *sym;
    int sizestr;
    int j;
    /* int commas; */
    char *src;
    char *p;
    char *q;
    char *string1;
    struct expr opndx;
    int start = 1;
    int strpos;

    DebugMsg1(("InStrDir entry\n"));
    DebugCmd( instrcnt++ );

    if ( i != 1) {
        return( EmitErr( SYNTAX_ERROR_EX, tokenarray[i].string_ptr ) );
    }
#if 0 /* this is checked in ParseLine() */
    if ( tokenarray[0].token != T_ID ) {
        return( EmitErr( SYNTAX_ERROR_EX, tokenarray[0].string_ptr ) );
    }
#endif

    i++; /* go past INSTR */

    if ( tokenarray[i].token != T_STRING || tokenarray[i].string_delim != '<' ) {
        /* v2.11: flag NOUNDEF added - no forward reference accepted */
        if ( EvalOperand( &i, tokenarray, Token_Count, &opndx, EXPF_NOUNDEF ) == ERROR )
            return( ERROR );
        if ( opndx.kind != EXPR_CONST ) {
            return( EmitError( CONSTANT_EXPECTED ) );
        }
        start = opndx.value;
        if ( start <= 0 ) {
            /* v2.05: don't change the value. if it's invalid, the result
             * is to be 0. Emit a level 3 warning instead.
             */
            //start = 1;
            EmitWarn( 3, POSITIVE_VALUE_EXPECTED );
        }
        if ( tokenarray[i].token != T_COMMA ) {
            return( EmitErr( EXPECTING_COMMA, tokenarray[i].tokpos ) );
        }
        i++; /* skip comma */
    }

    if ( tokenarray[i].token != T_STRING || tokenarray[i].string_delim != '<' ) {
        return( TextItemError( &tokenarray[i] ) );
    }

    /* to compare the strings, the "visible" format is needed, since
     * the possible '!' operators inside the strings is optional and
     * must be ignored.
     */
    //src = StringBufferEnd;
    //sizestr = GetLiteralValue( src, tokenarray[i].string_ptr );
    src = tokenarray[i].string_ptr;
    sizestr = tokenarray[i].stringlen;
    DebugMsg1(("InStrDir: first string >%s< \n", src ));

    if ( start > sizestr ) {
        return( EmitErr( INDEX_VALUE_PAST_END_OF_STRING, start ) );
    }
    p = src + start - 1;

    i++;
    if ( tokenarray[i].token != T_COMMA ) {
        return( EmitErr( EXPECTING_COMMA, tokenarray[i].tokpos ) );
    }
    i++;

    if ( tokenarray[i].token != T_STRING || tokenarray[i].string_delim != '<' ) {
        return( TextItemError( &tokenarray[i] ) );
    }
    //q = GetAlignedPointer( src, sizestr );
    //j = GetLiteralValue( q, tokenarray[i].string_ptr );
    q = tokenarray[i].string_ptr;
    j = tokenarray[i].stringlen;
    DebugMsg1(("InStrDir: second string >%s< \n", q ));
    i++;
    if ( tokenarray[i].token != T_FINAL ) {
        return( EmitErr( SYNTAX_ERROR_EX, tokenarray[i].string_ptr ) );
    }

    strpos = 0;
    /* v2.05: check for start > 0 added */
    /* v2.08: check for j > 0 added */
    if ( ( start > 0 ) && ( sizestr >= j ) && j && ( string1 = strstr( p, q ) ))
        strpos = string1 - src + 1;

    if ( sym = CreateVariable( tokenarray[0].string_ptr, strpos ) ) {
        DebugMsg1(("InStrDir(%s) exit, value=%u\n", tokenarray[0].string_ptr, strpos));
        LstWrite( LSTTYPE_EQUATE, 0, sym );
        return ( NOT_ERROR );
    }
    return( ERROR );
}