Esempio n. 1
0
void DoStart (GPtr globals)
{		
	ValidateParameters (globals);
	/* if stuff hasn't been initialized that we need, do it,
		then go check if we've got scripting commands to
		override our settings */
	
	// update our parameters with the scripting parameters, if available
	ReadScriptParams (globals); 

	// always reset the global document descriptor for safety
	gDocDesc = gDocInfo;

	if (gQueryForParameters)
	{
		DoUI (globals);	// Show the UI
		gQueryForParameters = FALSE;
	}

	// Delete the memory we used for the Proxy view
	ReleaseProxyMemory(globals);

	if (gResult != noErr)
		return;
			
	// Do the actual filtering operation on the original image
	DoEffect(globals);
		
}
Esempio n. 2
0
void InitGlobals (Ptr globalPtr)
{	
	// create "globals" as a our struct global pointer so that any
	// macros work:
	GPtr globals = (GPtr)globalPtr;

	gProxyRect.top = 0;
	gProxyRect.bottom = 0;
	gProxyRect.left = 0;
	gProxyRect.right = 0;
	gViewAllLayerData = FALSE;
	gViewLayerIndex = 0;
	gDocDesc = gDocInfo;
	gScaleFactor = 1;
	gChannelData = NULL;
	gMaskData = NULL;
	gSelectionData = NULL;
	gOverlayData = NULL;
	if (gStuff->sSPBasic->AcquireSuite( kPSChannelPortsSuite,
					    				kPSChannelPortsSuiteVersion3,
										(const void **)&gPSChannelPortsSuite))
			gResult = errPlugInHostInsufficient;
	if (gStuff->sSPBasic->AcquireSuite(	kPSBufferSuite,
										kPSBufferSuiteVersion2,
										(const void **)&gPSBufferSuite64))
			gResult = errPlugInHostInsufficient;

	// Initialize global variables:
	ValidateParameters (globals);
	
} // end InitGlobals
Esempio n. 3
0
void DoParameters (GPtr globals)

{
	ValidateParameters (globals);
	
	gQueryForParameters = TRUE;
	/* If we're here, that means we're being called for the first time. */
}
Esempio n. 4
0
	void EncryptionModeLRW::DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
	{
		if_debug (ValidateState ());
		if_debug (ValidateParameters (data, sectorCount, sectorSize));

		DecryptBuffer (data,
			sectorCount * sectorSize,
			SectorToBlockIndex (sectorIndex));
	}
Esempio n. 5
0
void InitGlobals (Ptr globalPtr)
{	
	// create "globals" as a our struct global pointer so that any
	// macros work:
	GPtr globals = (GPtr)globalPtr;
	
	// Initialize global variables:
	ValidateParameters (globals);
	
} // end InitGlobals
void UAnimNotifyState_TimedParticleEffect::NotifyBegin(USkeletalMeshComponent * MeshComp, class UAnimSequenceBase * Animation, float TotalDuration)
{
	// Only spawn if we've got valid params
	if(ValidateParameters(MeshComp))
	{
		UParticleSystemComponent* NewComponent = UGameplayStatics::SpawnEmitterAttached(PSTemplate, MeshComp, SocketName, LocationOffset, RotationOffset);
	}

	Received_NotifyBegin(MeshComp, Animation, TotalDuration);
}
void USceneCapturer::SetInitialState( int32 InStartFrame, int32 InEndFrame, FStereoCaptureDoneDelegate& InStereoCaptureDoneDelegate )
{
	if( bIsTicking )
	{
		UE_LOG( LogStereoPanorama, Warning, TEXT( "Already capturing a scene; concurrent captures are not allowed" ) );
		return;
	}

	CapturePlayerController = UGameplayStatics::GetPlayerController( GWorld, 0 );
	CaptureGameMode = UGameplayStatics::GetGameMode( GWorld );

	if( CaptureGameMode == NULL || CapturePlayerController == NULL )
	{
		UE_LOG( LogStereoPanorama, Warning, TEXT( "Missing GameMode or PlayerController" ) );
		return;
	}

	// Calculate the steps and validate they will produce good results
	ValidateParameters();

	// Setup starting criteria
    StartFrame        = InStartFrame;
    EndFrame          = InEndFrame;
	CurrentFrameCount = 0;
    CurrentStep       = 0;
    CaptureStep       = ECaptureStep::Unpause;

	Timestamp = FString::Printf( TEXT( "%s" ), *FDateTime::Now().ToString() );
	
	//SetStartPosition();

	// Create storage for atlas textures
    check( UnprojectedAtlasWidth * UnprojectedAtlasHeight <= MAX_int32 );
	UnprojectedLeftEyeAtlas.AddUninitialized(  UnprojectedAtlasWidth * UnprojectedAtlasHeight );
    UnprojectedRightEyeAtlas.AddUninitialized( UnprojectedAtlasWidth * UnprojectedAtlasHeight );

	StartTime        = FDateTime::UtcNow();
	OverallStartTime = StartTime;
	bIsTicking       = true;

    StereoCaptureDoneDelegate = InStereoCaptureDoneDelegate;
}
Esempio n. 8
0
void DoStart (GPtr globals)
	{
	
	if (!WarnAdvanceStateAvailable ())
	{
		gResult = userCanceledErr; // exit gracefully
		goto done;
	}

	if (!WarnColorServicesAvailable())
	{
		gResult = userCanceledErr; // exit gracefully
		goto done;
	}
	
	ValidateParameters (globals);
	/* if stuff hasn't been initialized that we need, do it,
		then go check if we've got scripting commands to
		override our settings */
	gQueryForParameters = ReadScriptParams (globals); // update our parameters with the scripting parameters, if available

	if (gQueryForParameters)
	{
		gQueryForParameters = FALSE;
		if (!DoUI (globals))
			goto done; // canceled
	}

	if (gResult != noErr)
		goto done;

	done:
	
	// if one screws with the outData with a proxy, reset that here
		
	PISetRect (&gStuff->inRect, 0, 0, 0, 0);
	PISetRect (&gStuff->outRect, 0, 0, 0, 0);
	PISetRect (&gStuff->maskRect, 0, 0, 0, 0);

	}
