Extent::Ptr RowAnalysisModule::getSharedExtent() { Extent::Ptr e = source.getSharedExtent(); if (e == NULL) { completeProcessing(); return e; } if (!prepared) { firstExtent(*e); } newExtentHook(*e); series.setExtent(e); if (!prepared) { prepareForProcessing(); prepared = true; if (!where_expr_str.empty()) { where_expr = DSExpr::make(series, where_expr_str); } } for (;series.morerecords();++series) { if (!where_expr || where_expr->valBool()) { ++processed_rows; processRow(); } else { ++ignored_rows; } } series.clearExtent(); return e; }
void parse( ObjFilePtr* file, const char* filename ) { // expect the worst *file = NULL; char fullname[MAX_STRING_LENGTH]; /* if a path was given include it in the full file name */ if (path == NULL) { strcpy(fullname, filename); } else { fullname[0] = '\0'; strcat(fullname, path); int len = strlen(fullname); if (fullname[len - 1] != '/') { fullname[len] = '/'; fullname[len + 1] = '\0'; } strcat(fullname, filename); } // open the .obj file FILE* f; f = fopen(fullname, "r"); if (NULL == f) { return; } // create the ObjFile object. ObjFile* objFile = createObjFile(filename); if (NULL == objFile) { return; } // get neccessary information about the file // until the end of the file, read the file in line by line char line[MAX_STRING_LENGTH]; while (NULL != fgets(line, MAX_STRING_LENGTH, f)) { updateFileInfo(objFile, line); } // alloc memory for positions, normals, texcoords, groups, faces and objects // TODO: check if all allocations // succeed objFile->positions = (ObjVector3F*)malloc( sizeof(ObjVector3F)*(objFile->numPositions + 1) ); objFile->normals = (ObjVector3F*)malloc( sizeof(ObjVector3F)*(objFile->numNormals + 1) ); objFile->texCoords = (ObjVector2F*)malloc( sizeof(ObjVector2F)*(objFile->numTexCoords + 1) ); if (objFile->numFaces) { objFile->faces = (ObjFace*)malloc(sizeof(ObjFace)*objFile->numFaces); } objFile->objects = (ObjObject*)malloc( sizeof(ObjObject)*(objFile->numObjects + 1) ); objFile->groups = (ObjGroup*)malloc( sizeof(ObjGroup)*(objFile->numObjects + 1 + objFile->numGroups) ); // once again iterate through the file and copy the data rewind(f); prepareForProcessing(objFile); while (NULL != fgets(line, MAX_STRING_LENGTH, f)) { updateFile(objFile, line); } // clean up fclose(f); // return result *file = objFile; }