// Process a command. int pcom(char **cmd, int size) { int cret = -2; struct passwd *pw = getpwuid(geteuid()); if (strcmp(*cmd, "greet") == 0) cret = greet(pw->pw_name, pw->pw_dir); else if (strcmp(*cmd, "log_access") == 0) cret = log_access(pw->pw_name); else if (strcmp(*cmd, "cla") == 0) cret = cla(); else if (strcmp(*cmd, "cls") == 0) cret = cls(); if (cret == -2) { fprintf(stderr, "Unrecognized command '%s'.\n", *cmd); return -2; } bzero(*cmd, size); if (cret < 0) { strcpy(*cmd, "failure"); return -1; } strcpy(*cmd, "success"); return 0; }
void ClaManager::OutputClaReport() const{ ofstream cla("clareport.log"); cla << "hIndex\tclaIndex\tnumAss\treclaimLvl\tdepLvl\tRes\tTres\n"; for(int i=0;i< numHolders;i++){ cla << i << "\t" << (holders[i].theArray == NULL ? -1 : holders[i].theArray->Index()) << "\t" << holders[i].numAssigned << "\t"; cla << holders[i].reclaimLevel << "\t" << holders[i].depLevel << "\t"; cla << (holders[i].reserved ? "1" : "0") << "\t" << (holders[i].tempReserved ? "1" : "0")<< "\n"; } cla.close(); }
int main (int argc, char* argv[]) { COPYRIGHT("test AppConfig", "0.1"); //F::AppConfigIniBackEnd VLF_Cnvt("VLF_Cnvt.ini"); //inidat.AddNewConfigSource( &VLF_Cnvt ); F::AppConfigGgoBackEnd cla(argc, argv, &arg_info); inidat.AddNewConfigSource( &cla ); inidat.ParseConfiguration(); inidat.info(); cout<<"Files/files = "<<inidat.Value("Files", "files", "raté")<<endl; cout<<"Etalonnage/Interfranges = "<<inidat.Value("Etalonnage", "Interfranges", "raté")<<endl; cout<<"Nb files : "<<inidat.NbKeyInGroup("unnamedoptions")<<endl; cout<<"Nb clef in [Fichiers] : "<<inidat.NbKeyInGroup("Fichiers")<<endl; return 0; }
void LightsExporter::operator()(Object *ob) { Lamp *la = (Lamp*)ob->data; std::string la_id(get_light_id(ob)); std::string la_name(id_name(la)); COLLADASW::Color col(la->r * la->energy, la->g * la->energy, la->b * la->energy); float d, constatt, linatt, quadatt; d = la->dist; constatt = 1.0f; if(la->falloff_type==LA_FALLOFF_INVLINEAR) { linatt = 1.0f / d; quadatt = 0.0f; } else { linatt = 0.0f; quadatt = 1.0f / (d * d); } // sun if (la->type == LA_SUN) { COLLADASW::DirectionalLight cla(mSW, la_id, la_name); cla.setColor(col,false,"color"); cla.setConstantAttenuation(constatt); exportBlenderProfile(cla, la); addLight(cla); } // hemi else if (la->type == LA_HEMI) { COLLADASW::AmbientLight cla(mSW, la_id, la_name); cla.setColor(col,false,"color"); cla.setConstantAttenuation(constatt); exportBlenderProfile(cla, la); addLight(cla); } // spot else if (la->type == LA_SPOT) { COLLADASW::SpotLight cla(mSW, la_id, la_name); cla.setColor(col,false,"color"); cla.setFallOffAngle(la->spotsize,false,"fall_off_angle"); cla.setFallOffExponent(la->spotblend,false,"fall_off_exponent"); cla.setConstantAttenuation(constatt); cla.setLinearAttenuation(linatt); cla.setQuadraticAttenuation(quadatt); exportBlenderProfile(cla, la); addLight(cla); } // lamp else if (la->type == LA_LOCAL) { COLLADASW::PointLight cla(mSW, la_id, la_name); cla.setColor(col,false,"color"); cla.setConstantAttenuation(constatt); cla.setLinearAttenuation(linatt); cla.setQuadraticAttenuation(quadatt); exportBlenderProfile(cla, la); addLight(cla); } // area lamp is not supported // it will be exported as a local lamp else { COLLADASW::PointLight cla(mSW, la_id, la_name); cla.setColor(col,false,"color"); cla.setConstantAttenuation(constatt); cla.setLinearAttenuation(linatt); cla.setQuadraticAttenuation(quadatt); exportBlenderProfile(cla, la); addLight(cla); } }