bool FileExporterPDF::generatePDF( QIODevice* iodevice, QStringList *errorLog ) { QStringList cmdLines = QStringList::split( '|', "pdflatex -halt-on-error bibtex-to-pdf.tex|bibtex bibtex-to-pdf|pdflatex -halt-on-error bibtex-to-pdf.tex|pdflatex -halt-on-error bibtex-to-pdf.tex" ); if ( writeLatexFile( laTeXFilename ) && runProcesses( cmdLines, errorLog ) && writeFileToIODevice( outputFilename, iodevice ) ) return TRUE; else return FALSE; }
void ProcessManager::restartAll() { haltConstructionProcs(); if(runBuild()) { runProcesses(); haltProgram(); startProgram(); } }
void test_process_schedular(){ pQueue* pqueue = create(); pQueue* result; insert(pqueue,"browser",1,10,0); insert(pqueue,"gcc",3,20,0); result = runProcesses(pqueue); ASSERT(result->head->attempts == 1); ASSERT(result->head->next->attempts == 2); free(pqueue); free(result); };
int main(char **argv, char argc) { int *allocationArray, *workArray, *maxArray, *requestedResources, *needArray, *waitingQueue, *maxAvailableResources, *releaseResources; int numProc; int numRes; int onProc; int i; int startTime; int simTime; int totalBytesToAllocate; int numSecs; char resourceTypes[256]; char numInstances[256]; char numProcesses[256]; char detailsOfPx[256]; /* Set up the signal handler to handle CTRL C requests */ (void) signal(SIGINT, signalHandler); /* Clear out the arrays before using them */ memset((char*)&resourceTypes, 0, sizeof(resourceTypes)); memset((char*)&numInstances, 0, sizeof(numInstances)); memset((char*)&numProcesses, 0, sizeof(numProcesses)); memset((char*)&detailsOfPx, 0, sizeof(detailsOfPx)); /* Gather input from user -- assuming correct input only */ printf("Number of different resource types: "); scanf(" %[^\n]", resourceTypes); numRes = atoi(resourceTypes); numProc = atoi(resourceTypes); printf("Number of instances of each resource type :"); scanf(" %[^\n]", numInstances); printf("Number of processes: "); scanf(" %[^\n]", numProcesses); numProc = atoi(numProcesses); totalBytesToAllocate = numProc*numRes*sizeof(int); /* Allocate memory for a number of different arrays that are used in this program */ allocationArray = malloc(totalBytesToAllocate); workArray = malloc(numRes * sizeof(int)); maxArray = malloc(totalBytesToAllocate); needArray = malloc(totalBytesToAllocate); waitingQueue = malloc(numProc * sizeof(int)); requestedResources = malloc(totalBytesToAllocate); maxAvailableResources = malloc(numRes * sizeof(int)); releaseResources = malloc(numRes * sizeof(int)); /* Clear out all of the useful arrays before using them */ memset((int*)allocationArray, 0,totalBytesToAllocate); memset((int*)workArray, 0, numRes * sizeof(int)); memset((int*)releaseResources, 0, numRes * sizeof(int)); memset((int*)maxAvailableResources, 0, numRes * sizeof(int)); memset((int*)maxArray, 0, totalBytesToAllocate); memset((int*)waitingQueue, 0, numProc * sizeof(int)); memset((int*)requestedResources, 0, totalBytesToAllocate); /* Store the data from the max array */ storeTheData(numInstances, workArray, 0); for (i = 0; i < numProc; i++) { onProc = i * numRes; printf("Details of P%d: ",i+1); scanf(" %[^\n]", detailsOfPx); storeTheData(detailsOfPx, maxArray, onProc); } computeMaxAvailableResources(maxAvailableResources, allocationArray, workArray, numProc, numRes); /* The need array is simply a copy of the max array in the beginning since we started with zero resources allocated */ memcpy(needArray,maxArray, numProc*numRes * sizeof(int) ); startTime = getTimeInSeconds(); simTime = startTime; numSecs = 4; printf("Hello. Please read the README if you can. Thank you. :) \n"); while (1) { /* Every five seconds, we make an action for each process -- but it is 4 the first time */ if (getTimeInSeconds() - simTime >= numSecs) { simTime = getTimeInSeconds(); /* Run all of the processes in a loop whereby each chooses one possible action */ runProcesses(allocationArray, workArray, maxArray,\ requestedResources, needArray, waitingQueue, maxAvailableResources, releaseResources, numProc, numRes); } numSecs = 5; } return 0; }
bool FileExporterPDF::generatePDF(QIODevice *iodevice, QStringList *errorLog) { QStringList cmdLines = QStringList() << QStringLiteral("pdflatex -halt-on-error ") + m_fileStem + KBibTeX::extensionTeX << QStringLiteral("bibtex ") + m_fileStem + KBibTeX::extensionAux << QStringLiteral("pdflatex -halt-on-error ") + m_fileStem + KBibTeX::extensionTeX << QStringLiteral("pdflatex -halt-on-error ") + m_fileStem + KBibTeX::extensionTeX; return writeLatexFile(m_fileStem + KBibTeX::extensionTeX) && runProcesses(cmdLines, errorLog) && writeFileToIODevice(m_fileStem + KBibTeX::extensionPDF, iodevice, errorLog); }