Example #1
0
Core::GeneratedFiles Html5App::generateFiles(QString *errorMessage) const
{
    Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
    if (m_mainHtmlMode == ModeGenerate) {
        files.append(file(generateFile(Html5AppGeneratedFileInfo::MainHtmlFile, errorMessage), path(MainHtml)));
        files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
    }

    files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
    files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
    files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)));

    return files;
}
Example #2
0
Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const
{
    Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
    if (!useExistingMainQml()) {
        files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml)));
        if ((componentSet() == QtQuickApp::Meego10Components))
            files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainPageQmlFile, errorMessage), path(MainPageQml)));
        files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
    }

    files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
    files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
    files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)));

    return files;
}
Example #3
0
void generate( options *o)
{
  FILE  *fileHandle   = fopen( o->file, "r" );
  char  line[ 256 ];

  if( !fileHandle )
  {
    perror( "Error opening the source file" );
  }
  else
  {
    assert( fileHandle ); 
    
    while( fgets( line, 256, fileHandle ) )
    {
      count( line );
    }

    rewind( fileHandle );

    OBJModel.vertices     = calloc( OBJModel.numOfObjVertex , sizeof( vertex ) );
    assert( OBJModel.vertices );

    if( OBJModel.numOfObjNormal > 0 )
    {
      OBJModel.normals      = calloc( OBJModel.numOfObjNormal , sizeof( normal ) );
      assert( OBJModel.normals );
    }

    if( OBJModel.numOfObjNormal > 0 )
    {
      OBJModel.textures     = calloc( OBJModel.numOfObjTex , sizeof( texture ) );
      assert( OBJModel.textures );
    }
    
    OBJModel.faces        = calloc( OBJModel.numOfObjFaces , sizeof( face ) );
    OBJModel.indexLength  = OBJModel.numOfObjFaces * 3;
    OBJModel.indices      = calloc( OBJModel.indexLength, sizeof( Index ) );

    assert( OBJModel.faces );
    assert( OBJModel.indices );

    while( fgets( line, 256, fileHandle ) )
    {
      processLine( line );
    } 

    generateFile( o->outputFile );
    
    if( o->verbose )
    { 
      printf( "Total Vertices: %i\n", OBJModel.numOfObjVertex );
      printf( "Total Normals: %i\n", OBJModel.numOfObjNormal );
      printf( "Total Textures: %i\n", OBJModel.numOfObjTex );
      printf( "Total Index: %i\n", OBJModel.indexCount );
    }

    fclose( fileHandle );
  }
}
int _tmain(int argc, LPTSTR argv[]) {

	int a[] = {5, 23, 45, 67, 9, 23 };
	int b[] = {12, 90, 65, 34, 24, 12, 0, 89, 29, 54, 12, 78, 3};
	int c[] = {3, 9, 5, 1};

	FILE *fA, *fB, *fC;

	fA = fopen("file1.txt", "w+");
	fB = fopen("file2.txt", "w+");
	fC = fopen("file3.txt", "w+");

	generateFile(a, 6, fA);
	generateFile(b, 13, fB);
	generateFile(c, 4, fC);

	return 0;
}
Example #5
0
/*
 * The main routine. Read the command line arguments, read the text file,
 * remove the spaces, do the comparison and report the final results
 */