Esempio n. 9
0
BOOL ROBOT_IssueCommand(ArmId Arm, ArmAction Action, ArmRotate Rotate)
{
     // Only accept a command if we aren't doing something already
     if(!Robot.Busy)
     {
          RobotCommand cmd;
          // Make sure the values make sense
          if(ValidateParameters(Arm, Action, Rotate))
          {
               // Save values
               cmd.Arm = Arm;
               cmd.Rotate = Rotate;
               switch(Action)
               {
                    case FACE_CW :
                         cmd.Action = CW;
                         GenerateSequenceFace(cmd);
                         break;
                    case FACE_CCW :
                         cmd.Action = CCW;
                         GenerateSequenceFace(cmd);
                         break;
                    case CUBE_CW :
                         cmd.Action = CW;
                         GenerateSequenceCube(cmd);
                         break;
                    case CUBE_CCW :
                         cmd.Action = CCW;
                         GenerateSequenceCube(cmd);
                         break;
               }

               // Set robot as busy
               Robot.Busy = TRUE;
               return TRUE;
          }
     }
     return FALSE;
}
Esempio n. 10
0
int
set_machine_sid_main(
    int argc,
    char* argv[]
    )
{
    DWORD dwError = 0;
    PSTR pszMachineSid = NULL;
    size_t dwErrorBufferSize = 0;
    BOOLEAN bPrintOrigError = TRUE;

    if (geteuid() != 0) {
        fprintf(stderr, "This program requires super-user privileges.\n");
        dwError = LW_ERROR_ACCESS_DENIED;
        BAIL_ON_LSA_ERROR(dwError);
    }

    dwError = ParseArgs(argc, argv,
                        &pszMachineSid);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = ValidateParameters(pszMachineSid);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = SetMachineSid(pszMachineSid);
    BAIL_ON_LSA_ERROR(dwError);

cleanup:
    if (pszMachineSid) {
        LW_SAFE_FREE_STRING(pszMachineSid);
    }

    return dwError;

error:

    dwError = MapErrorCode(dwError);

    dwErrorBufferSize = LwGetErrorString(dwError, NULL, 0);

    if (dwErrorBufferSize > 0)
    {
        DWORD dwError2 = 0;
        PSTR  pszErrorBuffer = NULL;

        dwError2 = LwAllocateMemory(
                     dwErrorBufferSize,
                     (PVOID*)&pszErrorBuffer);

        if (!dwError2)
        {
            DWORD dwLen = 0;

            dwLen = LwGetErrorString(dwError,
                                      pszErrorBuffer,
                                      dwErrorBufferSize);
            if ((dwLen == dwErrorBufferSize) &&
                !LW_IS_NULL_OR_EMPTY_STR(pszErrorBuffer))
            {
                fprintf(stderr,
                        "Failed to modify SID.  Error code %u (%s).\n%s\n",
                        dwError,
                        LW_PRINTF_STRING(LwWin32ExtErrorToName(dwError)),
                        pszErrorBuffer);
                bPrintOrigError = FALSE;
            }
        }

        LW_SAFE_FREE_STRING(pszErrorBuffer);
    }

    if (bPrintOrigError)
    {
        fprintf(stderr,
                "Failed to modify SID.  Error code %u (%s).\n",
                dwError,
                LW_PRINTF_STRING(LwWin32ExtErrorToName(dwError)));
    }

    goto cleanup;
}
Esempio n. 11
0
void _CLASS_GEN(Algorithm)::run(CContextDataStore *dataStore, std::function<void (CContextDataStore *)> callback){
    if(!IsBusy() && mSettings != nullptr && mLogger != nullptr && ValidateParameters(mSettings)){
        executeAlgorithm(dataStore);
        callback(dataStore);
    }
}
Esempio n. 12
0
void RunCommandLineSystem(int argc, char** argv){
	string algorithmToRun="";
	if(argc > ALGORITHM_NAME)
		algorithmToRun = argv[ALGORITHM_NAME];
	else {
		cerr<<"Error: System went into command line system with no content.\n Switching to menu system.\n";
		//return RunMenuSystem();
	}

	DilutionAlgorithms algorithm = GetDilutionAlgorithm(algorithmToRun);
	DagGen * dag = NULL;
	vector<string> parameters;


	for(int i = ALGORITHM_ARGS_START; i< argc; ++i)
		parameters.push_back(argv[i]);

	string errorMessage;
	if(!ValidateParameters(algorithm,parameters,errorMessage)){
		cerr<<"Arguments for " << algorithmToRun << " invalid\n"<< errorMessage<<endl;
		return;
	}

	if(!SILENCE_OUTPUT)
		cout<<"Validated Parameters"<<endl;

	switch(algorithm){
	case MINMIX: /* Concentration Values,  7 7 5 5 3 3 2*/
		if(!SILENCE_OUTPUT)
			cout<<"Running MINMIX"<<endl;
		dag = MinMix::RunMinMix(parameters);
		break;
	case REMIA:	/*numerator denominator,   131 256*/
		if(!SILENCE_OUTPUT)
			cout<<"Running Remia"<<endl;
		dag = Remia::RunRemia(parameters);
		break;
	case WARA: /*Single input and multi input,  27 59 223 256*/ //Broken needs to be re written.
		//cout<<"Running Wara"<<endl;
		//Wara::Run_Wara(dag,parameters);
		break;

	case GORMA: /*numerator denominator 121 256*/ //partially broken Needs branch and Bound
		if(!SILENCE_OUTPUT)
			cout<<"Running Gorma: This algorithm takes a while"<<endl;
		dag= new DagGen();
		Gorma::RunGorma(parameters,dag);
		break;
	case GDA:
		//char * a[] = {"blah", "0", "1", ".5", "5"};
		//GDA::RunGDA(5, a,dag);
		break;
	case CODOS: /* {"7","7", "5", "5", "3","3","2" };*/
		if(!SILENCE_OUTPUT)
			cout<<"Running CODOS"<<endl;
		dag = CoDOS::RunCoDOS(parameters);
		break;
	case NRT_ISI: /*45 23 67 93*/
		/*char * a[] = {"blah", "3", "6", "9" };*/
		if(!SILENCE_OUTPUT)
			cout<<"Running NRT_ISI"<<endl;
		dag = NRT_ISI::RunNRT_ISI(parameters);
		break;
	case IDMA://numops  tolerance desiredconcentratin /*10  .0078125 0.1015625*/
		dag = new DagGen();
		if(!SILENCE_OUTPUT)
			cout<< "Running IDMA"<<endl;
		IDMA::RunIDMA(parameters, dag);
		break;
	case ISINCKU:/* numerator differnceBetweenSamples n^2(denominator) numSample  {11 10 6 5 }*/
		dag = new DagGen();
		if(!SILENCE_OUTPUT)
			cout << "Running NCKU"<<endl;
		ISI_NCKU::RUN_NCKU(parameters, dag);
		break;
	case GRIFFITH: //numops  tolerance desiredconcentratin /*10  .0078125 0.1015625*/
		dag = new DagGen();
		if(!SILENCE_OUTPUT)
			cout<<"Running Griffith"<<endl;
		GriffDilute::RunGriffith(parameters, dag);
		break;
	case DMRW:  //numops  tolerance desiredconcentratin /*10  .0078125 0.1015625*/
		dag = new DagGen();
		if(!SILENCE_OUTPUT)
			cout<< "Running DMRW"<<endl;
		RoyDilute::RunDMRW(parameters,dag);
		break;
	case MTC:/*filename denominator numerators ... {test 16 10 12 13 14}*/
		if(!SILENCE_OUTPUT)
			cout<<"Runnig MTC"<<endl;
		parameters.insert(parameters.begin(),argv[FILE_NAME_POSITION]);
		dag = new DagGen();
		MTC::RunMTC(parameters, dag);
		break;

	case ALGORITHM_NOT_FOUND:
	default:
		cerr<<"ERROR: algorithm " << algorithmToRun << " not recognized." << endl;
		return;
	}
	if(!SILENCE_OUTPUT)
		cout<<"Success"<<endl;

	string output = argv[OUTPUT_TYPE_POSITION];
	string fileName = argv[FILE_NAME_POSITION];
	if(fileName == "CONSOLE")
		fileName = "";
	OutputDag(dag, output, fileName);

	delete dag;
}
Esempio n. 13
0
void DoPrepare (GPtr globals)
{
	ValidateParameters (globals);
}
Esempio n. 14
0
int main(int argc, char** argv) {

	unsigned int* __restrict address;
	unsigned int* __restrict memory;

	unsigned int i, j;
	unsigned int t=0;
	unsigned int numberOfMemoryLocation;

	dictionary *programInput;
	double startTime;
	double elapsedTime = 0, totalElapsedTime = 0;
	double initializationTime, experimentTime;

	programInput = ParseInput(argc, argv);
	ValidateParameters();

	// Initialize memory manager
	MMMasterInitialize(0, 0, FALSE, NULL);

	numberOfMemoryLocation = MemorySize / sizeof(int);

	// Allocate memory
	address = MMUnitAllocate((NumberOfAccess + 8) * sizeof(unsigned int));
	memory = MMUnitAllocate((numberOfMemoryLocation + 32) * sizeof(unsigned int));

	// Set random seed
	r250_init(getRandomSeed());

	// Set start time
	startTime = setStartTime();

	printf("Initialize memory pointers with random values..");


	for (i=0; i<numberOfMemoryLocation + 32; i++) {
		memory[i] = r250();
	}
	// Initialize address and memory
	for (i=0; i<NumberOfAccess + 8; i++) {
		address[i] = (r250() % numberOfMemoryLocation) / 4 * 4;
	}

	printf("finished.\n");

	elapsedTime = getElapsedTime(startTime) - totalElapsedTime;
	totalElapsedTime += elapsedTime;
	initializationTime = elapsedTime;

	// Test memory speed for read
	if (ReadWrite[0] == 'R' || ReadWrite[0] == 'r') {
		for (i=0; i<NumberOfIteration; i++) {
			for (j=0; j<NumberOfAccess; j++) {


				t += memory[address[j]];

			}
		}
	}
	// Test memory speed for write
	if (ReadWrite[0] == 'W' || ReadWrite[0] == 'w') {
		for (i=0; i<NumberOfIteration; i++) {
			for (j=0; j<NumberOfAccess; j++) {
				memory[address[j]] += address[j];
			}
		}
	}

	elapsedTime = getElapsedTime(startTime) - totalElapsedTime;
	totalElapsedTime += elapsedTime;
	experimentTime = elapsedTime;

	// So that compiler does not remove code for variables t and r
	if (t==0) {
		printf("\n");
	}

	printf("Experiment completed.\n");

	printf("Initialization time   = ");
	printElapsedTime(stdout, FALSE, FALSE, TRUE, 2, initializationTime);
	printf("Experiment time       = ");
	printElapsedTime(stdout, FALSE, FALSE, TRUE, 2, experimentTime);
	
	MMUnitFree(address, (NumberOfAccess + 8) * sizeof(unsigned int));
	MMUnitFree(memory, (numberOfMemoryLocation + 32) * sizeof(unsigned int));

	iniparser_freedict(programInput);

	return 0;

}