void CgFrontGotoNear( // EMIT GOTO IN NEAR SPACE (CS,GOTO) int opcode, // - opcode to determine type of label ref. unsigned condition, // - condition for goto CGLABEL label ) // - label number { label_reference( label, opcode ); CgFrontCodeUint( IC_GOTO_NEAR, condition ); dump_label( printf( "GotoNear -- %d\n", label ) ); }
unsigned CgFrontLabelGoto( // GET NEXT AVAILABLE LABEL # (GOTO) void ) { CGFILE_GEN *gen; // - generation data gen = getGenData(); gen->goto_label++; cgEmitCodeUint( gen, IC_LABGET_GOTO, 0 ); dump_label( printf( "LabelGoto -- %d\n", gen->goto_label ) ); return( gen->goto_label ); }
void CgFrontLabfreeCs( // FREE CS LABELS unsigned count ) // - number of labels to be freed { CGFILE_GEN *gen; // - generation data gen = getGenData(); gen->cs_label -= count; count += gen->cs_allocated; gen->cs_allocated = 0; dump_label( printf( "LabfreeCs -- %d\n", count ) ); cgEmitCodeUint( gen, IC_LABFREE_CS, count ); }
void dump_dag ( mclx* mx , mclTab* tab ) { mclx* mx = mclxTranspose(mx) ; dim i ; for (i=0;i<N_COLS(mx);i++) { mclv* v = mx->cols+i ; if (v->val < 1.5) { dump_label(tab, v->vid, 0) ; walk_dag(mx, v, 1) ; } } }
void walk_dag ( mclx* mx , mclv* v , int level ) { dim i ; v->val = 2.0 ; for (i=0;i<v->n_ivps;i++) { mclv* v = mclxGetVector(mx, v->ivps[i].idx, EXIT_ON_FAIL, NULL) ; v->val = 2.0 ; dump_label(tab, v, level) ; } ; }
unsigned CgFrontLabelCs( // GET NEXT AVAILABLE LABEL # (CONTROL SEQ) void ) { CGFILE_GEN *gen; // - generation data gen = getGenData(); gen->cs_label++; if( gen->cs_allocated != 0 ) { gen->cs_allocated--; } else { cgEmitCodeUint( gen, IC_LABGET_CS, CS_LABEL_BLOCK ); gen->cs_allocated = CS_LABEL_BLOCK - 1; } dump_label( printf( "Allocate CS Label: %u\n", gen->cs_label ) ); return( gen->cs_label ); }
static void dump_labels(struct file *f) { struct label_header *lbl_hdr; lbl_hdr=file_read(f, 0, sizeof(*lbl_hdr)); printf("**labels**\n"); dump_label(lbl_hdr); file_free(lbl_hdr); #if 0 labels=alloca(lbl_hdr.label_length); file_read(f, lbl_hdr.label_offset, labels, lbl_hdr.label_length); l=labels; while (l < labels+lbl_hdr.label_length) { printf("'%s'(%d)\n", l, strlen(l)); l+=strlen(l)+1; } #endif }
static void dump(int dumplevel) { int x; uid_t ru, eu, su; gid_t rg, eg, sg; if (getresuid(&ru, &eu, &su) == 0) { printf(_("uid: %u\n"), ru); printf(_("euid: %u\n"), eu); /* Saved and fs uids always equal euid. */ if (3 <= dumplevel) printf(_("suid: %u\n"), su); } else warn(_("getresuid failed")); if (getresgid(&rg, &eg, &sg) == 0) { printf("gid: %ld\n", (long)rg); printf("egid: %ld\n", (long)eg); /* Saved and fs gids always equal egid. */ if (dumplevel >= 3) printf("sgid: %ld\n", (long)sg); } else warn(_("getresgid failed")); dump_groups(); x = prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0); if (0 <= x) printf("no_new_privs: %d\n", x); else warn("setting no_new_privs failed"); if (2 <= dumplevel) { printf(_("Effective capabilities: ")); if (print_caps(stdout, CAPNG_EFFECTIVE) == 0) printf(_("[none]")); printf("\n"); printf(_("Permitted capabilities: ")); if (print_caps(stdout, CAPNG_PERMITTED) == 0) printf(_("[none]")); printf("\n"); } printf(_("Inheritable capabilities: ")); if (print_caps(stdout, CAPNG_INHERITABLE) == 0) printf(_("[none]")); printf("\n"); printf(_("Capability bounding set: ")); if (print_caps(stdout, CAPNG_BOUNDING_SET) == 0) printf(_("[none]")); printf("\n"); dump_securebits(); if (access(_PATH_SYS_SELINUX, F_OK) == 0) dump_label(_("SELinux label")); if (access(_PATH_SYS_APPARMOR, F_OK) == 0) { dump_label(_("AppArmor profile")); } }
int main(int argc, char** argv) { cerr << "Starte mit einlesen\n"; if(argc <= 4) { cerr << "Usage: vpf_importer <DataBase> <Library> <Coverage(id)> <Feature(id)> [<first Element(id)>]\n"; return 1; } // Zielverzeichnis der Kartendateien ... string outDir((string)"/data/KartenDaten/VPF-Daten/heiner/" + argv[2] + "/"); VpfRectangle bounds; bounds.minX = -180.0; bounds.maxX = 180.0; bounds.minY = -90.0; bounds.maxY = 90.0; VpfDataBase db( argv[1] ); cout << "Number of libraries: " << db.getLibraryCount() << endl; VpfLibrary lib( db.getLibrary(argv[2]) ); cout << "Number of coverages: " << lib.getCoverageCount() << endl; int coverCount = lib.getCoverageCount(); cout << "<->\n"; int cID(0), fID(0), idStart(0); sscanf(argv[3], "%d", &cID); sscanf(argv[4], "%d", &fID); if(argc > 5) { sscanf(argv[5], "%d", &idStart); } VpfCoverage cover(lib.getCoverage(cID)); int featureCount = cover.getFeatureCount(); cout << "Coverage: " << cover.getName() << " (" << cID << ") Features: " << cover.getFeatureCount() << endl; VpfFeature feature(cover.getFeature(fID)); string fileName((string)argv[1] + "/" + (string)argv[2] + "/" + (string)cover.getName() + "/" + (string)feature.getName()); // Ausgabe-Datei öffnen: string outFileName((string)cover.getName() + "_" + (string)feature.getName()); string idFileName = outDir + "/IDS/" + outFileName + ".id"; outFileName = outDir + outFileName; ofstream outFile; ifstream idFile; cout << "\n"; cout << " Öffne Ausgabedatei: " << outFileName << " ..."; /* idFile.open(idFileName.c_str(), ios::in); if(!idFile) { cerr << "FEHLER! bei ID File\n" << idFileName.c_str() << endl; return 0; } */ outFile.open(outFileName.c_str(), ios::out | ios::app ); if(!outFile) { cerr << "FEHLER!\n"; return 1; } else { cout << "fertig\n"; } cout << endl; cout << " Bearbeite " << cover.getName() << " (" << cID << ") " << feature.getName() << " (" << fID << ")\n"; switch(feature.getTopologyType()) { case VpfFeature::POINT: fileName += ".pft"; break; case VpfFeature::LINE: fileName += ".lft"; break; case VpfFeature::POLYGON: fileName += ".aft"; break; case VpfFeature::LABEL: fileName += ".tft"; break; default: throw VpfException("Unsupported topology type"); } VpfTable table(fileName); dump_table_header(table, outFile); char p[20]; int id(-1), oldID(-1), rowLoop; int rowCount = table.getRowCount(); int colCount = table.getColumnCount(); int topologyType = feature.getTopologyType(); for(int rowLoop = idStart; rowLoop < table.getRowCount(); rowLoop++) { outFile << "[NEW]\n"; std::string header = ""; for(int colLoop = 0; colLoop < colCount; colLoop++) { outFile << table.getColumnDecl(colLoop).getName() << "=" << table.getValue(rowLoop, colLoop) << endl; } try { //cout << "\r"; cout << "id: "; cout.width(10); cout << rowLoop << " von "; cout.width(10); cout << rowCount << " ( "; cout.precision(2); cout.width(4); cout.setf(ios::fixed); cout << (float)((float)rowLoop / (float)rowCount * 100) << "% )\n"; switch(topologyType) { case VpfFeature::POINT: dump_point(feature.getPoint(rowLoop), outFile); break; case VpfFeature::LINE: dump_line(feature.getLine(rowLoop), outFile); break; case VpfFeature::POLYGON: dump_polygon(feature.getPolygon(rowLoop), outFile, table, rowLoop); break; case VpfFeature::LABEL: dump_label(feature.getLabel(rowLoop), outFile); break; default: throw VpfException("Unsupported topology type"); } } catch(VpfException &e) { cerr << "Fehler: " << e.getMessage() << endl; } outFile << "[END]\n"; } outFile.close(); cout << endl; return 0; }
void CgFrontLabdefGoto( // DEFINE A GOTO LABEL CGLABEL label ) // - label number { label_reference( label, IC_LABDEF_GOTO ); dump_label( printf( "LabdefGoto -- %d\n", label ) ); }
void CgFrontLabdefCs( // DEFINE A CS LABEL CGLABEL label ) // - label number { label_reference( label, IC_LABDEF_CS ); dump_label( printf( "LabdefCs -- %d\n", label ) ); }