void print_node(node_t *node, int indent_count) { char indent[100]; int i; source_t *source; for (i = 0; i < indent_count; ++i) indent[i] = ' '; indent[i] = '\0'; printf("%sxmin %0.4f, ymin %0.4f, xmax %0.4f, ymax %0.4f\n", indent, node->box.xmin, node->box.ymin, node->box.xmax, node->box.ymax); for (source = (source_t *)node->contents.first; source != NULL; source = (source_t *)source->links.next) { printf("%s", indent); print_source(source); } if (node->q1 != NULL) { printf("%sq1:\n", indent); print_node(node->q1, indent_count + 4); printf("%sq2:\n", indent); print_node(node->q2, indent_count + 4); printf("%sq3:\n", indent); print_node(node->q3, indent_count + 4); printf("%sq4:\n", indent); print_node(node->q4, indent_count + 4); } }
std::vector<Token> lexical_analysis(const std::string& src) { std::vector<Token> tokens; print_source(src); tokens = scanner(src); print_tokens(tokens, TokenType::WHITESPACE); tokens = evaluate_scanned_tokens(tokens); std::vector<Token> stripped_tokens = strip_unnecessary(tokens); // remove all comments and whitespace tokens. return stripped_tokens; }
/*-------------------------------------------------------------------- * src_viewer::view * */ void src_viewer::view(FileBlock* fb, String file_name ) { if ( fb && ( fb != current_file_block ) || ( !file_name.is_empty() && file_name != current_file_name ) ) { current_file_block = fb; if ( file_name.is_empty() ) { file_name = suif_utils::get_source_file( fb ); } current_file_name = file_name; if ( print_source() ) { /* check cache */ stree = 0; for ( s_count_t _cnt=0; _cnt<stree_cache->size(); _cnt++ ) { code_tree* ct = (*stree_cache)[_cnt]; source_id* s_id = (source_id*)ct->id; if ( (*s_id) == source_id( current_file_block, current_file_name ) ) { stree = ct; break; } } if ( !stree ) { build_stree(); } /* annotate the source codes */ annotate_src(); /* create tags */ stree->create_tags( text ); } } update_infobar(); }
GLuint GLshader::create_shader(std::string filename, GLenum type) { std::string source = parse_file(filename); if (type == GL_FRAGMENT_SHADER) { // source.insert(0, std::string("#extension GL_ARB_gpu_shader5 : require") + "\r\n"); // source.insert(0, std::string("#extension GL_ARB_shader_subroutine: enable") + "\r\n"); } version_add(source); //print_source(source); if (source.empty()) { fprintf(stderr, "Error opening %s: ", filename.c_str()); perror(""); return 0; } GLuint glshader = glCreateShader(type); const char *c_str = source.c_str(); GL_ASSERT(glShaderSource(glshader, 1, &c_str, NULL)); GL_ASSERT(glCompileShader(glshader)); GLint compile_ok = GL_FALSE; GL_ASSERT(glGetShaderiv(glshader, GL_COMPILE_STATUS, &compile_ok)); if (compile_ok == GL_FALSE) { print_source(source); POLL_ERROR(std::cerr, "Fragmic ERROR: could not compile shader: " << filename); print_log(glshader); glDeleteShader(glshader); exit(-1); return 0; } shader_objects.push_back(glshader); return glshader; }