static errcode GetFog(parsehandle * ph, SceneHandle scene) { char tmp[255]; apicolor fogcol; float start, end, density; errcode rc = PARSENOERR; fscanf(ph->ifp, "%s", tmp); if (!stringcmp(tmp, "LINEAR")) { rt_fog_mode(scene, RT_FOG_LINEAR); } else if (!stringcmp(tmp, "EXP")) { rt_fog_mode(scene, RT_FOG_EXP); } else if (!stringcmp(tmp, "EXP2")) { rt_fog_mode(scene, RT_FOG_EXP2); } else if (!stringcmp(tmp, "OFF")) { rt_fog_mode(scene, RT_FOG_NONE); } rc |= GetString(ph, "START"); fscanf(ph->ifp, "%f", &start); rc |= GetString(ph, "END"); fscanf(ph->ifp, "%f", &end); rc |= GetString(ph, "DENSITY"); fscanf(ph->ifp, "%f", &density); rc |= GetColor(ph, &fogcol); rt_fog_parms(scene, fogcol, start, end, density); return PARSENOERR; }
/* =============================================================================== 函数 从目录中找一个Entry 入口: 出口:SUCC,FAIL =============================================================================== */ static u8 FindEntryStruct(u8 *floder_name,u8 *file_extension) { u8 EntryName[256],Extension[4]; u8 Name_Compare_OK,Extension_Compare_OK; do{ if(GetEntryFromDirectory(EntryName,Extension,Get_Selected_ENTRIES) != SUCC) { return(FAIL); } Name_Compare_OK = OK; if(stringcmp(EntryName,floder_name) != SUCC) Name_Compare_OK = unOK; if(Name_Compare_OK == OK) //检查文件扩展名 { if(CORE.FullPathType == FilePath && CORE.CurPathType == FilePath) { Extension_Compare_OK = OK; if(stringcmp(Extension,file_extension) != SUCC) Extension_Compare_OK = unOK; else break; } else { if(Extension[0] == 0) break; } } }while(1); return(SUCC); }
struct transaction * sortedArraysCommonElements(struct transaction *A, int ALen, struct transaction *B, int BLen) { int count = 0, x = 0; if (ALen < 0 || BLen < 0 || A == NULL || B == NULL)/* for invalid inputs*/ return NULL; for (int i = 0; i < ALen; i++) { for (int j = 0; j < BLen; j++) { count = 0; if (stringcmp(A[i].date, B[j].date, 6, 9)) count++; if (stringcmp(A[i].date, B[j].date, 3, 4)) count++; if (stringcmp(A[i].date, B[j].date, 0, 1)) count++; if (count == 3) { common[x++] = A[i];/*intializing the transaction into the array of structure common*/ } } } if (x == 0) return NULL; return common;/*returnig the result*/ }
static errcode GetSpotLight(parsehandle * ph, SceneHandle scene) { char tmp[255]; apiflt rad, Kc, Kl, Kq; apivector ctr; apitexture tex; apivector direction; apiflt start, end; float r, g, b, a; errcode rc; void * li; memset(&tex, 0, sizeof(apitexture)); rc = GetString(ph, "CENTER"); rc |= GetVector(ph, &ctr); rc |= GetString(ph,"RAD"); fscanf(ph->ifp, "%f", &a); /* read in radius */ rad=a; rc |= GetString(ph, "DIRECTION"); rc |= GetVector(ph, &direction); rc |= GetString(ph, "FALLOFF_START"); fscanf(ph->ifp, "%f",&a); start=a; rc |= GetString(ph, "FALLOFF_END"); fscanf(ph->ifp, "%f", &a); end=a; fscanf(ph->ifp, "%s", tmp); if (!stringcmp(tmp, "COLOR")) { fscanf(ph->ifp, "%f %f %f", &r, &g, &b); tex.col.r=r; tex.col.g=g; tex.col.b=b; li = rt_spotlight(scene, rt_texture(scene, &tex), ctr, rad, direction, start, end); } else { if (stringcmp(tmp, "ATTENUATION")) return -1; rc |= GetString(ph, "CONSTANT"); fscanf(ph->ifp, "%f", &a); Kc=a; rc |= GetString(ph, "LINEAR"); fscanf(ph->ifp, "%f", &a); Kl=a; rc |= GetString(ph, "QUADRATIC"); fscanf(ph->ifp, "%f", &a); Kq=a; rc |= GetColor(ph, &tex.col); li = rt_spotlight(scene, rt_texture(scene, &tex), ctr, rad, direction, start, end); rt_light_attenuation(li, Kc, Kl, Kq); } return rc; }
void QFCItem::setup(void) { FieldContainer *pFCAsp = getFC().getAspectCPtr(getAspect()); if(!pFCAsp) return; UInt32 uiNumFields = pFCAsp->getType().getNumFieldDescs(); for(UInt32 fieldId = 1; fieldId <= uiNumFields; ++fieldId) { FieldDescription *pDesc = pFCAsp->getType().getFieldDescription (fieldId); Field *pField = pFCAsp->getField(fieldId); if(isSFFieldContainerPtr(pField)) { if(stringcmp(pDesc->getCName(), "parent" ) == 0) continue; SFFieldContainerPtr *pSFFCPtr = reinterpret_cast<SFFieldContainerPtr *>(pField); if(pSFFCPtr->getValue() != NullFC) { setExpandable(this); break; } } else if(isMFFieldContainerPtr(pField)) { MFFieldContainerPtr *pMFFCPtr = reinterpret_cast<MFFieldContainerPtr *>(pField); if(stringcmp(pDesc->getCName(), "parents") == 0) { if(pMFFCPtr->size() > 1) { setExpandable(this); break; } } else { if(pMFFCPtr->size() > 0) { setExpandable(this); break; } } } } Inherited::setup(); }
void Thunder::parser(char *l) { defaults(); l = tokenize(l); begin_while_parse(l) { l = parse()->parseAttributes(l, this); if (!l) break; if (!stringcmp(l, "number")) l = parse()->parseUInt16(l, &number, "number"); else if (!stringcmp(l, "period")) l = parse()->parseFloat(l, &period, "period"); } end_while_parse(l); }
void QFCItem::expand(void) { if(childCount() != 0) return; FieldContainer *pFCAsp = getFC().getAspectCPtr(getAspect()); if(!pFCAsp) return; FieldContainerType &fcType = pFCAsp->getType(); UInt32 uiNumFields = fcType.getNumFieldDescs(); for(UInt32 fieldId = 1; fieldId <= uiNumFields; ++fieldId) { FieldDescription *pFieldDesc = fcType.getFieldDescription(fieldId); Field *pField = pFCAsp->getField (fieldId); //add Items for all referenced containers (except parents) if(isSFFieldContainerPtr(pField)) { if(stringcmp(pFieldDesc->getCName(), "parent" ) == 0) continue; addRefedContainer( reinterpret_cast<SFFieldContainerPtr *>(pField)); } else if(isMFFieldContainerPtr(pField)) { if(stringcmp(pFieldDesc->getCName(), "parents") == 0) { addParents( reinterpret_cast<MFFieldContainerPtr *>(pField)); } else { addRefedContainer( reinterpret_cast<MFFieldContainerPtr *>(pField), pFieldDesc ); } } //add attachments if(stringcmp(pFieldDesc->getCName(), "attachments") == 0) { addAttachments(dynamic_cast<SFAttachmentMap *>(pField)); } } PNOTICE << endLog; }
static errcode GetClipGroup(parsehandle * ph, SceneHandle scene) { char objtype[256]; if (fscanf(ph->ifp, "%s", objtype) == EOF) { return PARSEEOF; } if (!stringcmp(objtype, "NUMPLANES")) { int numplanes, i; float * planes; if (fscanf(ph->ifp, "%d", &numplanes) != 1) return PARSEBADSYNTAX; planes = (float *) malloc(numplanes * 4 * sizeof(float)); for (i=0; i<(numplanes * 4); i++) { if (fscanf(ph->ifp, "%f", &planes[i]) != 1) return PARSEBADSYNTAX; } rt_clip_fv(scene, numplanes, planes); free(planes); return PARSENOERR; } return PARSEBADSYNTAX; }
/** * Read from kernel. */ int read_kernel(int handle, void *buffer, int length) { KERNEL_ASSERT(handle == 0); KERNEL_ASSERT(length >= strlen(buffer)); device_t *dev; gcd_t *gcd; int buf_len; buf_len = 0; dev = device_get(TYPECODE_TTY, 0); KERNEL_ASSERT(dev != NULL); gcd = (gcd_t *)dev->generic_device; KERNEL_ASSERT(gcd != NULL); while(stringcmp(buffer, "n") != 0){ buf_len = buf_len + gcd->read(gcd, buffer, length); KERNEL_ASSERT(buf_len >= 0); kwrite(buffer); } gcd->write(gcd, buffer, buf_len); return buf_len; }
static errcode GetScene(FILE * dfile, SceneHandle scene) { char objtype[80]; if (fscanf(dfile, "%s", objtype) != 1) { return PARSEEOF; /* end parsing */ } if (!stringcmp(objtype, "MATERIAL")) { return GetMaterial(dfile, scene); } if (!stringcmp(objtype, "OBJECT")) { return GetObject(dfile, scene); } printf("Found bad token: %s expected an object type\n", objtype); return PARSEBADSYNTAX; }
/** * Opens file. Implements fs.open(). Reads directory block of tfs * device and finds given file. Returns file's inode block number or * VFS_NOT_FOUND, if file not found. * * @param fs Pointer to fs data structure of the device. * @param filename Name of the file to be opened. * * @return If file found, return inode block number as fileid, otherwise * return VFS_NOT_FOUND. */ int tfs_open(fs_t *fs, char *filename) { tfs_t *tfs; gbd_request_t req; uint32_t i; int r; tfs = (tfs_t *)fs->internal; semaphore_P(tfs->lock); req.block = TFS_DIRECTORY_BLOCK; req.buf = ADDR_KERNEL_TO_PHYS((uint32_t)tfs->buffer_md); req.sem = NULL; r = tfs->disk->read_block(tfs->disk,&req); if(r == 0) { /* An error occured during read. */ semaphore_V(tfs->lock); return VFS_ERROR; } for(i=0;i < TFS_MAX_FILES;i++) { if(stringcmp(tfs->buffer_md[i].name, filename) == 0) { semaphore_V(tfs->lock); return tfs->buffer_md[i].inode; } } semaphore_V(tfs->lock); return VFS_NOT_FOUND; }
usr_sem_t* usr_sem_open(const char* name, int value) { interrupt_status_t intr_status; intr_status = _interrupt_disable(); spinlock_acquire(&sem_table_slock); if (value >= 0) { for (int i = 0; i < MAX_SEMAPHORES; i++) { if (usr_sem_table[i].name != NULL) { if (!stringcmp(usr_sem_table[i].name, name)) { spinlock_release(&sem_table_slock); _interrupt_set_state(intr_status); return NULL; } } } for (int j = 0; j < MAX_SEMAPHORES; j++) { if (usr_sem_table[j].name == NULL) { stringcopy(usr_sem_table[j].name, name, 8); usr_sem_table[j].value = value; spinlock_release(&sem_table_slock); return &usr_sem_table[j]; } } spinlock_release(&sem_table_slock); _interrupt_set_state(intr_status); return NULL; } else { for (int k = 0; k < MAX_SEMAPHORES; k++) { if (stringcmp(usr_sem_table[k].name, name)) { spinlock_release(&sem_table_slock); return &usr_sem_table[k]; // return handle already in use } } spinlock_release(&sem_table_slock); _interrupt_set_state(intr_status); return NULL; } }
void Doc::parser(char *l) { l = tokenize(l); begin_while_parse(l) { l = parse()->parseAttributes(l, this); if (!l) break; if (!stringcmp(l, "url")) l = parse()->parseUrl(l, names.url); } end_while_parse(l); }
int main() { char a[] = "source"; char b[] = "dest"; int retVal = 0; retVal = stringcmp(a,b); return 0; }
void Icon::parser(char *l) { l = tokenize(vref); begin_while_parse(l) { l = parse()->parseAttributes(l, this); if (!l) break; if (!stringcmp(l, "owner=")) l = parse()->parseString(l, names.owner, "owner"); } end_while_parse(l); }
static errcode GetString(parsehandle * ph, const char * string) { char data[255]; fscanf(ph->ifp, "%s", data); if (stringcmp(data, string) != 0) { PrintSyntaxError(ph, string, data); return PARSEBADSYNTAX; } return PARSENOERR; }
static errcode GetString(FILE * dfile, const char * string) { char data[255]; fscanf(dfile,"%s",data); if (stringcmp(data, string) != 0) { fprintf(stderr, "parse: Expected %s, got %s \n",string, data); fprintf(stderr, "parse: Error while parsing object: %d \n",numobjectsparsed); return PARSEBADSYNTAX; } return PARSENOERR; }
static fs_t *vfs_get_filesystem(char *mountpoint) { int row; for (row = 0; row < CONFIG_MAX_FILESYSTEMS; row++) { if(!stringcmp(vfs_table.filesystems[row].mountpoint, mountpoint)) { return vfs_table.filesystems[row].filesystem; } } return NULL; }
static errcode GetTexture(FILE * dfile, void ** tex) { char tmp[255]; errcode rc = PARSENOERR; fscanf(dfile, "%s", tmp); if (!stringcmp("TEXTURE", tmp)) { *tex = GetTexBody(dfile); } else *tex = find_texture(tmp); return rc; }
void Guide::parser(char *l) { defaults(); l = tokenize(l); begin_while_parse(l) { l = parse()->parseAttributes(l, this); if (!l) break; if (! stringcmp(l, "path=")) l = parse()->parsePath(l, &path[1], &pts); else if (! stringcmp(l, "color")) l = parse()->parseVector3f(l, color, "color"); else if (! stringcmp(l, "mode=")) { char modestr[16]; l = parse()->parseString(l, modestr, "mode"); if (! stringcmp(modestr, "one-way")) oneway = true; else if (! stringcmp(modestr, "perpetual")) perpetual = true; } } end_while_parse(l); if (pts == 0) { warning("no path"); return; } // start point = guide initial path[0][0] = pos.x; path[0][1] = pos.y; path[0][2] = pos.z; path[0][3] = path[1][3]; path[0][4] = 1; // tempo 1 sec pts++; if (oneway) { path[pts][3] = 0; path[pts][4] = 0; } else { // round-trip: end point = start point for (int i=0; i<5 ; i++) path[pts+1][i] = path[0][i]; path[pts+1][3] = 0; // speed = 0 for end point path[pts+1][4] = 0; pts++; } }
static errcode GetTexture(parsehandle * ph, SceneHandle scene, void ** tex) { char tmp[255]; errcode rc = PARSENOERR; fscanf(ph->ifp, "%s", tmp); if (!stringcmp(tmp, "TEXTURE")) { *tex = GetTexBody(ph, scene, 0); } else *tex = find_texture(ph, tmp); return rc; }
int main() { char s1[50],s2[50]; int x; printf("\n Enter string 1: "); gets(s1); printf("\n Enter string 2: "); gets(s2); if(stringcmp(s1,s2)==0) printf("\nEqual\n"); else printf("\nUnequal\n"); system("pause"); return 0; }
/* equal - internal equal function */ int equal P2C(LVAL, arg1, LVAL, arg2) { FIXTYPE n=0; /* for circularity check -- 6/93 */ /* compare the arguments */ isItEqual: /* turn tail recursion into iteration */ if (arg1 == arg2) return (TRUE); else if (arg1 != NIL) { switch (ntype(arg1)) { case FIXNUM: return (fixp(arg2) ? getfixnum(arg1)==getfixnum(arg2) : FALSE); #ifdef BIGNUMS case RATIO: return (ratiop(arg2) ? compareratio(arg1, arg2) : FALSE); case BIGNUM: return (bignump(arg2) ? comparebignum(arg1, arg2) == 0 : FALSE); #endif case FLONUM: return (floatp(arg2) ? getflonum(arg1)==getflonum(arg2) : FALSE); case COMPLEX: return (complexp(arg2) ? comparecomplex(arg1,arg2) : FALSE); case STRING: /* TAA MOD */ return (stringp(arg2) ? stringcmp(arg1,arg2) : FALSE); case CONS: /* TAA MOD turns tail recursion into iteration */ /* Not only is this faster, but greatly reduces chance */ /* of stack overflow */ #ifdef STSZ if (consp(arg2) && (stchck(), equal(car(arg1),car(arg2)))) #else if (consp(arg2) && equal(car(arg1),car(arg2))) #endif { arg1 = cdr(arg1); arg2 = cdr(arg2); if (++n > nnodes) xlfail("circular list"); goto isItEqual; } return FALSE; default: return (FALSE); } } else return (FALSE); }
FieldContainerType *FieldContainerFactory::findUninitializedType( const Char8 *szName) const { FieldContainerType *returnValue = NULL; if(_pUnitTypesStore == NULL || szName == NULL) return returnValue; for(UInt32 i = 0; i < _pUnitTypesStore->size(); i++) { if(stringcmp(szName, (*_pUnitTypesStore)[i]->getCName()) == 0) { returnValue = (*_pUnitTypesStore)[i]; break; } } return returnValue; }
int vfs_mount(fs_t *fs, char *name) { int i; int row; KERNEL_ASSERT(name != NULL && name[0] != '\0'); if (vfs_start_op() != VFS_OK) return VFS_UNUSABLE; semaphore_P(vfs_table.sem); for (i = 0; i < CONFIG_MAX_FILESYSTEMS; i++) { if (vfs_table.filesystems[i].filesystem == NULL) break; } row = i; if(row >= CONFIG_MAX_FILESYSTEMS) { semaphore_V(vfs_table.sem); kprintf("VFS: Warning, maximum mount count exceeded, mount failed.\n"); vfs_end_op(); return VFS_LIMIT; } for (i = 0; i < CONFIG_MAX_FILESYSTEMS; i++) { if(stringcmp(vfs_table.filesystems[i].mountpoint, name) == 0) { semaphore_V(vfs_table.sem); kprintf("VFS: Warning, attempt to mount 2 filesystems " "with same name\n"); vfs_end_op(); return VFS_ERROR; } } stringcopy(vfs_table.filesystems[row].mountpoint, name, VFS_NAME_LENGTH); vfs_table.filesystems[row].filesystem = fs; semaphore_V(vfs_table.sem); vfs_end_op(); return VFS_OK; }
int vfs_unmount(char *name) { int i, row; fs_t *fs = NULL; if (vfs_start_op() != VFS_OK) return VFS_UNUSABLE; semaphore_P(vfs_table.sem); for (row = 0; row < CONFIG_MAX_FILESYSTEMS; row++) { if(!stringcmp(vfs_table.filesystems[row].mountpoint, name)) { fs = vfs_table.filesystems[row].filesystem; break; } } if(fs == NULL) { semaphore_V(vfs_table.sem); vfs_end_op(); return VFS_NOT_FOUND; } semaphore_P(openfile_table.sem); for(i = 0; i < CONFIG_MAX_OPEN_FILES; i++) { if(openfile_table.files[i].filesystem == fs) { semaphore_V(openfile_table.sem); semaphore_V(vfs_table.sem); vfs_end_op(); return VFS_IN_USE; } } fs->unmount(fs); vfs_table.filesystems[row].filesystem = NULL; semaphore_V(openfile_table.sem); semaphore_V(vfs_table.sem); vfs_end_op(); return VFS_OK; }
static errcode GetDirLight(parsehandle * ph, SceneHandle scene) { char tmp[255]; apivector dir; apitexture tex; float r, g, b; errcode rc; memset(&tex, 0, sizeof(apitexture)); rc = GetString(ph, "DIRECTION"); rc |= GetVector(ph, &dir); fscanf(ph->ifp, "%s", tmp); if (!stringcmp(tmp, "COLOR")) { fscanf(ph->ifp, "%f %f %f", &r, &g, &b); tex.col.r=r; tex.col.g=g; tex.col.b=b; rt_directional_light(scene, rt_texture(scene, &tex), dir); } return rc; }
void Particle::parser(char *l) { defaults(); l = tokenize(l); begin_while_parse(l) { l = parse()->parseAttributes(l, this); if (!l) break; if (!stringcmp(l, "system")) { char systemstr[16]; l = parse()->parseString(l, systemstr, "system"); if (! stringcmp(systemstr, "fountain")) system = FOUNTAIN; else if (! stringcmp(systemstr, "firework")) system = FIREWORK; else if (! stringcmp(systemstr, "rain")) system = RAIN; else if (! stringcmp(systemstr, "snow")) system = SNOW; else system = WATERFALL; } else if (!stringcmp(l, "number")) l = parse()->parseUInt16(l, &number, "number"); else if (!stringcmp(l, "flow")) l = parse()->parseFloat(l, &flow, "flow"); else if (!stringcmp(l, "speed")) l = parse()->parseFloat(l, &speed, "speed"); else if (!stringcmp(l, "ground")) l = parse()->parseFloat(l, &ground, "ground"); else if (!stringcmp(l, "size")) l = parse()->parseUInt8(l, &pt_size, "size"); else if (!stringcmp(l, "color")) {l = parse()->parseVector3f(l, color, "color"); mycolor = 1; } } end_while_parse(l); }
void * GetTexBody(parsehandle * ph, SceneHandle scene, int modeflag) { char tmp[255]; float a,b,c,d, phong, phongexp; int phongtype; apitexture tex; void * voidtex; errcode rc; rc = GetString(ph, "AMBIENT"); fscanf(ph->ifp, "%f", &a); tex.ambient=a; rc |= GetString(ph, "DIFFUSE"); fscanf(ph->ifp, "%f", &b); tex.diffuse=b; rc |= GetString(ph, "SPECULAR"); fscanf(ph->ifp, "%f", &c); tex.specular=c; rc |= GetString(ph, "OPACITY"); fscanf(ph->ifp, "%f", &d); tex.opacity=d; fscanf(ph->ifp, "%s", tmp); if (!stringcmp(tmp, "PHONG")) { fscanf(ph->ifp, "%s", tmp); if (!stringcmp(tmp, "METAL")) { phongtype = RT_PHONG_METAL; } else if (!stringcmp(tmp, "PLASTIC")) { phongtype = RT_PHONG_PLASTIC; } else { phongtype = RT_PHONG_PLASTIC; } fscanf(ph->ifp, "%f", &phong); GetString(ph, "PHONG_SIZE"); fscanf(ph->ifp, "%f", &phongexp); fscanf(ph->ifp, "%s", tmp); } else { /* assume we found "COLOR" otherwise */ phong = 0.0; phongexp = 100.0; phongtype = RT_PHONG_PLASTIC; } /* if we're processing normal objects, use the regular */ /* texture definition pattern. */ /* VCSTri objects skip the normal color and texture */ /* function definition since they are unused. */ if (modeflag == 0) { if (stringcmp(tmp, "COLOR")) { rc |= PARSEBADSYNTAX; } fscanf(ph->ifp, "%f %f %f", &a, &b, &c); tex.col.r = a; tex.col.g = b; tex.col.b = c; rc |= GetString(ph, "TEXFUNC"); /* this really ought to be a string, not a number... */ fscanf(ph->ifp, "%d", &tex.texturefunc); switch (tex.texturefunc) { case RT_TEXTURE_CONSTANT: default: break; case RT_TEXTURE_3D_CHECKER: case RT_TEXTURE_GRIT: case RT_TEXTURE_MARBLE: case RT_TEXTURE_WOOD: case RT_TEXTURE_GRADIENT: case RT_TEXTURE_CYLINDRICAL_CHECKER: rc |= GetString(ph, "CENTER"); rc |= GetVector(ph, &tex.ctr); rc |= GetString(ph, "ROTATE"); rc |= GetVector(ph, &tex.rot); rc |= GetString(ph, "SCALE"); rc |= GetVector(ph, &tex.scale); break; case RT_TEXTURE_CYLINDRICAL_IMAGE: case RT_TEXTURE_SPHERICAL_IMAGE: fscanf(ph->ifp, "%s", tex.imap); rc |= GetString(ph, "CENTER"); rc |= GetVector(ph, &tex.ctr); rc |= GetString(ph, "ROTATE"); rc |= GetVector(ph, &tex.rot); rc |= GetString(ph, "SCALE"); rc |= GetVector(ph, &tex.scale); break; case RT_TEXTURE_PLANAR_IMAGE: fscanf(ph->ifp, "%s", tex.imap); rc |= GetString(ph, "CENTER"); rc |= GetVector(ph, &tex.ctr); rc |= GetString(ph, "ROTATE"); rc |= GetVector(ph, &tex.rot); rc |= GetString(ph, "SCALE"); rc |= GetVector(ph, &tex.scale); rc |= GetString(ph, "UAXIS"); rc |= GetVector(ph, &tex.uaxs); rc |= GetString(ph, "VAXIS"); rc |= GetVector(ph, &tex.vaxs); break; } } else { if (stringcmp(tmp, "VCST")) { rc |= PARSEBADSYNTAX; } /* if we're processing VCSTri objects, set some defaults */ tex.col.r = 1.0; tex.col.g = 1.0; tex.col.b = 1.0; tex.texturefunc = 0; /* set to none by default, gets reset anyway */ } voidtex = rt_texture(scene, &tex); rt_tex_phong(voidtex, phong, phongexp, phongtype); return voidtex; }
static errcode GetObject(parsehandle * ph, SceneHandle scene) { char objtype[256]; if (fscanf(ph->ifp, "%s", objtype) == EOF) { return PARSEEOF; } if (!stringcmp(objtype, "TRI")) { return GetTri(ph, scene); } if (!stringcmp(objtype, "STRI")) { return GetSTri(ph, scene); } if (!stringcmp(objtype, "VCSTRI")) { return GetVCSTri(ph, scene); } if (!stringcmp(objtype, "SPHERE")) { return GetSphere(ph, scene); } if (!stringcmp(objtype, "FCYLINDER")) { return GetFCylinder(ph, scene); } if (!stringcmp(objtype, "RING")) { return GetRing(ph, scene); } if (!stringcmp(objtype, "POLYCYLINDER")) { return GetPolyCylinder(ph, scene); } if (!stringcmp(objtype, "CYLINDER")) { return GetCylinder(ph, scene); } if (!stringcmp(objtype, "PLANE")) { return GetPlane(ph, scene); } if (!stringcmp(objtype, "BOX")) { return GetBox(ph, scene); } if (!stringcmp(objtype, "SCALARVOL")) { return GetVol(ph, scene); } if (!stringcmp(objtype, "TEXDEF")) { return GetTexDef(ph, scene); } if (!stringcmp(objtype, "TEXALIAS")) { return GetTexAlias(ph); } if (!stringcmp(objtype, "LIGHT")) { return GetLight(ph, scene); } if (!stringcmp(objtype, "DIRECTIONAL_LIGHT")) { return GetDirLight(ph, scene); } if (!stringcmp(objtype, "SPOTLIGHT")) { return GetSpotLight(ph, scene); } if (!stringcmp(objtype, "SCAPE")) { return GetLandScape(ph, scene); } if (!stringcmp(objtype, "CAMERA")) { return GetCamera(ph, scene); } if (!stringcmp(objtype, "TPOLYFILE")) { return GetTPolyFile(ph, scene); } if (!stringcmp(objtype, "MGFFILE")) { #ifdef USELIBMGF return GetMGFFile(ph, scene); #else printf("MGF File Parsing is not available in this build.\n"); return PARSEBADSYNTAX; #endif } if (!stringcmp(objtype, "#")) { int c; while (1) { c=fgetc(ph->ifp); if (c == EOF || c == '\n') /* eat comment text */ return PARSENOERR; } } if (!stringcmp(objtype, "BACKGROUND")) { return GetBackGnd(ph, scene); } if (!stringcmp(objtype, "FOG")) { return GetFog(ph, scene); } if (!stringcmp(objtype, "INCLUDE")) { char includefile[FILENAME_MAX]; fscanf(ph->ifp, "%s", includefile); return ReadIncludeFile(ph, includefile, scene); } if (!stringcmp(objtype, "START_CLIPGROUP")) { return GetClipGroup(ph, scene); } if (!stringcmp(objtype, "END_CLIPGROUP")) { return GetClipGroupEnd(ph, scene); } if (!stringcmp(objtype, "END_SCENE")) { return PARSEEOF; /* end parsing */ } PrintSyntaxError(ph, "an object or other declaration", objtype); return PARSEBADSYNTAX; }