int main(int argc, char *argv[]) { int ret_value = 0; libettercap_init(PROGRAM, EC_VERSION); ef_globals_alloc(); select_text_interface(); libettercap_ui_init(); /* etterfilter copyright */ USER_MSG("\n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s\n\n", PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS); /* initialize the line number */ EF_GBL->lineno = 1; /* getopt related parsing... */ parse_options(argc, argv); /* set the input for source file */ if (EF_GBL_OPTIONS->source_file) { yyin = fopen(EF_GBL_OPTIONS->source_file, "r"); if (yyin == NULL) FATAL_ERROR("Input file not found !"); } else { FATAL_ERROR("No source file."); } /* no buffering */ setbuf(yyin, NULL); setbuf(stdout, NULL); setbuf(stderr, NULL); /* load the tables in etterfilter.tbl */ load_tables(); /* load the constants in etterfilter.cnt */ load_constants(); /* print the message */ USER_MSG("\n Parsing source file \'%s\' ", EF_GBL_OPTIONS->source_file); ef_debug(1, "\n"); /* begin the parsing */ if (yyparse() == 0) USER_MSG(" done.\n\n"); else USER_MSG("\n\nThe script contains errors...\n\n"); /* write to file */ ret_value = write_output(); if (ret_value == -E_NOTHANDLED) FATAL_ERROR("Cannot write output file (%s): the filter is not correctly handled.", EF_GBL_OPTIONS->output_file); else if (ret_value == -E_INVALID) FATAL_ERROR("Cannot write output file (%s): the filter format is not correct. ", EF_GBL_OPTIONS->output_file); ef_exit(0); }
int main(int argc, char *argv[]) { /* etterfilter copyright */ fprintf(stdout, "\n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s\n\n", GBL_PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS); /* initialize the line number */ GBL.lineno = 1; /* getopt related parsing... */ parse_options(argc, argv); /* set the input for source file */ if (GBL_OPTIONS.source_file) { yyin = fopen(GBL_OPTIONS.source_file, "r"); if (yyin == NULL) FATAL_ERROR("Input file not found !"); } else { FATAL_ERROR("No source file."); } /* no buffering */ setbuf(yyin, NULL); setbuf(stdout, NULL); setbuf(stderr, NULL); /* load the tables in etterfilter.tbl */ load_tables(); /* load the constants in etterfilter.cnt */ load_constants(); /* print the message */ fprintf(stdout, "\n Parsing source file \'%s\' ", GBL_OPTIONS.source_file); fflush(stdout); ef_debug(1, "\n"); /* begin the parsing */ if (yyparse() == 0) fprintf(stdout, " done.\n\n"); else fprintf(stdout, "\n\nThe script contains errors...\n\n"); /* write to file */ if (write_output() != ESUCCESS) FATAL_ERROR("Cannot write output file (%s)", GBL_OPTIONS.output_file); return 0; }
static int load_function(struct load_state *S, ktap_proto *f) { f->linedefined = READ_INT(S); f->lastlinedefined = READ_INT(S); f->numparams = READ_BYTE(S); f->is_vararg = READ_BYTE(S); f->maxstacksize = READ_BYTE(S); if (load_code(S, f)) return -1; if (load_constants(S, f)) return -1; if (load_upvalues(S, f)) return -1; if (load_debuginfo(S, f)) return -1; return 0; }
int main(int argc, char *argv[]) { // Create Application. QApplication app(argc, argv); if (!load_constants(app)) { app.exec(); return EXIT_FAILURE; } // Register QSettings information. app.setOrganizationName("qwinff"); if (Constants::getBool("Portable")) { // Portable App: Save settings in <exepath>/qwinff.ini. QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setPath(QSettings::IniFormat, QSettings::UserScope , app.applicationDirPath()); qDebug() << "Setting path: " + app.applicationDirPath(); } else { // Save settings in <home>/.qwinff/qwinff.ini QString settings_dir = QDir(QDir::homePath()).absoluteFilePath(".qwinff"); QDir().mkpath(settings_dir); QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settings_dir); qDebug() << "Setting path: " + settings_dir; } Paths::setAppPath(app.applicationDirPath()); // register external tools register_tool("ffmpeg"); register_tool("ffprobe"); register_tool("sox"); register_tool("ffplay"); register_tool("mplayer"); ExePath::loadSettings(); // Construct a string list containing all input filenames. QStringList inputFiles(app.arguments()); inputFiles.removeFirst(); // Exclude self executable name. // Setup translation QTranslator translator; QString translation_filename = find_translation_file(); if (!translation_filename.isEmpty()) { qDebug() << "Translation file: " << translation_filename; translator.load(translation_filename); app.installTranslator(&translator); } // Load translation for Qt library QTranslator translator_qt; translator_qt.load("qt_" + QLocale::system().name(), Paths::qtTranslationPath()); app.installTranslator(&translator_qt); // Setup notification Notification::init(); if (!Notification::setType(Notification::TYPE_LIBNOTIFY)) Notification::setType(Notification::TYPE_NOTIFYSEND); // Create main window. MainWindow window(0, inputFiles); window.show(); // Execute the main loop int status = app.exec(); // Tear down notification Notification::release(); #ifndef TOOLS_IN_DATA_PATH // Save path settings ExePath::saveSettings(); #endif return status; }
static void dispatch_ps(struct primitive *p, struct dispatch *d, int count) { uint32_t g; struct thread t; bool simd16 = (count == 2); /* Not sure what we should make this. */ uint32_t fftid = 0; t.mask_q1 = d[0].mask.ireg; if (count == 2) t.mask_q2 = d[1].mask.ireg; else t.mask_q2 = _mm256_set1_epi32(0); /* Fixed function header */ t.grf[0] = (struct reg) { .ud = { /* R0.0 */ gt.ia.topology | 0 /* FIXME: More here */, /* R0.1 */ gt.cc.state, /* R0.2: MBZ */ 0, /* R0.3: per-thread scratch space, sampler ptr */ gt.ps.sampler_state_address | gt.ps.scratch_size, /* R0.4: binding table pointer */ gt.ps.binding_table_address, /* R0.5: fftid, scratch offset */ gt.ps.scratch_pointer | fftid, /* R0.6: thread id */ gt.ps.tid++ & 0xffffff, /* R0.7: Reserved */ 0, } }; t.grf[1] = (struct reg) { .ud = { /* R1.0-1: MBZ */ 0, 0, /* R1.2: x, y for subspan 0 */ (d[0].y << 16) | d[0].x, /* R1.3: x, y for subspan 1 */ (d[0].y << 16) | (d[0].x + 2), /* R1.4: x, y for subspan 2 (SIMD16) */ (d[1].y << 16) | d[1].x, /* R1.5: x, y for subspan 3 (SIMD16) */ (d[1].y << 16) | (d[1].x + 2), /* R1.6: MBZ */ 0 | 0, /* R1.7: Pixel sample mask and copy */ t.mask | (t.mask << 16) } }; g = 2; if (gt.wm.barycentric_mode & BIM_PERSPECTIVE_PIXEL) { t.grf[g].reg = d[0].w1_pc.reg; t.grf[g + 1].reg = d[0].w2_pc.reg; g += 2; if (simd16) { t.grf[g].reg = d[1].w1_pc.reg; t.grf[g + 1].reg = d[1].w2_pc.reg; g += 2; } } if (gt.wm.barycentric_mode & BIM_PERSPECTIVE_CENTROID) { t.grf[g].reg = d[0].w1_pc.reg; t.grf[g + 1].reg = d[0].w2_pc.reg; g += 2; if (simd16) { t.grf[g].reg = d[1].w1_pc.reg; t.grf[g + 1].reg = d[1].w2_pc.reg; g += 2; } } if (gt.wm.barycentric_mode & BIM_PERSPECTIVE_SAMPLE) { t.grf[g].reg = d[0].w1_pc.reg; t.grf[g + 1].reg = d[0].w2_pc.reg; g += 2; if (simd16) { t.grf[g].reg = d[1].w1_pc.reg; t.grf[g + 1].reg = d[1].w2_pc.reg; g += 2; } } if (gt.wm.barycentric_mode & BIM_LINEAR_PIXEL) { t.grf[g].reg = d[0].w1.reg; t.grf[g + 1].reg = d[0].w2.reg; g += 2; if (simd16) { t.grf[g].reg = d[1].w1.reg; t.grf[g + 1].reg = d[1].w2.reg; g += 2; } } if (gt.wm.barycentric_mode & BIM_LINEAR_CENTROID) { t.grf[g].reg = d[0].w1.reg; t.grf[g + 1].reg = d[0].w2.reg; g += 2; if (simd16) { t.grf[g].reg = d[1].w1.reg; t.grf[g + 1].reg = d[1].w2.reg; g += 2; } } if (gt.wm.barycentric_mode & BIM_LINEAR_SAMPLE) { t.grf[g].reg = d[0].w1.reg; t.grf[g + 1].reg = d[0].w2.reg; g += 2; if (simd16) { t.grf[g].reg = d[1].w1.reg; t.grf[g + 1].reg = d[1].w2.reg; g += 2; } } if (gt.ps.uses_source_depth) { t.grf[g].reg = d[0].z.reg; g++; } if (gt.ps.uses_source_w) { t.grf[g].reg = d[0].w.reg; g++; } if (gt.ps.position_offset_xy == POSOFFSET_CENTROID) { g++; } else if (gt.ps.position_offset_xy == POSOFFSET_SAMPLE) { g++; } if (gt.ps.input_coverage_mask_state != ICMS_NONE) { g++; } if (gt.ps.push_constant_enable) g = load_constants(&t, >.ps.curbe, gt.ps.grf_start0); else g = gt.ps.grf_start0; if (gt.ps.attribute_enable) { memcpy(&t.grf[g], p->attribute_deltas, gt.sbe.num_attributes * 2 * sizeof(t.grf[0])); } if (gt.ps.statistics) gt.ps_invocation_count++; if (count == 1 && gt.ps.enable_simd8) { gt.ps.avx_shader_simd8(&t); } else { ksim_assert(gt.ps.enable_simd16); gt.ps.avx_shader_simd16(&t); } }