예제 #1
0
int main(int argc, char *argv[]){
    if (argc != 6) {
        system("cat nagato");
        printf("Error: not enough arguments\n");
        printf("Usage:\n\t %s [fileIn] [fileOut] [xExpand] [yExpand] [zExpand]\n", argv[0]);
        exit(-1);
        //errorCase(ERR_MISSING_ARGS);                                            //errorCase() automatically exits the program
    }
    // Read in the input glass, filename as given in main's argument
    printf("Reading: %s\n", argv[1]);
    tipsy* tipsyIn = readTipsyStd(argv[1]);
    printHeader(tipsyIn->head);
    printAttr(tipsyIn->attr);
    printf("=================================================\n");

    tipsyScaleExpand(tipsyIn,
                    (int)strtol(argv[3], NULL, 10),
                    (int)strtol(argv[4], NULL, 10),
                    (int)strtol(argv[5], NULL, 10));
    printf("Writing to: %s\n", argv[2]);
    writeTipsyStd(argv[2], tipsyIn);
    printHeader(tipsyIn->head);
    printAttr(tipsyIn->attr);

    // Cleanup
    tipsyDestroy(tipsyIn);
}
예제 #2
0
/* Starts an XML element */
static void XMLCALL startElement(void *userData, const char *name, const char **atts) {

    ap_filter_t* filter = (ap_filter_t*) userData;


    if (!strcmp(name,"class")) {
        //ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, filter->r,"Looking at %s with id of %s",name, find_id_attr(atts));

        if (osrfStringArrayContains(mparams, find_id_attr(atts))) {
            inChunk = 1;
	        //ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, filter->r,"Found desired class %s", find_id_attr(atts));
        }
    }

    if (all || inChunk || (name && (!strcmp(name,"IDL")))) {

	    idlChunkConfig* config = ap_get_module_config( 
		    	filter->r->per_dir_config, &idlchunk_module );
    	_fwrite(filter, "<%s", name );
	    printAttr( filter, atts );
    	if (!strncmp(config->contentType, MODIDLCHUNK_CONFIG_CONTENT_TYPE_DEFAULT, 9)) {
	    	_fwrite(filter, " />", name );
    	} else {
	    	_fwrite(filter, ">", name );
    	}
	    if(!strcmp(name, "script")) 
    		idlChunkInScript = 1;
    }
}
int main(){
    int i;

    // Read in the input glass
    char filename[100] = "glass.std";
    printf("Reading: %s\n", filename);
    tipsy* tipsyIn = readTipsyStd(filename);
    // Set attributes not set by readTipsy
    tipsyIn->attr->xmin = -0.5; tipsyIn->attr->xmax = 0.5;
    tipsyIn->attr->ymin = -0.5; tipsyIn->attr->ymax = 0.5;
    tipsyIn->attr->zmin = -0.5; tipsyIn->attr->zmax = 0.5;
    printf("Input ");
    printHeader(tipsyIn->head);
    printAttr(tipsyIn->attr);
    printf("=================================================\n");

    // Create 1/8x compressed glass
    printf("\nCreating 1/8x compressed glass:\n");
    tipsy* glass8f = tipsyClone(tipsyIn);
    tipsyScaleExpand(glass8f, 2, 2, 2);
    tipsyCenter(glass8f);
    printHeader(glass8f->head);
    printAttr(glass8f->attr);
    printf("=================================================\n");
    writeTipsyStd("glass8f.std", glass8f);

    // Tile the 1/8x compressed glass to 28x2x2
    printf("\nTiling Shocktube:\n");
    tipsy* rcrShock = tipsyClone(glass8f);
    tipsyTesselate(rcrShock, 14, 1, 1);           // creates 28x2x2
    printf("\nCentering:\n");
    tipsyCenter(rcrShock);
    printf("\nEditing Velocities:\n");
    for (i=0; i<rcrShock->head->nsph; i++){
        if (rcrShock->gas[i].pos[AXIS_X] < 0.0)
            rcrShock->gas[i].vel[AXIS_X] = -1;
        else if (rcrShock->gas[i].pos[AXIS_X] > 0.0)
            rcrShock->gas[i].vel[AXIS_X] = 1;
    }
    printHeader(rcrShock->head);
    printAttr(rcrShock->attr);

    writeTipsyStd("RCRShock1.std", rcrShock);

    // Cleanup
    tipsyDestroy(tipsyIn); tipsyDestroy(glass8f); tipsyDestroy(rcrShock);
}
예제 #4
0
void printMeme(meme* m) {
	int i;
	printf("<=== MEME ===>\n");
	printf("NAME: %s\n", m->name);
	printf("NUM_ATTR: %d\n", m->num_attr);
	printf("ATTRIBUTES:\n");
	for(i = 0; i < m->num_attr; i++) {
		printAttr(m->attr[i]);
	}
	printf("<============>\n");
}
예제 #5
0
int attributesMain(int argc, char *argv[]) {

    /* Attributes are set per thread. All objects created in a thread will be
     * created with the configured attributes specific to that thread. */

    /* Create a low-footprint object with no attributes */
    corto_attr prev = corto_setAttr(0);
    corto_int32 *i = corto_create(corto_int32_o);
    corto_setAttr(prev);

    /* Display attributes of the int32 object */
    printAttr(i);

    return 0;
}
예제 #6
0
/* Starts an XML element */
static void XMLCALL startElement(void *userData, const char *name, const char **atts) {
	ap_filter_t* filter = (ap_filter_t*) userData;
	xmlEntConfig* config = ap_get_module_config( 
			filter->r->per_dir_config, &xmlent_module );
	_fwrite(filter, "<%s", name );
	printAttr( filter, atts );
	if (!strncmp(config->contentType, MODXMLENT_CONFIG_CONTENT_TYPE_DEFAULT, 9)
		&& isEmptyElement(name)) {
		_fwrite(filter, " />", name );
	} else {
		_fwrite(filter, ">", name );
	}
	if(!strcmp(name, "script")) 
		xmlEntInScript = 1;
}
예제 #7
0
int main(int argc, char *argv[]){
    if (argc != 2) {
        system("cat nagato");
        printf("Error: not enough arguments\n");
        printf("Usage:\n\t %s [fileIn]", argv[0]);
        exit(-1);
        //errorCase(ERR_MISSING_ARGS);                                            //errorCase() automatically exits the program
    }
    // Read in the input glass, filename as given in main's argument
    printf("Reading: %s\n", argv[1]);
    tipsy* tipsyIn = readTipsyStd(argv[1]);
    printf("Input ");
    printHeader(tipsyIn->head);
    printAttr(tipsyIn->attr);
    printf("=================================================\n");


    //...


    // Cleanup
    tipsyDestroy(tipsyIn);
}
예제 #8
0
int main()
{
    Catalog CatalogManager;

    table_t table;
    table.name = "Persons";
    table.attrNum = 3;
    table.recordLength = 68;
    table.attributes[0].name = "姓名";
    table.attributes[0].isPrimary = false;
    table.attributes[0].length = 32;
    table.attributes[0].type = CHAR;
    table.attributes[1].name = "性别";
    table.attributes[1].isPrimary = false;
    table.attributes[1].length = 32;
    table.attributes[1].type = CHAR;
    table.attributes[2].name = "学号";
    table.attributes[2].isPrimary = true;
    table.attributes[2].length = 8;
    table.attributes[2].type = INT;

    // 建表
    cout << "---建表:" << endl;
    CatalogManager.createTable(table);
    cout << endl;

    // 返回主键
    cout << "---返回主键:" << endl;
    attr_t attrTmp = CatalogManager.getPrimaryAttr("Persons");
    printAttr(attrTmp);
    cout << endl;

    // 返回表
    cout << "---返回表:" << endl;
    table_t tableTmp = CatalogManager.findTable("Persons");
    cout << tableTmp.name << " " << tableTmp.attrNum << " " << tableTmp.recordLength << endl;
    for (int i = 0; i < tableTmp.attrNum; i++)
    {
        printAttr(tableTmp.attributes[i]);
    }
    cout << endl;

    // 返回字段
    cout << "---返回字段:" << endl;
    attr_t attrTmp2 = CatalogManager.findAttr("Persons", "姓名");
    printAttr(attrTmp2);
    cout << endl;

    // 表存在
    cout << "---表存在:" << endl;
    cout << CatalogManager.tableExist("Persons") << endl;
    cout << CatalogManager.tableExist("a") << endl;
    cout << endl;

    // 建表
    cout << "---建表:" << endl;
    table.name = "Students";
    CatalogManager.createTable(table);
    cout << endl;

    // 表存在
    cout << "---表存在:" << endl;
    cout << CatalogManager.tableExist("Persons") << endl;
    cout << CatalogManager.tableExist("Students") << endl;
    cout << endl;

    // 字段存在
    cout << "---字段存在:" << endl;
    cout << "我想找 Students 中的 '学号' 字段" << endl;
    cout << CatalogManager.attrExist("Students", "学号") << endl;
    cout << "我想找 Students 中的 '什么鸟啊' 字段" << endl;
    cout << CatalogManager.attrExist("Students", "什么鸟啊") << endl;
    cout << endl;

    // 删表
    cout << "---删表:" << endl;
    CatalogManager.deleteTable(table);
    cout << endl;

    // 表存在
    cout << "---表存在:" << endl;
    cout << CatalogManager.tableExist("Persons") << endl;
    cout << CatalogManager.tableExist("Students") << endl;
    cout << endl;

    return 0;
}