int main(int argc, char **argv)
{
    char *fileName = "space.txt";
    int arg = 1;
    UBool verbose = FALSE;
    UBool generate = FALSE;

    if (argc >= 2 && strcmp(argv[1], "-generate") == 0) {
        generate = TRUE;
        arg += 1;
    }

    if (argc >= 2 && strcmp(argv[1], "-verbose") == 0) {
        verbose = TRUE;
        arg += 1;
    }

    if (arg == argc - 1) {
        fileName = argv[arg++];
    }

    if (arg != argc) {
        fprintf(stderr, "Usage: %s [-verbose] [<file>]\n", argv[0]);
        return 1;
    }

    int32_t spaceCount, nonSpaceCount;
    const UChar *spaces, *noSpaces;

    spaces = ThaiWordbreakTest::readFile(fileName, spaceCount);

    if (spaces == 0) {
        return 1;
    }
    
    if (generate) {
        return generateFile(spaces, spaceCount);
    }

    noSpaces = ThaiWordbreakTest::crunchSpaces(spaces, spaceCount, nonSpaceCount);

    if (noSpaces == 0) {
        return 1;
    }

    ThaiWordbreakTest test(spaces, spaceCount, noSpaces, nonSpaceCount, verbose);

    printf("word count: %d\n", test.getWordCount());
    printf("breaks not found: %d\n", test.getBreaksNotFound());
    printf("invalid breaks found: %d\n", test.getInvalidBreaks());

    return 0;
}
int main (int argc, char *argv[]) {

	unsigned int z;
   unsigned char nombreFichTiempos[100];

	int iterations = 1;
	unsigned int numFiles =1;
	
	unsigned int i;

	/* Read parameters */
	if (argc < 5) {
		printf("\nUsage: %s <AllPatternsFile> <outPrefix> <MaxIters> <numPatterns1> [<numPatterns2>] [<numPatterns3>] ... \n\n", *argv);
		exit(0);
	}

	
	{/* PREPARES the tmp directory and deletes previous tmp files */	 
	struct stat buf;	
	if (stat ("tmp", &buf )) 
		{fprintf(stderr,"\n...Creating directory ./tmp");
		 int err= system("mkdir tmp");
		}
	}


	srand( time(NULL) );

	iterations = atoi(argv[3]);
	numFiles = argc-4;  //starting from argv[3] to argv[3+numPatterns -1]

	fprintf(stderr, "fichero con patrones: [%s],  maxIters: [%d]\n", argv[1], iterations);
	fprintf(stderr, " numFiles [%d]\n", numFiles);

	CargaVocabulario(argv[1]);
	
	//Each file contains #iterations with #numPatts patterns each.
	for (i=0;i<numFiles;i++){
		int numPatts;
		numPatts = atoi(argv[4+i]);
		fprintf(stderr,"\n NUMPATTS %ld",(long)numPatts);
		generateFile(iterations, numPatts ,argv[2]);
	}


	//frees memory
	fprintf(stderr,"\n FREEING MEMORY ...\n");
	for (i=0; i<numPalabras; i++) {
		free(lista[i].palabra);
	}
	free(lista);	

}
Example #7
0
int wmain(int argc, wchar_t** argv)
{
  if (argc != 3) {
    wprintf(L"usage: %ws <filename> <number pcm samples>\n", argv[0]);
    return -1;
  }
  wprintf(L"open file %ws\n", argv[1]);
  int n = _wtoi(argv[2]);
  wprintf(L"synthesize %d samples long mp3 file\n",n);
  generateFile(argv[1], n);
  return 0;
}
Example #8
0
ConfigFile::ConfigFile(std::string path)
{
    this->path = path;

    std::cout << "Loading file at " << path << std::endl;

    root = loadJSONFile(path.c_str());

    if(root.empty())
    {
        //Invalid file
        generateFile();
    }
    else
    {
        //File is valid
        loadConfig();
    }
}
Example #9
0
//convert the assembly language program in "asmFile" into a C language program
void asm2C( void )
{
//get one function at a time and translate it to C
	int i;
	vector< BlockTab * > allFunctions;
 	do {
		BlockTab *curBlockTab = new BlockTab;
		LabelTab curLabelTab;
		if ( ( i = yyparse( curLabelTab, *curBlockTab ) ) == true ) {
			if ( VERBOSE )
				verbose( "\tLinking blocks" );
			curBlockTab -> linkBlocks( curLabelTab );
			if ( VERBOSE )
				verbose( "\tFinished linking blocks" );
			if ( VERBOSE )
				verbose( "\tStarting Control Flow Analysis" );
			curBlockTab -> reduce( );
			if ( VERBOSE )
				verbose( "\tFinished Control flow Analysis\n" );
			allFunctions.push_back( curBlockTab );
		}
	} while ( i );

	if ( VERBOSE ) {
		verbose( "\nFinished Decompiling\n" );
		verbose( "No of \"if..else\" stms found   : " + itoa( noIfElses ) );
		verbose( "No of \"if\" stmts found        : " + itoa( noIfs ) );
		verbose( "No of \"while\" loops found     : " + itoa( noWhiles ) );
		verbose( "No of \"do-while\" loops found  : " + itoa( noDoWhiles ));
		verbose( "No of \"endless\" loops found   : " + itoa( noEndless ) );
	}
	cout << "#include<ourHeader.h>\n\n";

/* generate the declarations for global variables */
	generateDecls( curSymTab );

/* generate the prototypes for the functions defined in the program */
	generateProts( curFuncTab );

/* generate the C file */
	generateFile( allFunctions );
}
int main(int argc, char* argv[]) {
	int m		=	atoi(argv[1]);
	int option	=	atoi(argv[2]);
	int k		=	(2*m-1);
	int N		=	k*k;
	int x[2*N], y[2*N];
	int count	=	0;
	int count1;
	x[0]	=	0;
	y[0]	=	0;
	count	=	1;
	count1	=	0;
	for (int j=0; j<m; ++j) {
		for (int k1=0; k1<2*j; ++k1) {
			x[count]=	x[count1]+1;
			y[count]=	y[count1]+k1;
			++count;
		}
		count1		=	count-1;
		for (int k2=0; k2<2*j; ++k2) {
			x[count]=	x[count1]-k2-1;
			y[count]=	y[count1];
			++count;
		}
		count1		=	count-1;
		for (int k3=0; k3<2*j; ++k3) {
			x[count]=	x[count1];
			y[count]=	y[count1]-k3-1;
			++count;
		}
		count1		=	count-1;
		for (int k4=0; k4<2*j; ++k4) {
			x[count]=	x[count1]+k4+1;
			y[count]=	y[count1];
			++count;
		}
		count1		=	count-1;
	}

	generateFile(N, x, y, option);
}
Example #11
0
void ConfigFile::loadConfig()
{
    loadVersion();

    //Loads data depending on the file's version
    if (conf_file_ver >= 1)
    {
        loadProjects();
    }
    else
    {
        //File may be invalid
        generateFile();
    }

    //Updates the file
    if (conf_file_ver < CONFIG_FILE_VER)
    {
        updateFile();
    }
}
ConcatString::ConcatString(QWidget * parent) : QWidget(parent)
{
    groupBoxInfo = new QGroupBox(tr("Saisi information"), this);
    cbb          = new QComboBox;
    cbb->addItem(tr("Min"));
    cbb->addItem(tr("Hour"));
    cbb->addItem(tr("Day"));
    cbb->addItem(tr("Mouth"));
    cbb->setFixedWidth(80);
    cbb->setCurrentIndex(1);

    dateDebut       = new QDateTimeEdit(QDate::currentDate());
    dateDebut->setDisplayFormat("dd/MM/yyyy HH:mm");
    dateDebut->setMaximumWidth(200);
    
    dateFin         = new QDateTimeEdit(QDate::currentDate().addDays(1));
    dateFin->setDisplayFormat("dd/MM/yyyy HH:mm");
    dateFin->setMaximumWidth(200);

    periode         = new QSpinBox;
    periode->setMinimum(1);
    timeZone        = new QSpinBox;
    timeZone->setMaximum(18);
    timeZone->setMinimum(-18);
    longitude       = new QLineEdit;
    altitude        = new QLineEdit;
    check           = new QCheckBox(tr("Sunsets sun values"));
    genAzimuthzenit = new QPushButton(tr("Zenit Azimuth generate"));
    genAzimuthzenit->setEnabled(false);

    QHBoxLayout * topLeftLayout = new QHBoxLayout;
    topLeftLayout->addWidget(new QLabel(tr("Date begin")));
    topLeftLayout->addWidget(dateDebut);
    topLeftLayout->addWidget(new QLabel(tr("Date end")));
    topLeftLayout->addWidget(dateFin);

    QHBoxLayout * topLeftLayout1  = new QHBoxLayout;
    topLeftLayout1->addWidget(new QLabel(tr("Periode")));
    topLeftLayout1->addWidget(periode);
    topLeftLayout1->addWidget(cbb);
    topLeftLayout1->addWidget(new QLabel);
    topLeftLayout1->addWidget(new QLabel(tr("Time zone")));
    topLeftLayout1->addWidget(timeZone);

    QHBoxLayout *topLeftLayout2 = new QHBoxLayout;
    topLeftLayout2->addWidget(new QLabel(tr("Longitude")));
    topLeftLayout2->addWidget(longitude);
    topLeftLayout2->addWidget(new QLabel(tr("Latitude")));
    topLeftLayout2->addWidget(altitude);    

    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addLayout(topLeftLayout);
    leftLayout->addLayout(topLeftLayout1);
    leftLayout->addLayout(topLeftLayout2);
    leftLayout->addWidget(check);
    leftLayout->addWidget(genAzimuthzenit);
   
    groupBoxInfo->setLayout(leftLayout);

    connect(genAzimuthzenit, SIGNAL(clicked()), this, SLOT(generateFile()));
    connect(longitude,       SIGNAL(textEdited(QString)), this, SLOT(longitudeEdit(QString)));
    connect(altitude,        SIGNAL(textEdited(QString)), this, SLOT(altitudeEdit(QString)));
}
Example #13
0
void CompilGenerator::generateObject(const ObjectSPtr& pObject)
{
    switch (pObject->runtimeObjectId().value())
    {
        case EObjectId::kImport:
        {
            ImportSPtr pImport = boost::static_pointer_cast<Import>(pObject); 
            generateImport(pImport);
            break;
        }        
        case EObjectId::kEnumeration:
        {
            EnumerationSPtr pEnumeration = boost::static_pointer_cast<Enumeration>(pObject); 
            generateEnumerationPrefix(pEnumeration);
            
            const std::vector<EnumerationValueSPtr>& enumerationValues = pEnumeration->enumerationValues();
            std::vector<EnumerationValueSPtr>::const_iterator it;
            for (it = enumerationValues.begin(); it != enumerationValues.end(); ++it)
            {
                generateEnumerationValuePrefix(*it);
                generateEnumerationValueSuffix(*it);
            }
            generateEnumerationSuffix(pEnumeration);
            break;
        }
        case EObjectId::kSpecimen:
        {
            SpecimenSPtr pSpecimen = boost::static_pointer_cast<Specimen>(pObject);
            generateSpecimenPrefix(pSpecimen);
            generateSpecimenSuffix(pSpecimen);
            break;
        }
        case EObjectId::kFactory:
        {
            FactorySPtr pFactory = boost::static_pointer_cast<Factory>(pObject);
            generateFactoryPrefix(pFactory);
            generateFactorySuffix(pFactory);
            break;
        }
        case EObjectId::kFile:
        {
            FileSPtr file = boost::static_pointer_cast<File>(pObject);
            generateFile(file);
            break;
        }
        case EObjectId::kStructure:
        {
            StructureSPtr pStructure = boost::static_pointer_cast<Structure>(pObject); 
            generateStructurePrefix(pStructure);
            generateObjects(pStructure->objects());
            generateStructureSuffix(pStructure);
            break;
        }
        
        case EObjectId::kAlter:
            break;
        
        case EObjectId::kField:
        {
            FieldSPtr pField = boost::static_pointer_cast<Field>(pObject); 
            generateFieldPrefix(pField);
            generateFieldSuffix(pField);
            break;
        }
        case EObjectId::kIdentification:
        {
            IdentificationSPtr pIdentification = boost::static_pointer_cast<Identification>(pObject); 
            generateIdentificationPrefix(pIdentification);
            generateIdentificationSuffix(pIdentification);
            break;
        }        
            
        case EObjectId::kInterface:
        {
            InterfaceSPtr pInterface = boost::static_pointer_cast<Interface>(pObject); 
            generateInterfacePrefix(pInterface);
            generateObjects(pInterface->objects());
            generateInterfaceSuffix(pInterface);
            break;
        }
            
        case EObjectId::kMethod:
        {
            MethodSPtr pMethod = boost::static_pointer_cast<Method>(pObject); 
            generateMethodPrefix(pMethod);
            generateObjects(pMethod->objects());
            generateMethodSuffix(pMethod);
            break;
        }
            
        case EObjectId::kParameter:
        {
            ParameterSPtr pParameter = boost::static_pointer_cast<Parameter>(pObject); 
            generateParameterPrefix(pParameter);
            generateParameterSuffix(pParameter);
            break;
        }

        default:
            assert(false);
    }
}
Example #14
0
int main(int argc, char *argv[])
{
	int cnt;
	const char *fileName;
        int startadr;
        int endadr;
        FILE *outputFile;


        // default/initial options
        fileName = NULL;
        startadr = -1;
        endadr = -1;

	for(cnt=1; cnt<argc; cnt++)
	{
		if( !strcmp(argv[cnt],"-o") )
		{
			if(++cnt>=argc)
			{
				fprintf( stderr, "No Arg for '-o'!\n");
				exit(1);
			}
			fileName=argv[cnt];

		} else if( !strcmp(argv[cnt],"-s") )
		{
			if(++cnt>=argc)
			{
				fprintf( stderr, "No Arg for '-s'!\n");
				exit(1);
			}
			if ( sscanf(argv[cnt],"%i",&startadr)!=1 )
			{
				fprintf( stderr, "Funny Arg for '-s'\n");
				exit(1);
			}
                        if( startadr<0 || startadr>=0x010000 )
                        {
				fprintf( stderr, "Startaddress must be >=0x0000 and <=0xffff ! Startaddress is: 0x%04x\n", startadr);
				exit(1);
                        }
		} else if( !strcmp(argv[cnt],"-e") )
		{
			if(++cnt>=argc)
			{
				fprintf( stderr, "No Arg for '-e'!\n");
				exit(1);
			}
			if ( sscanf(argv[cnt],"%i",&endadr)!=1 )
			{
				fprintf( stderr, "Funny Arg for '-e'\n");
				exit(1);
			}
                        if( endadr<0 || endadr>=0x010000 )
                        {
				fprintf( stderr, "Endaddress must be >=0x0000 and <=0xffff ! Endaddress is: 0x%04x\n", endadr);
				exit(1);
                        }
		} else if( !strcmp(argv[cnt],"--help") )
                {
			showHelp();
                        exit(0);
                } else
                {
			showHelp();
                        exit(1);
                }
	}

        if( startadr==-1 )
        {
		fprintf( stderr, "No startaddress provided!\n");
                exit(1);
        }
        if( endadr==-1 )
        {
		fprintf( stderr, "No endaddress provided!\n");
                exit(1);
        }
	if( startadr>=endadr )
	{
		fprintf( stderr, "Startaddress must be smaller than endaddress! Startaddress is: 0x%04x. Endaddress is: 0x%04x\n", startadr, endadr);
		exit(1);
	}

	if( fileName==NULL )
        {
                outputFile = stdout;
        } else if( (outputFile=fopen(fileName,"wb"))==NULL )
        {
		fprintf( stderr, "Error opening output file \"%s\"!\n", fileName);
                exit(1);
        }

	generateFile(outputFile, startadr, endadr);

        if( fileName!=NULL )
        {
		fclose( outputFile );
        }
	exit(0);
}