diff --git a/CMakeLists.txt b/CMakeLists.txt index 73546bf8040bc46b75a8bb768532e4460ef7b5aa..db72c48549ff0b2f0723e281d58b3ac6e79287c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -742,9 +742,10 @@ else(WIN32) endif(WIN32) # mark targets as optional so we can install them separately if needed -# (e.g. "make lib" followed by "make install/fast") +# (e.g. "make lib" or "make shared" followed by "make install/fast") install(TARGETS gmsh RUNTIME DESTINATION ${GMSH_BIN} OPTIONAL) install(TARGETS lib ARCHIVE DESTINATION lib OPTIONAL) +install(TARGETS shared LIBRARY DESTINATION lib OPTIONAL) install(FILES ${GMSH_API} DESTINATION include/gmsh) install(FILES ${WELCOME_FILE} DESTINATION ${GMSH_DOC} RENAME README.txt) install(FILES ${LICENSE_FILE} DESTINATION ${GMSH_DOC}) diff --git a/Common/CreateFile.cpp b/Common/CreateFile.cpp index 43e84c0c0a200bcbb3d2413ca9900d839474e446..d4b9673c8c475070a14144850f63f50866c59349 100644 --- a/Common/CreateFile.cpp +++ b/Common/CreateFile.cpp @@ -14,7 +14,7 @@ #if defined(HAVE_FLTK) #include <FL/gl.h> #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #include "graphicWindow.h" #include "gl2ps.h" #include "gl2gif.h" @@ -420,6 +420,6 @@ void CreateOutputFile(std::string fileName, int format) CTX::instance()->printing = 0; #if defined(HAVE_FLTK) - Draw(); + drawContext::global()->draw(); #endif } diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index eec1795dfb42853e6d6bfe3cf6f349dc071cd0ea..61fa8ea8a154c9507661ba07464038a013fe33de 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -31,7 +31,7 @@ #if defined(HAVE_FLTK) #include <FL/fl_ask.H> #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #endif #define SQU(a) ((a)*(a)) @@ -468,7 +468,7 @@ void OpenProjectMacFinder(const char *fileName) } else{ OpenProject(fileName); - Draw(); + drawContext::global()->draw(); } #endif } diff --git a/Common/Options.cpp b/Common/Options.cpp index 2b63d1dfd5dfbe7884b36b9e2f951514fc93ece4..0d2b68c093d49863acacd993e819b6c8a4169759 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -9,7 +9,6 @@ #include "GmshDefines.h" #include "GModel.h" #include "GmshMessage.h" -#include "Draw.h" #include "Generator.h" #include "Context.h" #include "Options.h" @@ -28,6 +27,7 @@ #if defined(HAVE_FLTK) #include <FL/Fl_Tooltip.H> +#include "drawContext.h" #include "FlGui.h" #include "Solvers.h" #include "menuWindow.h" @@ -1010,10 +1010,10 @@ std::string opt_general_graphics_font(OPT_ARGS_STR) if(action & GMSH_SET) CTX::instance()->glFont = val; #if defined(HAVE_FLTK) - int index = GetFontIndex(CTX::instance()->glFont.c_str()); + int index = drawContext::global()->getFontIndex(CTX::instance()->glFont.c_str()); if(action & GMSH_SET){ - CTX::instance()->glFont = GetFontName(index); - CTX::instance()->glFontEnum = GetFontEnum(index); + CTX::instance()->glFont = drawContext::global()->getFontName(index); + CTX::instance()->glFontEnum = drawContext::global()->getFontEnum(index); } if(FlGui::available() && (action & GMSH_GUI)){ FlGui::instance()->options->general.choice[1]->value(index); diff --git a/Fltk/CMakeLists.txt b/Fltk/CMakeLists.txt index 6ec4bcfadd5088370106e3fa13885a43284faa6b..a073d3ac3010a88c7519532371f7c6dfc0936dd4 100644 --- a/Fltk/CMakeLists.txt +++ b/Fltk/CMakeLists.txt @@ -25,7 +25,6 @@ set(SRC projectionEditor.cpp classificationEditor.cpp partitionDialog.cpp - Draw.cpp Solvers.cpp ) diff --git a/Fltk/Draw.cpp b/Fltk/Draw.cpp deleted file mode 100644 index eb5d5ad8f7742f49b0f0259dd084368a344f1df1..0000000000000000000000000000000000000000 --- a/Fltk/Draw.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#include <string.h> -#include <FL/gl.h> -#include "FlGui.h" -#include "graphicWindow.h" -#include "optionWindow.h" -#include "GmshDefines.h" -#include "GmshMessage.h" -#include "Draw.h" -#include "StringUtils.h" -#include "gl2ps.h" -#include "Context.h" - -void Draw() -{ - if(!FlGui::available()) return; - for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++){ - for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++){ - FlGui::instance()->graph[i]->gl[j]->make_current(); - FlGui::instance()->graph[i]->gl[j]->redraw(); - } - } - FlGui::instance()->check(); -} - -void DrawCurrentOpenglWindow(bool make_current) -{ - if(!FlGui::available()) return; - openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow(); - if(make_current) gl->make_current(); - gl->redraw(); - glFlush(); - FlGui::instance()->check(); -} - -int GetFontIndex(const char *fontname) -{ - if(fontname){ - for(int i = 0; i < NUM_FONTS; i++) - if(!strcmp(menu_font_names[i].label(), fontname)) - return i; - } - Msg::Error("Unknown font \"%s\" (using \"Helvetica\" instead)", fontname); - Msg::Info("Available fonts:"); - for(int i = 0; i < NUM_FONTS; i++) - Msg::Info(" \"%s\"", menu_font_names[i].label()); - return 4; -} - -int GetFontEnum(int index) -{ - if(index >= 0 && index < NUM_FONTS) - return (long)menu_font_names[index].user_data(); - return FL_HELVETICA; -} - -const char *GetFontName(int index) -{ - if(index >= 0 && index < NUM_FONTS) - return menu_font_names[index].label(); - return "Helvetica"; -} - -int GetFontAlign(const char *alignstr) -{ - if(alignstr){ - if(!strcmp(alignstr, "BottomLeft") || !strcmp(alignstr, "Left") || - !strcmp(alignstr, "left")) - return 0; - else if(!strcmp(alignstr, "BottomCenter") || !strcmp(alignstr, "Center") || - !strcmp(alignstr, "center")) - return 1; - else if(!strcmp(alignstr, "BottomRight") || !strcmp(alignstr, "Right") || - !strcmp(alignstr, "right")) - return 2; - else if(!strcmp(alignstr, "TopLeft")) - return 3; - else if(!strcmp(alignstr, "TopCenter")) - return 4; - else if(!strcmp(alignstr, "TopRight")) - return 5; - else if(!strcmp(alignstr, "CenterLeft")) - return 6; - else if(!strcmp(alignstr, "CenterCenter")) - return 7; - else if(!strcmp(alignstr, "CenterRight")) - return 8; - } - Msg::Error("Unknown font alignment \"%s\" (using \"Left\" instead)", alignstr); - Msg::Info("Available font alignments:"); - Msg::Info(" \"Left\" (or \"BottomLeft\")"); - Msg::Info(" \"Center\" (or \"BottomCenter\")"); - Msg::Info(" \"Right\" (or \"BottomRight\")"); - Msg::Info(" \"TopLeft\""); - Msg::Info(" \"TopCenter\""); - Msg::Info(" \"TopRight\""); - Msg::Info(" \"CenterLeft\""); - Msg::Info(" \"CenterCenter\""); - Msg::Info(" \"CenterRight\""); - return 0; -} - -int GetFontSize() -{ - if(CTX::instance()->fontSize > 0){ - return CTX::instance()->fontSize; - } - else{ - int w = Fl::w(); - if(w <= 1024) return 11; - else if(w <= 1280) return 12; - else if(w <= 1680) return 13; - else if(w <= 1920) return 14; - else return 15; - } -} - -void SetFont(int fontid, int fontsize) -{ - gl_font(fontid, fontsize); -} - -double GetStringWidth(const char *str) -{ - return gl_width(str); -} - -int GetStringHeight() -{ - return gl_height(); -} - -int GetStringDescent() -{ - return gl_descent(); -} - -void DrawString(const char *str) -{ - gl_draw(str); -} diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index 368120239878fd4da2d8088f6d45b6ab9f69d871..d7d65fe08a8e01271e27a2ccd66832d332204234 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -10,6 +10,7 @@ #include <FL/Fl_Shared_Image.H> #include <FL/Fl_File_Icon.H> #include <FL/x.H> +#include <FL/gl.h> #include "FlGui.h" #include "graphicWindow.h" #include "menuWindow.h" @@ -26,7 +27,6 @@ #include "aboutWindow.h" #include "colorbarWindow.h" #include "fileDialogs.h" -#include "Draw.h" #include "GmshDefines.h" #include "GmshMessage.h" #include "GModel.h" @@ -40,6 +40,129 @@ #include "Win32Icon.h" #include "Options.h" #include "Context.h" +#include "StringUtils.h" +#include "gl2ps.h" + +class drawContextFltk : public drawContextGlobal{ + public: + void draw() + { + if(!FlGui::available()) return; + for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++){ + for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++){ + FlGui::instance()->graph[i]->gl[j]->make_current(); + FlGui::instance()->graph[i]->gl[j]->redraw(); + } + } + FlGui::instance()->check(); + } + void drawCurrentOpenglWindow(bool make_current) + { + if(!FlGui::available()) return; + openglWindow *gl = FlGui::instance()->getCurrentOpenglWindow(); + if(make_current) gl->make_current(); + gl->redraw(); + glFlush(); + FlGui::instance()->check(); + } + int getFontIndex(const char *fontname) + { + if(fontname){ + for(int i = 0; i < NUM_FONTS; i++) + if(!strcmp(menu_font_names[i].label(), fontname)) + return i; + } + Msg::Error("Unknown font \"%s\" (using \"Helvetica\" instead)", fontname); + Msg::Info("Available fonts:"); + for(int i = 0; i < NUM_FONTS; i++) + Msg::Info(" \"%s\"", menu_font_names[i].label()); + return 4; + } + int getFontEnum(int index) + { + if(index >= 0 && index < NUM_FONTS) + return (long)menu_font_names[index].user_data(); + return FL_HELVETICA; + } + const char *getFontName(int index) + { + if(index >= 0 && index < NUM_FONTS) + return menu_font_names[index].label(); + return "Helvetica"; + } + int getFontAlign(const char *alignstr) + { + if(alignstr){ + if(!strcmp(alignstr, "BottomLeft") || !strcmp(alignstr, "Left") || + !strcmp(alignstr, "left")) + return 0; + else if(!strcmp(alignstr, "BottomCenter") || !strcmp(alignstr, "Center") || + !strcmp(alignstr, "center")) + return 1; + else if(!strcmp(alignstr, "BottomRight") || !strcmp(alignstr, "Right") || + !strcmp(alignstr, "right")) + return 2; + else if(!strcmp(alignstr, "TopLeft")) + return 3; + else if(!strcmp(alignstr, "TopCenter")) + return 4; + else if(!strcmp(alignstr, "TopRight")) + return 5; + else if(!strcmp(alignstr, "CenterLeft")) + return 6; + else if(!strcmp(alignstr, "CenterCenter")) + return 7; + else if(!strcmp(alignstr, "CenterRight")) + return 8; + } + Msg::Error("Unknown font alignment \"%s\" (using \"Left\" instead)", alignstr); + Msg::Info("Available font alignments:"); + Msg::Info(" \"Left\" (or \"BottomLeft\")"); + Msg::Info(" \"Center\" (or \"BottomCenter\")"); + Msg::Info(" \"Right\" (or \"BottomRight\")"); + Msg::Info(" \"TopLeft\""); + Msg::Info(" \"TopCenter\""); + Msg::Info(" \"TopRight\""); + Msg::Info(" \"CenterLeft\""); + Msg::Info(" \"CenterCenter\""); + Msg::Info(" \"CenterRight\""); + return 0; + } + int getFontSize() + { + if(CTX::instance()->fontSize > 0){ + return CTX::instance()->fontSize; + } + else{ + int w = Fl::w(); + if(w <= 1024) return 11; + else if(w <= 1280) return 12; + else if(w <= 1680) return 13; + else if(w <= 1920) return 14; + else return 15; + } + } + void setFont(int fontid, int fontsize) + { + gl_font(fontid, fontsize); + } + double getStringWidth(const char *str) + { + return gl_width(str); + } + int getStringHeight() + { + return gl_height(); + } + int getStringDescent() + { + return gl_descent(); + } + void drawString(const char *str) + { + gl_draw(str); + } +}; static int globalShortcut(int event) { @@ -56,8 +179,11 @@ FlGui::FlGui(int argc, char **argv) // add global shortcuts Fl::add_handler(globalShortcut); + // set global fltk-dependent drawing functions + drawContext::setGlobal(new drawContextFltk); + // set default font size - FL_NORMAL_SIZE = GetFontSize(); + FL_NORMAL_SIZE = drawContext::global()->getFontSize(); // handle themes and tooltip font size if(CTX::instance()->guiTheme.size()) @@ -487,7 +613,7 @@ int FlGui::testGlobalShortcuts(int event) } if(status == 2){ - Draw(); + drawContext::global()->draw(); return 1; } else if(status == 1) @@ -604,7 +730,7 @@ void FlGui::setStatus(const char *msg, int num) gl->screenMessage[1] = std::string(&msg[i]); else gl->screenMessage[1].clear(); - Draw(); + drawContext::global()->draw(); } } @@ -656,7 +782,7 @@ void FlGui::callForSolverPlugin(int dim) void redraw_cb(Fl_Widget *w, void *data) { - Draw(); + drawContext::global()->draw(); } void window_cb(Fl_Widget *w, void *data) diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index af100ec155e5bb8a9ad1c94ec7a12f36cde63e43..de880f7f172162d475d87565cee44ffbf678d39d 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -8,7 +8,7 @@ #include "GmshMessage.h" #include "FlGui.h" #include "menuWindow.h" -#include "Draw.h" +#include "drawContext.h" #include "Context.h" #include "Options.h" #include "Parser.h" @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) } // Draw the scene - Draw(); + drawContext::global()->draw(); // Listen to external solvers if(CTX::instance()->solver.listen) Solver(-1, NULL); diff --git a/Fltk/Solvers.cpp b/Fltk/Solvers.cpp index 09571a8740e684f81b7a3a377830af2a22820b5b..695be45f4b8e079129a0bd64dfb194479982b0a3 100644 --- a/Fltk/Solvers.cpp +++ b/Fltk/Solvers.cpp @@ -14,7 +14,7 @@ #include "GmshSocket.h" #include "OpenFile.h" #include "PView.h" -#include "Draw.h" +#include "drawContext.h" #include "Context.h" #include "OS.h" @@ -253,14 +253,14 @@ int Solver(int num, const char *args) if(num < 0 || (num >= 0 && SINFO[num].merge_views)) { int n = PView::list.size(); MergeFile(message); - Draw(); + drawContext::global()->draw(); if(n != (int)PView::list.size()) FlGui::instance()->menu->setContext(menu_post, 0); } break; case GmshServer::CLIENT_PARSE_STRING: ParseString(message); - Draw(); + drawContext::global()->draw(); break; case GmshServer::CLIENT_INFO: Msg::Direct("%-8.8s: %s", num >= 0 ? SINFO[num].name.c_str() : "Client", diff --git a/Fltk/classificationEditor.cpp b/Fltk/classificationEditor.cpp index 665944519112c04af3fd580b7d6c1be62e072822..db7ccb344527cfa1cb05774ad8750afeebd6c9a6 100644 --- a/Fltk/classificationEditor.cpp +++ b/Fltk/classificationEditor.cpp @@ -9,7 +9,7 @@ #include "classificationEditor.h" #include "paletteWindow.h" #include "Numeric.h" -#include "Draw.h" +#include "drawContext.h" #include "Options.h" #include "Context.h" #include "GmshMessage.h" @@ -55,7 +55,7 @@ static void class_selectgface_cb(Fl_Widget *w, void *data) while(1) { CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, "Select Model Face\n" "[Press 'e' to end selection or 'q' to abort]"); @@ -82,7 +82,7 @@ static void class_selectgface_cb(Fl_Widget *w, void *data) } } CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -95,7 +95,7 @@ static void class_deleteedge_cb(Fl_Widget *w, void *data) while(1) { CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, "Select Elements\n" "[Press 'e' to end selection or 'q' to abort]"); @@ -143,7 +143,7 @@ static void class_deleteedge_cb(Fl_Widget *w, void *data) CTX::instance()->mesh.changed = ENT_ALL; CTX::instance()->pickElements = 0; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -160,7 +160,7 @@ static void class_save_cb(Fl_Widget *w, void *data) CTX::instance()->mesh.changed = ENT_ALL; CTX::instance()->pickElements = 0; NoElementsSelectedMode(e); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -176,7 +176,7 @@ static void class_clear_cb(Fl_Widget *w, void *data) CTX::instance()->mesh.changed = ENT_ALL; CTX::instance()->pickElements = 0; NoElementsSelectedMode(e); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -469,7 +469,7 @@ static void class_color_cb(Fl_Widget* w, void* data) printf("before drawing \n"); CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -502,14 +502,14 @@ static void updateedges_cb(Fl_Widget* w, void* data) } CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); } static void class_hide_cb(Fl_Widget *w, void *data) { CTX::instance()->hideUnselected = !CTX::instance()->hideUnselected; CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); } static void buildListOfEdgeAngle(e2t_cont adj, std::vector<edge_angle> &edges_detected, @@ -538,7 +538,7 @@ static void class_select_cb(Fl_Widget *w, void *data) while(1) { CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, "Select Elements\n" "[Press 'e' to end selection or 'q' to abort]"); @@ -579,7 +579,7 @@ static void class_select_cb(Fl_Widget *w, void *data) CTX::instance()->mesh.changed = ENT_ALL; CTX::instance()->pickElements = 0; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } diff --git a/Fltk/clippingWindow.cpp b/Fltk/clippingWindow.cpp index ec1bd459c306dc805a3c7048ec8075d86ddae62b..09287125f01b84110bc2336f589096206af7145c 100644 --- a/Fltk/clippingWindow.cpp +++ b/Fltk/clippingWindow.cpp @@ -6,7 +6,7 @@ #include <FL/Fl_Tabs.H> #include <FL/Fl_Return_Button.H> #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #include "clippingWindow.h" #include "paletteWindow.h" #include "GmshDefines.h" @@ -123,7 +123,7 @@ static void clip_update_cb(Fl_Widget *w, void *data) CTX::instance()->drawBBox = 1; if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; - Draw(); + drawContext::global()->draw(); CTX::instance()->drawBBox = old; CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1; } @@ -156,7 +156,7 @@ static void clip_reset_cb(Fl_Widget *w, void *data) } FlGui::instance()->clipping->resetBrowser(); - Draw(); + drawContext::global()->draw(); } clippingWindow::clippingWindow(int deltaFontSize) diff --git a/Fltk/colorbarWindow.cpp b/Fltk/colorbarWindow.cpp index 55b9684d109fdfca0a658cf90883725f8c01dfbf..ea65962f84eea7cb13a4563d1f7aef8b716e8f65 100644 --- a/Fltk/colorbarWindow.cpp +++ b/Fltk/colorbarWindow.cpp @@ -11,7 +11,6 @@ #include <FL/fl_draw.H> #include "colorbarWindow.h" #include "ColorTable.h" -#include "Draw.h" #include "Context.h" #define EPS 1.e-10 diff --git a/Fltk/contextWindow.cpp b/Fltk/contextWindow.cpp index dee10b2f5014d03f4ef2bf7cfec65174d8e56242..1eb85a7754e8e47d66bdb57914fc6bf1df0c44a8 100644 --- a/Fltk/contextWindow.cpp +++ b/Fltk/contextWindow.cpp @@ -6,7 +6,7 @@ #include <FL/Fl_Tabs.H> #include <FL/Fl_Return_Button.H> #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #include "contextWindow.h" #include "paletteWindow.h" #include "GModel.h" @@ -32,7 +32,7 @@ static void con_geometry_define_point_cb(Fl_Widget *w, void *data) FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); SetBoundingBox(); - Draw(); + drawContext::global()->draw(); } static void con_geometry_snap_cb(Fl_Widget *w, void *data) diff --git a/Fltk/extraDialogs.cpp b/Fltk/extraDialogs.cpp index 84ce2a8dac21b534beb02b606c3bca6e72fd1b37..7c934f5cfcc7c2576578e0edf32b6928c14a8be9 100644 --- a/Fltk/extraDialogs.cpp +++ b/Fltk/extraDialogs.cpp @@ -22,7 +22,7 @@ #include "OpenFile.h" #include "CreateFile.h" #include "Options.h" -#include "Draw.h" +#include "drawContext.h" #include "GModel.h" #include "Context.h" @@ -87,7 +87,7 @@ int arrow_editor(const char *title, double &a, double &b, double &c) static void persp_change_factor(Fl_Widget* w, void* data) { opt_general_clip_factor(0, GMSH_SET|GMSH_GUI, ((Fl_Slider*)w)->value()); - Draw(); + drawContext::global()->draw(); } class Release_Slider : public Fl_Slider { @@ -152,7 +152,7 @@ static void model_switch_cb(Fl_Widget* w, void *data) CTX::instance()->mesh.changed = ENT_ALL; FlGui::instance()->setGraphicTitle(GModel::current()->getFileName()); FlGui::instance()->resetVisibility(); - Draw(); + drawContext::global()->draw(); } int model_chooser() diff --git a/Fltk/fieldWindow.cpp b/Fltk/fieldWindow.cpp index 44e05b6244632e1fc1784125e22d1ee7f75e3bb3..a3c7a577651e28973adf9ffecdf7e985faa45a78 100644 --- a/Fltk/fieldWindow.cpp +++ b/Fltk/fieldWindow.cpp @@ -16,7 +16,7 @@ #include <FL/Fl_Value_Input.H> #include <FL/fl_draw.H> #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #include "fieldWindow.h" #include "paletteWindow.h" #include "fileDialogs.h" @@ -75,7 +75,7 @@ static void field_put_on_view_cb(Fl_Widget *w, void *data) else if(mb->value() - 1 < (int)PView::list.size()) field->putOnView(PView::list[mb->value() - 1]); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void field_select_file_cb(Fl_Widget *w, void *data) diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index 0b148c3aea8da6747ee84879eed932e24088a914..99cb0b09e951162f1e546351591ba2eacef25370 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -24,7 +24,6 @@ #include "FlGui.h" #include "CreateFile.h" #include "Options.h" -#include "Draw.h" #include "GModel.h" #include "Context.h" diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index f7f8909f1ce9ec4dfd956faa6c0242e0f4e95586..182e0d3d4478143ad3a1689539f4cbf19bfa7225 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -14,7 +14,6 @@ #include "messageWindow.h" #include "manipWindow.h" #include "extraDialogs.h" -#include "Draw.h" #include "PView.h" #include "PViewData.h" #include "OS.h" @@ -182,7 +181,7 @@ void status_xyz1p_cb(Fl_Widget *w, void *data) ctx->setQuaternionFromEulerAngles(); } } - Draw(); + drawContext::global()->draw(); FlGui::instance()->manip->update(); } @@ -204,7 +203,7 @@ void status_options_cb(Fl_Widget *w, void *data) else{ perspective_editor(); } - Draw(); + drawContext::global()->draw(); } else if(!strcmp(str, "S")){ // mouse selection if(CTX::instance()->mouseSelection){ @@ -250,7 +249,7 @@ void status_play_manual(int time, int step) opt_view_visible(i, GMSH_SET | GMSH_GUI, (i == view_in_cycle)); } } - Draw(); + drawContext::global()->draw(); busy = false; } @@ -288,7 +287,7 @@ static void status_rewind_cb(Fl_Widget *w, void *data) for(unsigned int i = 0; i < PView::list.size(); i++) opt_view_visible(i, GMSH_SET | GMSH_GUI, !i); } - Draw(); + drawContext::global()->draw(); } static void status_stepbackward_cb(Fl_Widget *w, void *data) diff --git a/Fltk/manipWindow.cpp b/Fltk/manipWindow.cpp index c87cd4f8e13fbb7c73ed068edfa65ff2d24b19b7..0656a7808b99906e61574653ffb23bbb1d8987fc 100644 --- a/Fltk/manipWindow.cpp +++ b/Fltk/manipWindow.cpp @@ -6,7 +6,6 @@ #include <FL/Fl_Box.H> #include <FL/Fl_Return_Button.H> #include "FlGui.h" -#include "Draw.h" #include "manipWindow.h" #include "paletteWindow.h" #include "graphicWindow.h" @@ -31,7 +30,7 @@ static void manip_update_cb(Fl_Widget *w, void *data) ctx->s[1] = FlGui::instance()->manip->value[7]->value(); ctx->s[2] = FlGui::instance()->manip->value[8]->value(); ctx->setQuaternionFromEulerAngles(); - Draw(); + drawContext::global()->draw(); } manipWindow::manipWindow(int deltaFontSize) diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index e3213d00d4c7c6e9ecbc70009f9cbd1bc37442f7..c85dc3d2cf2afa3e851f96c9286b28d532152665 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -11,7 +11,6 @@ #include "GmshConfig.h" #include "GmshMessage.h" #include "FlGui.h" -#include "Draw.h" #include "menuWindow.h" #include "mainWindow.h" #include "graphicWindow.h" @@ -71,7 +70,7 @@ static void file_new_cb(Fl_Widget *w, void *data) fprintf(fp, "// Gmsh project created on %s", ctime(&now)); fclose(fp); OpenProject(name); - Draw(); + drawContext::global()->draw(); } } @@ -121,7 +120,7 @@ static void file_open_cb(Fl_Widget *w, void *data) int n = PView::list.size(); if(file_chooser(0, 0, "Open", input_formats)) { OpenProject(file_chooser_get_name(1)); - Draw(); + drawContext::global()->draw(); } if(n != (int)PView::list.size()) FlGui::instance()->menu->setContext(menu_post, 0); @@ -134,7 +133,7 @@ static void file_merge_cb(Fl_Widget *w, void *data) if(f) { for(int i = 1; i <= f; i++) MergeFile(file_chooser_get_name(i)); - Draw(); + drawContext::global()->draw(); } if(n != (int)PView::list.size()) FlGui::instance()->menu->setContext(menu_post, 0); @@ -143,7 +142,7 @@ static void file_merge_cb(Fl_Widget *w, void *data) static void file_clear_cb(Fl_Widget *w, void *data) { ClearProject(); - Draw(); + drawContext::global()->draw(); } static void file_window_cb(Fl_Widget *w, void *data) @@ -338,7 +337,7 @@ static void file_rename_cb(Fl_Widget *w, void *data) rename(GModel::current()->getFileName().c_str(), name.c_str()); ClearProject(); OpenProject(name); - Draw(); + drawContext::global()->draw(); } } @@ -546,7 +545,7 @@ void geometry_reload_cb(Fl_Widget *w, void *data) std::string fileName = GModel::current()->getFileName(); ClearProject(); OpenProject(fileName); - Draw(); + drawContext::global()->draw(); } static void geometry_elementary_add_cb(Fl_Widget *w, void *data) @@ -557,7 +556,7 @@ static void geometry_elementary_add_cb(Fl_Widget *w, void *data) static void add_new_point() { opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); - Draw(); + drawContext::global()->draw(); FlGui::instance()->geoContext->show(1); @@ -576,7 +575,7 @@ static void add_new_point() FlGui::instance()->geoContext->input[4]->value(), FlGui::instance()->geoContext->input[5]->value()); FlGui::instance()->resetVisibility(); - Draw(); + drawContext::global()->draw(); } if(ib == 'q'){ for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) @@ -595,7 +594,7 @@ static void add_new_multiline(std::string type) { opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); opt_geometry_lines(0, GMSH_SET | GMSH_GUI, 1); - Draw(); + drawContext::global()->draw(); std::vector<int> p; while(1) { @@ -612,7 +611,7 @@ static void add_new_multiline(std::string type) FlGui::instance()->selectedVertices[i]->setSelection(1); p.push_back(FlGui::instance()->selectedVertices[i]->tag()); } - Draw(); + drawContext::global()->draw(); } if(ib == 'r') { Msg::Warning("Entity de-selection not supported yet during multi-line creation"); @@ -622,20 +621,20 @@ static void add_new_multiline(std::string type) add_multline(type, p, GModel::current()->getFileName()); FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); p.clear(); } if(ib == 'u') { if(p.size()){ GVertex *gv = GModel::current()->getVertexByTag(p.back()); if(gv) gv->setSelection(0); - Draw(); + drawContext::global()->draw(); p.pop_back(); } } if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); break; } } @@ -647,7 +646,7 @@ static void add_new_line() { opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); opt_geometry_lines(0, GMSH_SET | GMSH_GUI, 1); - Draw(); + drawContext::global()->draw(); std::vector<int> p; while(1) { @@ -660,7 +659,7 @@ static void add_new_line() char ib = FlGui::instance()->selectEntity(ENT_POINT); if(ib == 'l') { FlGui::instance()->selectedVertices[0]->setSelection(1); - Draw(); + drawContext::global()->draw(); p.push_back(FlGui::instance()->selectedVertices[0]->tag()); } if(ib == 'r') { @@ -670,20 +669,20 @@ static void add_new_line() if(p.size()){ GVertex *gv = GModel::current()->getVertexByTag(p.back()); if(gv) gv->setSelection(0); - Draw(); + drawContext::global()->draw(); p.pop_back(); } } if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); break; } if(p.size() == 2) { add_multline("Line", p, GModel::current()->getFileName()); FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); p.clear(); } } @@ -695,7 +694,7 @@ static void add_new_circle() { opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); opt_geometry_lines(0, GMSH_SET | GMSH_GUI, 1); - Draw(); + drawContext::global()->draw(); std::vector<int> p; while(1) { @@ -711,7 +710,7 @@ static void add_new_circle() char ib = FlGui::instance()->selectEntity(ENT_POINT); if(ib == 'l') { FlGui::instance()->selectedVertices[0]->setSelection(1); - Draw(); + drawContext::global()->draw(); p.push_back(FlGui::instance()->selectedVertices[0]->tag()); } if(ib == 'r') { @@ -721,20 +720,20 @@ static void add_new_circle() if(p.size()){ GVertex *gv = GModel::current()->getVertexByTag(p.back()); if(gv) gv->setSelection(0); - Draw(); + drawContext::global()->draw(); p.pop_back(); } } if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); break; } if(p.size() == 3) { add_circ(p[0], p[1], p[2], GModel::current()->getFileName()); // begin, center, end FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); p.clear(); } } @@ -746,7 +745,7 @@ static void add_new_ellipse() { opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); opt_geometry_lines(0, GMSH_SET | GMSH_GUI, 1); - Draw(); + drawContext::global()->draw(); std::vector<int> p; while(1) { @@ -765,7 +764,7 @@ static void add_new_ellipse() char ib = FlGui::instance()->selectEntity(ENT_POINT); if(ib == 'l') { FlGui::instance()->selectedVertices[0]->setSelection(1); - Draw(); + drawContext::global()->draw(); p.push_back(FlGui::instance()->selectedVertices[0]->tag()); } if(ib == 'r') { @@ -775,20 +774,20 @@ static void add_new_ellipse() if(p.size()){ GVertex *gv = GModel::current()->getVertexByTag(p.back()); if(gv) gv->setSelection(0); - Draw(); + drawContext::global()->draw(); p.pop_back(); } } if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); break; } if(p.size() == 4) { add_ell(p[0], p[1], p[2], p[3], GModel::current()->getFileName()); FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); p.clear(); } } @@ -821,7 +820,7 @@ static int select_contour(int type, int num, List_T * List) break; } - Draw(); + drawContext::global()->draw(); return k; } @@ -840,7 +839,7 @@ static void add_new_surface_volume(int mode) opt_geometry_lines(0, GMSH_SET | GMSH_GUI, 1); opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, 1); } - Draw(); + drawContext::global()->draw(); while(1) { List_Reset(List1); @@ -867,7 +866,7 @@ static void add_new_surface_volume(int mode) char ib = FlGui::instance()->selectEntity(type); if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); goto stopall; } if(ib == 'u') { @@ -883,7 +882,7 @@ static void add_new_surface_volume(int mode) if(gf) gf->setSelection(0); } List_Pop(List1); - Draw(); + drawContext::global()->draw(); } } if(ib == 'r') { @@ -914,12 +913,12 @@ static void add_new_surface_volume(int mode) ib = FlGui::instance()->selectEntity(type); if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); goto stopall; } if(ib == 'e') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); List_Reset(List1); break; } @@ -936,7 +935,7 @@ static void add_new_surface_volume(int mode) if(gf) gf->setSelection(0); } List_Pop(List1); - Draw(); + drawContext::global()->draw(); } } if(ib == 'l') { @@ -973,7 +972,7 @@ static void add_new_surface_volume(int mode) } FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); break; } } // if select_contour @@ -1023,7 +1022,7 @@ static void geometry_elementary_add_new_cb(Fl_Widget *w, void *data) static void split_selection() { opt_geometry_lines(0, GMSH_SET | GMSH_GUI, 1); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, "Select a line to split\n" "[Press 'q' to abort]"); GEdge* edge_to_split = 0; @@ -1043,7 +1042,7 @@ static void split_selection() Msg::StatusBar(3, false, "Select break points\n" "[Press 'e' to end selection or 'q' to abort]"); opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); - Draw(); + drawContext::global()->draw(); while(1){ char ib = FlGui::instance()->selectEntity(ENT_POINT); if(ib == 'q') @@ -1062,7 +1061,7 @@ static void split_selection() Msg::StatusBar(3, false, ""); FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); } static void action_point_line_surface_volume(int action, int mode, const char *what) @@ -1099,7 +1098,7 @@ static void action_point_line_surface_volume(int action, int mode, const char *w FlGui::instance()->meshContext->show(0); } - Draw(); + drawContext::global()->draw(); List_T *List1 = List_Create(5, 5, sizeof(int)); while(1) { @@ -1151,7 +1150,7 @@ static void action_point_line_surface_volume(int action, int mode, const char *w } break; } - Draw(); + drawContext::global()->draw(); } if(ib == 'r') { // we don't use List_Suppress in order to keep the original @@ -1192,7 +1191,7 @@ static void action_point_line_surface_volume(int action, int mode, const char *w } break; } - Draw(); + drawContext::global()->draw(); } if(ib == 'u') { if(List_Nbr(List1)) { @@ -1214,7 +1213,7 @@ static void action_point_line_surface_volume(int action, int mode, const char *w GRegion *gr = GModel::current()->getRegionByTag(num); if(gr) gr->setSelection(0); } - Draw(); + drawContext::global()->draw(); List_Pop(List1); } } @@ -1292,12 +1291,12 @@ static void action_point_line_surface_volume(int action, int mode, const char *w FlGui::instance()->resetVisibility(); GModel::current()->setSelection(0); if(action <= 6) SetBoundingBox(); - Draw(); + drawContext::global()->draw(); } } if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); break; } } @@ -1470,21 +1469,21 @@ static void mesh_define_cb(Fl_Widget *w, void *data) void mesh_1d_cb(Fl_Widget *w, void *data) { GModel::current()->mesh(1); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(2, false, " "); } void mesh_2d_cb(Fl_Widget *w, void *data) { GModel::current()->mesh(2); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(2, false, " "); } void mesh_3d_cb(Fl_Widget *w, void *data) { GModel::current()->mesh(3); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(2, false, " "); } @@ -1522,7 +1521,7 @@ static void mesh_delete_parts_cb(Fl_Widget *w, void *data) while(1) { CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); if(ele.size() || ent.size()) Msg::StatusBar(3, false, "Select %s\n" @@ -1612,7 +1611,7 @@ static void mesh_delete_parts_cb(Fl_Widget *w, void *data) CTX::instance()->mesh.changed = ENT_ALL; CTX::instance()->pickElements = 0; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -1620,7 +1619,7 @@ static void mesh_inspect_cb(Fl_Widget *w, void *data) { CTX::instance()->pickElements = 1; CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); while(1) { Msg::StatusBar(3, false, "Select element\n[Press 'q' to abort]"); @@ -1652,7 +1651,7 @@ static void mesh_inspect_cb(Fl_Widget *w, void *data) Msg::Direct(" Eta: %g", ele->etaShapeMeasure()); Msg::Direct(" Disto: %g", ele->distoShapeMeasure()); CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); FlGui::instance()->messages->show(); } } @@ -1664,7 +1663,7 @@ static void mesh_inspect_cb(Fl_Widget *w, void *data) CTX::instance()->pickElements = 0; CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -1676,7 +1675,7 @@ static void mesh_degree_cb(Fl_Widget *w, void *data) else SetOrder1(GModel::current()); CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(2, false, " "); } @@ -1690,7 +1689,7 @@ static void mesh_optimize_cb(Fl_Widget *w, void *data) OptimizeMesh(GModel::current()); CTX::instance()->lock = 0; CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(2, false, " "); } @@ -1698,7 +1697,7 @@ static void mesh_refine_cb(Fl_Widget *w, void *data) { RefineMesh(GModel::current(), CTX::instance()->mesh.secondOrderLinear); CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(2, false, " "); } @@ -1712,7 +1711,7 @@ static void mesh_optimize_netgen_cb(Fl_Widget *w, void *data) OptimizeMeshNetgen(GModel::current()); CTX::instance()->lock = 0; CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(2, false, " "); } @@ -1744,7 +1743,7 @@ static void add_transfinite(int dim) case 2: opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, 1); break; case 3: opt_geometry_volumes(0, GMSH_SET | GMSH_GUI, 1); break; } - Draw(); + drawContext::global()->draw(); std::vector<int> p; char ib; @@ -1782,7 +1781,7 @@ static void add_transfinite(int dim) FlGui::instance()->meshContext->input[1]->value()); } GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); p.clear(); } if(ib == 'u') { @@ -1790,14 +1789,14 @@ static void add_transfinite(int dim) if(p.size()){ GEdge *ge = GModel::current()->getEdgeByTag(p.back()); if(ge) ge->setSelection(0); - Draw(); + drawContext::global()->draw(); p.pop_back(); } } } if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); break; } if(ib == 'r') { @@ -1811,18 +1810,18 @@ static void add_transfinite(int dim) FlGui::instance()->selectedEdges[i]->setSelection(1); p.push_back(FlGui::instance()->selectedEdges[i]->tag()); } - Draw(); + drawContext::global()->draw(); break; case 2: case 3: if(dim == 2){ FlGui::instance()->selectedFaces[0]->setSelection(1); - Draw(); + drawContext::global()->draw(); p.push_back(FlGui::instance()->selectedFaces[0]->tag()); } else{ FlGui::instance()->selectedRegions[0]->setSelection(1); - Draw(); + drawContext::global()->draw(); p.push_back(FlGui::instance()->selectedRegions[0]->tag()); } while(1) { @@ -1836,14 +1835,14 @@ static void add_transfinite(int dim) ib = FlGui::instance()->selectEntity(ENT_POINT); if(ib == 'l') { FlGui::instance()->selectedVertices[0]->setSelection(1); - Draw(); + drawContext::global()->draw(); p.push_back(FlGui::instance()->selectedVertices[0]->tag()); } if(ib == 'u') { if(p.size() > 1){ GVertex *gv = GModel::current()->getVertexByTag(p.back()); if(gv) gv->setSelection(0); - Draw(); + drawContext::global()->draw(); p.pop_back(); } } @@ -1868,13 +1867,13 @@ static void add_transfinite(int dim) break; } GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); p.clear(); break; } if(ib == 'q') { GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); goto stopall; } } @@ -1909,7 +1908,7 @@ static void view_toggle_cb(Fl_Widget *w, void *data) int num = (int)(long)data; opt_view_visible(num, GMSH_SET, FlGui::instance()->menu->toggle[num]->value()); - Draw(); + drawContext::global()->draw(); } static void view_reload(int index) @@ -1946,14 +1945,14 @@ static void view_reload(int index) static void view_reload_cb(Fl_Widget *w, void *data) { view_reload((int)(long)data); - Draw(); + drawContext::global()->draw(); } static void view_reload_all_cb(Fl_Widget *w, void *data) { for(unsigned int i = 0; i < PView::list.size(); i++) view_reload(i); - Draw(); + drawContext::global()->draw(); } static void view_reload_visible_cb(Fl_Widget *w, void *data) @@ -1961,7 +1960,7 @@ static void view_reload_visible_cb(Fl_Widget *w, void *data) for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) view_reload(i); - Draw(); + drawContext::global()->draw(); } static void view_remove_other_cb(Fl_Widget *w, void *data) @@ -1970,7 +1969,7 @@ static void view_remove_other_cb(Fl_Widget *w, void *data) for(int i = PView::list.size() - 1; i >= 0; i--) if(i != (long)data) delete PView::list[i]; FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_remove_all_cb(Fl_Widget *w, void *data) @@ -1978,7 +1977,7 @@ static void view_remove_all_cb(Fl_Widget *w, void *data) if(PView::list.empty()) return; while(PView::list.size()) delete PView::list[0]; FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_remove_visible_cb(Fl_Widget *w, void *data) @@ -1987,7 +1986,7 @@ static void view_remove_visible_cb(Fl_Widget *w, void *data) for(int i = PView::list.size() - 1; i >= 0; i--) if(opt_view_visible(i, GMSH_GET, 0)) delete PView::list[i]; FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_remove_invisible_cb(Fl_Widget *w, void *data) @@ -1996,7 +1995,7 @@ static void view_remove_invisible_cb(Fl_Widget *w, void *data) for(int i = PView::list.size() - 1; i >= 0; i--) if(!opt_view_visible(i, GMSH_GET, 0)) delete PView::list[i]; FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_remove_empty_cb(Fl_Widget *w, void *data) @@ -2005,14 +2004,14 @@ static void view_remove_empty_cb(Fl_Widget *w, void *data) for(int i = PView::list.size() - 1; i >= 0; i--) if(PView::list[i]->getData()->empty()) delete PView::list[i]; FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_remove_cb(Fl_Widget *w, void *data) { delete PView::list[(int)(long)data]; FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_save_as(int index, const char *title, int format) @@ -2071,56 +2070,56 @@ static void view_alias_cb(Fl_Widget *w, void *data) { new PView(PView::list[(int)(long)data], false); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_alias_with_options_cb(Fl_Widget *w, void *data) { new PView(PView::list[(int)(long)data], true); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_combine_space_all_cb(Fl_Widget *w, void *data) { PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_combine_space_visible_cb(Fl_Widget *w, void *data) { PView::combine(false, 0, CTX::instance()->post.combineRemoveOrig); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_combine_space_by_name_cb(Fl_Widget *w, void *data) { PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_combine_time_all_cb(Fl_Widget *w, void *data) { PView::combine(true, 1, CTX::instance()->post.combineRemoveOrig); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_combine_time_visible_cb(Fl_Widget *w, void *data) { PView::combine(true, 0, CTX::instance()->post.combineRemoveOrig); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_combine_time_by_name_cb(Fl_Widget *w, void *data) { PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } static void view_all_visible_cb(Fl_Widget *w, void *data) @@ -2129,7 +2128,7 @@ static void view_all_visible_cb(Fl_Widget *w, void *data) opt_view_visible(i, GMSH_SET | GMSH_GUI, (long)data < 0 ? !opt_view_visible(i, GMSH_GET, 0) : (long)data > 0 ? 1 : 0); - Draw(); + drawContext::global()->draw(); } static void view_applybgmesh_cb(Fl_Widget *w, void *data) diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index 8bdcccf488ddedf2819a03df5282d0038d71175b..56e0a6a353d9369950469c0c973448d785422517 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -13,7 +13,6 @@ #include "GmshMessage.h" #include "GModel.h" #include "MElement.h" -#include "Draw.h" #include "Numeric.h" #include "FlGui.h" #include "VertexArray.h" @@ -35,7 +34,7 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl tmp.recenter(ctx); ctx->initPosition(); - Draw(); + drawContext::global()->draw(); FlGui::instance()->manip->update(); } @@ -64,22 +63,23 @@ void openglWindow::drawScreenMessage() return; glColor4ubv((GLubyte *) & CTX::instance()->color.text); - SetFont(CTX::instance()->glFontEnum, CTX::instance()->glFontSize); - double h = GetStringHeight(); + drawContext::global()->setFont(CTX::instance()->glFontEnum, + CTX::instance()->glFontSize); + double h = drawContext::global()->getStringHeight(); if(screenMessage[0].size()){ const char *txt = screenMessage[0].c_str(); - double w = GetStringWidth(txt); + double w = drawContext::global()->getStringWidth(txt); glRasterPos2d(_ctx->viewport[2] / 2. - w / 2., _ctx->viewport[3] - 1.2 * h); - DrawString(txt); + drawContext::global()->drawString(txt); } if(screenMessage[1].size()){ const char *txt = screenMessage[1].c_str(); - double w = GetStringWidth(txt); + double w = drawContext::global()->getStringWidth(txt); glRasterPos2d(_ctx->viewport[2] / 2. - w / 2., _ctx->viewport[3] - 2.4 * h); - DrawString(txt); + drawContext::global()->drawString(txt); } } diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 8d63ca6bfc77f075e9b80eb67272e5eb915e32d7..9931a1e7c003df6a96550a6ecfff9c2791c931c7 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -15,7 +15,7 @@ #include "paletteWindow.h" #include "menuWindow.h" #include "extraDialogs.h" -#include "Draw.h" +#include "drawContext.h" #include "Options.h" #include "Solvers.h" #include "GModel.h" @@ -113,7 +113,7 @@ static void color_cb(Fl_Widget *w, void *data) uchar b = CTX::instance()->unpackBlue(fct(0, GMSH_GET, 0)); if(fl_color_chooser("Color Chooser", r, g, b)) fct(0, GMSH_SET | GMSH_GUI, CTX::instance()->packColor(r, g, b, 255)); - Draw(); + drawContext::global()->draw(); } static void view_color_cb(Fl_Widget *w, void *data) @@ -129,7 +129,7 @@ static void view_color_cb(Fl_Widget *w, void *data) if(fl_color_chooser("Color Chooser", r, g, b)) fct(FlGui::instance()->options->view.index, GMSH_SET | GMSH_GUI, CTX::instance()->packColor(r, g, b, 255)); - Draw(); + drawContext::global()->draw(); } void options_cb(Fl_Widget *w, void *data) @@ -159,7 +159,7 @@ static void options_restore_defaults_cb(Fl_Widget *w, void *data) InitOptionsGUI(0); if(FlGui::instance()->menu->module->value() == 3) // hack to refresh the buttons FlGui::instance()->menu->setContext(menu_post, 0); - Draw(); + drawContext::global()->draw(); } void general_options_cb(Fl_Widget *w, void *data) @@ -171,7 +171,7 @@ static void general_options_color_scheme_cb(Fl_Widget *w, void *data) { opt_general_color_scheme (0, GMSH_SET, FlGui::instance()->options->general.choice[3]->value()); - Draw(); + drawContext::global()->draw(); } static void general_options_rotation_center_select_cb(Fl_Widget *w, void *data) @@ -199,7 +199,7 @@ static void general_options_rotation_center_select_cb(Fl_Widget *w, void *data) opt_general_rotation_center2(0, GMSH_SET|GMSH_GUI, pc.z()); } GModel::current()->setSelection(0); - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -308,7 +308,7 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; - Draw(); + drawContext::global()->draw(); CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1; CTX::instance()->drawRotationCenter = 0; } @@ -322,7 +322,7 @@ static void general_arrow_param_cb(Fl_Widget *w, void *data) opt_general_arrow_head_radius(0, GMSH_SET, a); opt_general_arrow_stem_length(0, GMSH_SET, b); opt_general_arrow_stem_radius(0, GMSH_SET, c); - Draw(); + drawContext::global()->draw(); } } @@ -380,7 +380,7 @@ static void geometry_options_ok_cb(Fl_Widget *w, void *data) if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; - Draw(); + drawContext::global()->draw(); CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1; } @@ -454,7 +454,7 @@ static void mesh_options_ok_cb(Fl_Widget *w, void *data) if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; - Draw(); + drawContext::global()->draw(); CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1; } @@ -477,7 +477,7 @@ static void solver_options_ok_cb(Fl_Widget *w, void *data) if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; - Draw(); + drawContext::global()->draw(); CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1; } @@ -501,7 +501,7 @@ static void post_options_ok_cb(Fl_Widget *w, void *data) if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; - Draw(); + drawContext::global()->draw(); CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1; } @@ -528,7 +528,7 @@ static void view_options_timestep_cb(Fl_Widget *w, void *data) opt_view_timestep(i, GMSH_GET, 0) + 1); } } - Draw(); + drawContext::global()->draw(); } static void view_options_ok_cb(Fl_Widget *w, void *data) @@ -1111,7 +1111,7 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; - Draw(); + drawContext::global()->draw(); CTX::instance()->post.draw = CTX::instance()->mesh.draw = 1; } diff --git a/Fltk/partitionDialog.cpp b/Fltk/partitionDialog.cpp index baa981a977a7580008c82594fbd081061641f735..ce9b72c3b3926c2f98a0770eb5a4c7a50c13bc59 100644 --- a/Fltk/partitionDialog.cpp +++ b/Fltk/partitionDialog.cpp @@ -24,7 +24,7 @@ #include "FlGui.h" #include "paletteWindow.h" #include "GModel.h" -#include "Draw.h" +#include "drawContext.h" #include "Options.h" #include "meshPartition.h" #include "Context.h" @@ -323,7 +323,7 @@ void partition_partition_cb(Fl_Widget *widget, void *data) opt_mesh_zone_definition(0, GMSH_SET, 1.); // Define zone by partition opt_mesh_color_carousel(0, GMSH_SET | GMSH_GUI, 3.); CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); } } diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp index 0c0a9c059618bf600dd5d0b0e80e65ea780a12b6..ddb50b8f1fccf7cc2332a61cef54f606b5150ec2 100644 --- a/Fltk/pluginWindow.cpp +++ b/Fltk/pluginWindow.cpp @@ -12,7 +12,7 @@ #include <FL/Fl_Tabs.H> #include <FL/Fl_Scroll.H> #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #include "pluginWindow.h" #include "paletteWindow.h" #include "PView.h" @@ -143,7 +143,7 @@ static void plugin_run_cb(Fl_Widget *w, void *data) FlGui::instance()->updateViews(); GMSH_Plugin::draw = 0; - Draw(); + drawContext::global()->draw(); } static void plugin_create_new_view_cb(Fl_Widget *w, void *data) @@ -164,7 +164,7 @@ static void plugin_create_new_view_cb(Fl_Widget *w, void *data) PView *view = new PView("New view", "NodeData", GModel::current(), d); view->setChanged(true); FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, diff --git a/Fltk/projectionEditor.cpp b/Fltk/projectionEditor.cpp index 1f450c11bb0a4f0d6459c54b5fb1dc031d9bd5b3..aa749105ea7ade9fd4daac374b450053347dd02d 100644 --- a/Fltk/projectionEditor.cpp +++ b/Fltk/projectionEditor.cpp @@ -14,7 +14,7 @@ #include "fileDialogs.h" #include "GModelIO_Fourier.h" #include "MElement.h" -#include "Draw.h" +#include "drawContext.h" #include "Options.h" #include "StringUtils.h" #include "fourierFace.h" @@ -160,7 +160,7 @@ static void update_cb(Fl_Widget *w, void *data) e->uv()->set(u, v, dist, f); } - Draw(); + drawContext::global()->draw(); } static void browse_cb(Fl_Widget *w, void *data) @@ -278,7 +278,7 @@ static void select_cb(Fl_Widget *w, void *data) while(1) { CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); if(ele.size() || ent.size()) Msg::StatusBar(3, false, "Select %s\n[Press 'e' to end selection, 'u' to undo" @@ -352,7 +352,7 @@ static void select_cb(Fl_Widget *w, void *data) CTX::instance()->mesh.changed = ENT_ALL; CTX::instance()->pickElements = 0; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -411,7 +411,7 @@ static void proj_hide_cb(Fl_Widget *w, void *data) { CTX::instance()->hideUnselected = !CTX::instance()->hideUnselected; CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); } static void save_selection_cb(Fl_Widget *w, void *data) @@ -612,7 +612,7 @@ static void compute_cb(Fl_Widget *w, void *data) } printf("nPatches = %d\n",m->getFMInternals()->current()->GetGroup(0)-> GetBlendGroup()->GetNumPatches()); - Draw(); + drawContext::global()->draw(); } static void delete_fourier(GFace *gf) @@ -702,7 +702,7 @@ static void action_cb(Fl_Widget *w, void *data) } } - Draw(); + drawContext::global()->draw(); } uvPlot::uvPlot(int x, int y, int w, int h, const char *l) diff --git a/Fltk/statisticsWindow.cpp b/Fltk/statisticsWindow.cpp index c6a19d692b9f95a6c8dfe7b33744d3665cf02654..2b0fafc70b1d997f3d297c18617501c6559c38b4 100644 --- a/Fltk/statisticsWindow.cpp +++ b/Fltk/statisticsWindow.cpp @@ -7,7 +7,7 @@ #include <FL/Fl_Box.H> #include <FL/Fl_Return_Button.H> #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #include "statisticsWindow.h" #include "paletteWindow.h" #include "GModel.h" @@ -71,7 +71,7 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data) } FlGui::instance()->updateViews(); - Draw(); + drawContext::global()->draw(); } statisticsWindow::statisticsWindow(int deltaFontSize) diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp index b1cdd652ab77dc2ce2567725a39b1741f932e769..1d05f0d16996367be5f70f565a4b96d17e04c78a 100644 --- a/Fltk/visibilityWindow.cpp +++ b/Fltk/visibilityWindow.cpp @@ -13,7 +13,7 @@ #include <FL/Fl_Return_Button.H> #include "GmshConfig.h" #include "FlGui.h" -#include "Draw.h" +#include "drawContext.h" #include "visibilityWindow.h" #include "paletteWindow.h" #include "contextWindow.h" @@ -335,7 +335,7 @@ static void visibility_browser_apply_cb(Fl_Widget *w, void *data) for(int i = 0; i < VisibilityList::instance()->getNumEntities(); i++) if(VisibilityList::instance()->getVisibility(i)) FlGui::instance()->visibility->browser->select(i + 1); - Draw(); + drawContext::global()->draw(); } } @@ -676,7 +676,7 @@ static void visibility_tree_apply_cb(Fl_Widget *w, void *data) _recur_update_selected(n); } FlGui::instance()->visibility->tree->redraw(); - Draw(); + drawContext::global()->draw(); } class treeBrowser : public Fl_Tree{ @@ -923,7 +923,7 @@ static void visibility_number_cb(Fl_Widget *w, void *data) int pos = FlGui::instance()->visibility->browser->position(); visibility_cb(NULL, (void*)"redraw_only"); FlGui::instance()->visibility->browser->position(pos); - Draw(); + drawContext::global()->draw(); } static void visibility_interactive_cb(Fl_Widget *w, void *data) @@ -999,7 +999,7 @@ static void visibility_interactive_cb(Fl_Widget *w, void *data) for(int i = 1; i <= 5; i++) // elements, points, lines, surfaces, volumes _set_visibility_by_number(i, -1, 1, false); CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); return; } else @@ -1014,7 +1014,7 @@ static void visibility_interactive_cb(Fl_Widget *w, void *data) while(1) { if(what == ENT_ALL) CTX::instance()->mesh.changed = ENT_ALL; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, "Select %s\n[Press %s'q' to abort]", str.c_str(), mode ? "" : "'u' to undo or "); @@ -1038,7 +1038,7 @@ static void visibility_interactive_cb(Fl_Widget *w, void *data) CTX::instance()->mesh.changed = ENT_ALL; CTX::instance()->pickElements = 0; - Draw(); + drawContext::global()->draw(); Msg::StatusBar(3, false, ""); } @@ -1071,7 +1071,7 @@ static void visibility_per_window_cb(Fl_Widget *w, void *data) for(int i = 0; i < FlGui::instance()->visibility->per_window->size(); i++) FlGui::instance()->visibility->per_window->select(i + 1); } - Draw(); + drawContext::global()->draw(); } visibilityWindow::visibilityWindow(int deltaFontSize) diff --git a/Graphics/Draw.h b/Graphics/Draw.h deleted file mode 100644 index 3089d981bc0cee9f35b7fb3b16bc4c71512b2aa0..0000000000000000000000000000000000000000 --- a/Graphics/Draw.h +++ /dev/null @@ -1,25 +0,0 @@ -// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#ifndef _DRAW_H_ -#define _DRAW_H_ - -// Widget-toolkit-dependent drawing functions (need to be redefined -// for each widget toolkit: FLTK, Qt, etc.) - -void Draw(); -void DrawCurrentOpenglWindow(bool make_current); -int GetFontIndex(const char *fontname); -int GetFontEnum(int index); -const char *GetFontName(int index); -int GetFontAlign(const char *alignstr); -int GetFontSize(); -void SetFont(int fontid, int fontsize); -double GetStringWidth(const char *str); -int GetStringHeight(); -int GetStringDescent(); -void DrawString(const char *str); - -#endif diff --git a/Graphics/PixelBuffer.h b/Graphics/PixelBuffer.h index 4a72a18085273387ee149722a688676666eef6b3..fe4390aff2d8a77aabe2d8e09545333646612a18 100644 --- a/Graphics/PixelBuffer.h +++ b/Graphics/PixelBuffer.h @@ -9,7 +9,7 @@ #include <string.h> #include "GmshConfig.h" #include "GmshMessage.h" -#include "Draw.h" +#include "drawContext.h" #if defined(WIN32) #include <windows.h> @@ -96,7 +96,7 @@ class PixelBuffer{ void fill(int offscreen) { if(!offscreen){ - DrawCurrentOpenglWindow(true); + drawContext::global()->drawCurrentOpenglWindow(true); glFinish(); glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -116,7 +116,7 @@ class PixelBuffer{ if(!OSMesaMakeCurrent(ctx, (void*)_pixels, GL_UNSIGNED_BYTE, _width, _height)){ Msg::Error("OSMesaMakeCurrent failed"); } - DrawCurrentOpenglWindow(false); + drawContext::global()->drawCurrentOpenglWindow(false); glFinish(); OSMesaDestroyContext(ctx); #else diff --git a/Graphics/drawAxes.cpp b/Graphics/drawAxes.cpp index a521ac47977dd53be0a76e2d598cee188f821357..6eeb80449013607fd2d8b086535f95eedafe61be 100644 --- a/Graphics/drawAxes.cpp +++ b/Graphics/drawAxes.cpp @@ -6,7 +6,6 @@ #include <string> #include <string.h> #include "drawContext.h" -#include "Draw.h" #include "GModel.h" #include "Context.h" #include "Numeric.h" @@ -87,15 +86,16 @@ static int drawTics(drawContext *ctx, int comp, int n, std::string &format, double winp[3], winr[3]; ctx->world2Viewport(p, winp); ctx->world2Viewport(r, winr); - SetFont(CTX::instance()->glFontEnum, CTX::instance()->glFontSize); + drawContext::global()->setFont(CTX::instance()->glFontEnum, + CTX::instance()->glFontSize); if(fabs(winr[0] - winp[0]) < 2.) // center align - winr[0] -= GetStringWidth(str) / 2.; + winr[0] -= drawContext::global()->getStringWidth(str) / 2.; else if(winr[0] < winp[0]) // right align - winr[0] -= GetStringWidth(str); + winr[0] -= drawContext::global()->getStringWidth(str); if(fabs(winr[1] - winp[1]) < 2.) // center align - winr[1] -= GetStringHeight() / 3.; + winr[1] -= drawContext::global()->getStringHeight() / 3.; else if(winr[1] < winp[1]) // top align - winr[1] -= GetStringHeight(); + winr[1] -= drawContext::global()->getStringHeight(); ctx->viewport2World(winr, r); glRasterPos3d(r[0], r[1], r[2]); ctx->drawString(str); diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp index 293067607d61038facc83d6e7fc69312a5457f65..8e9eeaeff0f1a562a10d4dcb8bcac0e401ca385c 100644 --- a/Graphics/drawContext.cpp +++ b/Graphics/drawContext.cpp @@ -20,6 +20,8 @@ #include <FL/Fl_PNG_Image.H> #endif +drawContextGlobal *drawContext::_global = 0; + drawContext::drawContext(drawTransform *transform) : _transform(transform) { @@ -52,6 +54,12 @@ drawContext::~drawContext() if(_displayLists) glDeleteLists(_displayLists, 2); } +drawContextGlobal *drawContext::global() +{ + if(!_global) _global = new drawContextGlobal(); // create dummy default + return _global; +} + void drawContext::createQuadricsAndDisplayLists() { if(!_quadric) _quadric = gluNewQuadric(); diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h index 50a7d6a1d1916a64511a23d865aa180fa1001998..8322755e0584ebd1cc480ac3ab940a2aa85405e6 100644 --- a/Graphics/drawContext.h +++ b/Graphics/drawContext.h @@ -72,8 +72,27 @@ class drawTransformScaled : public drawTransform { } }; +// global drawing functions, which need to be redefined for each +// widget toolkit (FLTK, Qt, etc.) +class drawContextGlobal { + public: + virtual void draw(){} + virtual void drawCurrentOpenglWindow(bool make_current){} + virtual int getFontIndex(const char *fontname){ return 0; } + virtual int getFontEnum(int index){ return 0; } + virtual const char *getFontName(int index){ return "Helvetica"; } + virtual int getFontAlign(const char *alignstr){ return 0; } + virtual int getFontSize(){ return 12; } + virtual void setFont(int fontid, int fontsize){} + virtual double getStringWidth(const char *str){ return 1.; } + virtual int getStringHeight(){ return 12; } + virtual int getStringDescent(){ return 3; } + virtual void drawString(const char *str){} +}; + class drawContext { private: + static drawContextGlobal *_global; drawTransform *_transform; GLUquadricObj *_quadric; GLuint _displayLists; @@ -99,6 +118,8 @@ class drawContext { public: drawContext(drawTransform *transform=0); ~drawContext(); + static void setGlobal(drawContextGlobal *global){ _global = global; } + static drawContextGlobal *global(); void setTransform(drawTransform *transform){ _transform = transform; } drawTransform *getTransform(){ return _transform; } void transform(double &x, double &y, double &z) diff --git a/Graphics/drawGlyph.cpp b/Graphics/drawGlyph.cpp index 9042c0e2779019988f83e5d53d84cbe2d2e4f7ee..d0dabf889dfe9acf19a729985a0b504e9d9a2a20 100644 --- a/Graphics/drawGlyph.cpp +++ b/Graphics/drawGlyph.cpp @@ -5,7 +5,6 @@ #include <string.h> #include "drawContext.h" -#include "Draw.h" #include "GmshDefines.h" #include "Numeric.h" #include "StringUtils.h" @@ -27,9 +26,9 @@ void drawContext::drawString(std::string s, std::string &font_name, int font_enu GLdouble pos[4]; glGetDoublev(GL_CURRENT_RASTER_POSITION, pos); double x[3], w[3] = {pos[0], pos[1], pos[2]}; - SetFont(font_enum, font_size); - double width = GetStringWidth(s.c_str()); - double height = GetStringHeight(); + drawContext::global()->setFont(font_enum, font_size); + double width = drawContext::global()->getStringWidth(s.c_str()); + double height = drawContext::global()->getStringHeight(); switch(align){ case 1: w[0] -= width/2.; break; // bottom center case 2: w[0] -= width; break; // bottom right @@ -47,8 +46,8 @@ void drawContext::drawString(std::string s, std::string &font_name, int font_enu } if(!CTX::instance()->printing){ - SetFont(font_enum, font_size); - DrawString(s.c_str()); + drawContext::global()->setFont(font_enum, font_size); + drawContext::global()->drawString(s.c_str()); } else{ if(CTX::instance()->print.format == FORMAT_TEX){ @@ -76,8 +75,8 @@ void drawContext::drawString(std::string s, std::string &font_name, int font_enu gl2psText(s.c_str(), font_name.c_str(), font_size); } else{ - SetFont(font_enum, font_size); - DrawString(s.c_str()); + drawContext::global()->setFont(font_enum, font_size); + drawContext::global()->drawString(s.c_str()); } } } @@ -111,8 +110,8 @@ void drawContext::drawString(std::string s, double style) int size = (bits & 0xff); int font = (bits>>8 & 0xff); int align = (bits>>16 & 0xff); - int font_enum = GetFontEnum(font); - std::string font_name = GetFontName(font); + int font_enum = drawContext::global()->getFontEnum(font); + std::string font_name = drawContext::global()->getFontName(font); if(!size) size = CTX::instance()->glFontSize; drawString(s, font_name, font_enum, size, align); } diff --git a/Graphics/drawGraph2d.cpp b/Graphics/drawGraph2d.cpp index aa8b0850438dce45ec6184525e4f5fc5473a1a0f..6de51e9dc90f651d6f95b3a3475eb4cb522ad9d1 100644 --- a/Graphics/drawGraph2d.cpp +++ b/Graphics/drawGraph2d.cpp @@ -4,7 +4,6 @@ // bugs and problems to <gmsh@geuz.org>. #include "drawContext.h" -#include "Draw.h" #include "PView.h" #include "PViewOptions.h" #include "PViewData.h" @@ -150,8 +149,12 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop, if(!opt->axes) return; char label[1024]; - double font_h = GetStringHeight() ? GetStringHeight() : 1; // total font height - double font_a = font_h - GetStringDescent(); // height above ref. point + + // total font height + double font_h = drawContext::global()->getStringHeight() ? + drawContext::global()->getStringHeight() : 1; + // height above ref. point + double font_a = font_h - drawContext::global()->getStringDescent(); const double tic = 5.; @@ -246,8 +249,8 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop, int nb = opt->axesTics[0]; if(opt->axes){ sprintf(label, opt->axesFormat[0].c_str(), - M_PI * 1.e-4); - if((nb - 1) * GetStringWidth(label) > width) - nb = (int)(width / GetStringWidth(label)) + 1; + if((nb - 1) * drawContext::global()->getStringWidth(label) > width) + nb = (int)(width / drawContext::global()->getStringWidth(label)) + 1; } if(nb == 1) nb++; @@ -418,13 +421,14 @@ void drawContext::drawGraph2d() } if(graphs.empty()) return; - SetFont(CTX::instance()->glFontEnum, CTX::instance()->glFontSize); - double xsep = 0., ysep = 5 * GetStringHeight(); + drawContext::global()->setFont(CTX::instance()->glFontEnum, + CTX::instance()->glFontSize); + double xsep = 0., ysep = 5 * drawContext::global()->getStringHeight(); char label[1024]; for(unsigned int i = 0; i < graphs.size(); i++){ PViewOptions *opt = graphs[i]->getOptions(); sprintf(label, opt->format.c_str(), -M_PI * 1.e-4); - xsep = std::max(xsep, GetStringWidth(label)); + xsep = std::max(xsep, drawContext::global()->getStringWidth(label)); } for(unsigned int i = 0; i < graphs.size(); i++){ diff --git a/Graphics/drawScales.cpp b/Graphics/drawScales.cpp index c4cc7baff8855816371cf4eb075be562f6ced53d..142c36c455761a011423588ce49f5bdabea1ef0c 100644 --- a/Graphics/drawScales.cpp +++ b/Graphics/drawScales.cpp @@ -4,7 +4,6 @@ // bugs and problems to <gmsh@geuz.org>. #include "drawContext.h" -#include "Draw.h" #include "PView.h" #include "PViewOptions.h" #include "PViewData.h" @@ -89,13 +88,15 @@ static void drawScaleValues(drawContext *ctx, PView *p, double xmin, double ymin if(!opt->nbIso) return; - SetFont(CTX::instance()->glFontEnum, CTX::instance()->glFontSize); - double font_h = GetStringHeight(); // total font height - double font_a = GetStringHeight() - GetStringDescent(); // height above ref pt + drawContext::global()->setFont(CTX::instance()->glFontEnum, + CTX::instance()->glFontSize); + double font_h = drawContext::global()->getStringHeight(); // total font height + double font_a = drawContext::global()->getStringHeight() - + drawContext::global()->getStringDescent(); // height above ref pt char label[1024]; sprintf(label, opt->format.c_str(), -M_PI * 1.e-4); - double maxw = GetStringWidth(label); + double maxw = drawContext::global()->getStringWidth(label); int nbv = opt->nbIso; double f = (opt->intervalsType == PViewOptions::Discrete || @@ -164,8 +165,9 @@ static void drawScaleLabel(drawContext *ctx, PView *p, double xmin, double ymin, else data = p->getData(); - SetFont(CTX::instance()->glFontEnum, CTX::instance()->glFontSize); - double font_h = GetStringHeight(); + drawContext::global()->setFont(CTX::instance()->glFontEnum, + CTX::instance()->glFontSize); + double font_h = drawContext::global()->getStringHeight(); char label[1024]; @@ -233,13 +235,14 @@ void drawContext::drawScales() } if(scales.empty()) return; - SetFont(CTX::instance()->glFontEnum, CTX::instance()->glFontSize); + drawContext::global()->setFont(CTX::instance()->glFontEnum, + CTX::instance()->glFontSize); char label[1024]; double maxw = 0.; for(unsigned int i = 0; i < scales.size(); i++) { PViewOptions *opt = scales[i]->getOptions(); sprintf(label, opt->format.c_str(), -M_PI * 1.e-4); - maxw = std::max(maxw, GetStringWidth(label)); + maxw = std::max(maxw, drawContext::global()->getStringWidth(label)); } const double tic = 10., bar_size = 16.; @@ -273,13 +276,14 @@ void drawContext::drawScales() double h = bar_size; double x = xc - (i % 2 ? -xsep / 1.5 : w + xsep / 1.5); double y = viewport[1] + ysep + - (i / 2) * (bar_size + tic + 2 * GetStringHeight() + ysep); + (i / 2) * (bar_size + tic + + 2 * drawContext::global()->getStringHeight() + ysep); drawScale(this, p, x, y, w, h, tic, 1); } } else{ double xsep = 20.; - double dy = 2. * GetStringHeight(); + double dy = 2. * drawContext::global()->getStringHeight(); if(scales.size() == 1){ double ysep = (viewport[3] - viewport[1]) / 6.; double w = bar_size, h = viewport[3] - viewport[1] - 2 * ysep - dy; @@ -297,7 +301,7 @@ void drawContext::drawScales() // compute width width_prev = width; sprintf(label, opt->format.c_str(), -M_PI * 1.e-4); - width = bar_size + tic + GetStringWidth(label); + width = bar_size + tic + drawContext::global()->getStringWidth(label); if(opt->showTime){ char tmp[256]; sprintf(tmp, opt->format.c_str(), data->getTime(opt->timeStep)); @@ -305,7 +309,7 @@ void drawContext::drawScales() } else sprintf(label, "%s", data->getName().c_str()); - width = std::max(width, GetStringWidth(label)); + width = std::max(width, drawContext::global()->getStringWidth(label)); if(i % 2) width_total += std::max(bar_size + width, bar_size + width_prev); } } diff --git a/Parser/Gmsh.l b/Parser/Gmsh.l index 2d033793ff666437fe80a686055b4e674e39dac4..29e338b729c35f809906bf06e89487da796a7697 100644 --- a/Parser/Gmsh.l +++ b/Parser/Gmsh.l @@ -146,7 +146,7 @@ If return tIf; Intersect return tIntersect; INTERPOLATION_SCHEME return tInterpolationScheme; -Knots return tKnots; +Knots return tNurbsKnots; Length return tLength; Line return tLine; @@ -162,7 +162,7 @@ MPI_Size return tMPI_Size; Nurbs return tNurbs; -Order return tOrder; +Order return tNurbsOrder; OCCShape return tOCCShape; Physical return tPhysical; diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 303bc545d95e1583c3a6a5940bfeee55d9a26798..4ca57325fcb395cc180d8e1350f7eea736a92987 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -164,8 +164,8 @@ tBSpline = 345, tBezier = 346, tNurbs = 347, - tOrder = 348, - tKnots = 349, + tNurbsOrder = 348, + tNurbsKnots = 349, tColor = 350, tColorTable = 351, tFor = 352, @@ -290,8 +290,8 @@ #define tBSpline 345 #define tBezier 346 #define tNurbs 347 -#define tOrder 348 -#define tKnots 349 +#define tNurbsOrder 348 +#define tNurbsKnots 349 #define tColor 350 #define tColorTable 351 #define tFor 352 @@ -350,7 +350,6 @@ #include "Geo.h" #include "GeoInterpolation.h" #include "Generator.h" -#include "Draw.h" #include "Options.h" #include "Colors.h" #include "Parser.h" @@ -364,12 +363,17 @@ #include "gmshLevelset.h" #include "Field.h" #include "BackgroundMesh.h" + #if !defined(HAVE_NO_POST) #include "PView.h" #include "PViewDataList.h" #include "PluginManager.h" #endif +#if defined(HAVE_FLTK) +#include "drawContext.h" +#endif + // Global parser variables std::string gmsh_yyname; int gmsh_yyerrorstate = 0; @@ -422,7 +426,7 @@ void FixRelativePath(const char *in, char *out); #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 74 "Gmsh.y" +#line 78 "Gmsh.y" { char *c; int i; @@ -433,8 +437,8 @@ typedef union YYSTYPE List_T *l; } /* Line 193 of yacc.c. */ -#line 437 "Gmsh.tab.cpp" - YYSTYPE; +#line 441 "Gmsh.tab.cpp" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -446,7 +450,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 450 "Gmsh.tab.cpp" +#line 454 "Gmsh.tab.cpp" #ifdef short # undef short @@ -578,7 +582,7 @@ YYID (i) # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 @@ -604,7 +608,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -629,13 +633,13 @@ union yyalloc # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -645,15 +649,15 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ while (YYID (0)) #endif @@ -676,7 +680,7 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 380 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -995,44 +999,44 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 142, 142, 143, 148, 150, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 172, 176, 183, 188, 203, 216, 245, 259, 270, - 285, 290, 291, 292, 293, 294, 298, 300, 305, 307, - 313, 417, 312, 435, 442, 453, 452, 470, 477, 488, - 487, 504, 521, 544, 543, 557, 558, 559, 560, 561, - 565, 566, 573, 595, 622, 662, 672, 680, 688, 700, - 709, 715, 724, 742, 760, 769, 781, 786, 794, 814, - 837, 844, 850, 870, 891, 917, 929, 946, 950, 961, - 964, 977, 980, 990, 1014, 1013, 1033, 1055, 1073, 1095, - 1113, 1143, 1173, 1191, 1209, 1235, 1253, 1252, 1275, 1293, - 1332, 1338, 1344, 1351, 1376, 1401, 1418, 1417, 1437, 1454, - 1482, 1499, 1519, 1537, 1555, 1570, 1569, 1595, 1600, 1605, - 1610, 1615, 1635, 1641, 1652, 1653, 1658, 1661, 1665, 1688, - 1711, 1734, 1762, 1783, 1804, 1826, 1846, 1940, 1959, 1973, - 2082, 2091, 2095, 2110, 2137, 2154, 2168, 2174, 2180, 2189, - 2203, 2251, 2269, 2284, 2303, 2315, 2339, 2343, 2350, 2356, - 2361, 2367, 2376, 2393, 2410, 2429, 2448, 2476, 2484, 2490, - 2497, 2501, 2510, 2518, 2526, 2535, 2534, 2547, 2546, 2559, - 2558, 2571, 2570, 2583, 2590, 2597, 2604, 2611, 2618, 2625, - 2632, 2639, 2647, 2646, 2658, 2657, 2669, 2668, 2680, 2679, - 2691, 2690, 2702, 2701, 2713, 2712, 2724, 2723, 2735, 2734, - 2749, 2752, 2758, 2767, 2787, 2810, 2814, 2838, 2841, 2857, - 2860, 2873, 2876, 2882, 2885, 2892, 2948, 3018, 3023, 3090, - 3133, 3159, 3182, 3205, 3208, 3217, 3221, 3237, 3238, 3239, - 3240, 3241, 3242, 3243, 3244, 3245, 3252, 3253, 3254, 3255, - 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, - 3266, 3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, - 3276, 3277, 3278, 3279, 3280, 3281, 3282, 3283, 3285, 3286, - 3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, - 3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3314, - 3315, 3316, 3317, 3318, 3319, 3320, 3324, 3337, 3349, 3364, - 3374, 3384, 3402, 3407, 3412, 3422, 3432, 3440, 3444, 3448, - 3452, 3456, 3463, 3467, 3471, 3475, 3482, 3487, 3494, 3499, - 3503, 3508, 3512, 3520, 3531, 3535, 3547, 3555, 3563, 3570, - 3581, 3601, 3611, 3621, 3631, 3651, 3656, 3660, 3664, 3676, - 3680, 3692, 3699, 3709, 3713, 3728, 3733, 3740, 3744, 3757, - 3765, 3776, 3780, 3788, 3796, 3810, 3824, 3828 + 0, 146, 146, 147, 152, 154, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 176, 180, 187, 192, 207, 220, 249, 263, 274, + 289, 294, 295, 296, 297, 298, 302, 304, 309, 311, + 317, 421, 316, 439, 446, 457, 456, 474, 481, 492, + 491, 508, 525, 548, 547, 561, 562, 563, 564, 565, + 569, 570, 577, 599, 626, 666, 676, 684, 692, 704, + 713, 719, 728, 746, 764, 773, 785, 790, 798, 818, + 841, 848, 854, 874, 895, 921, 933, 950, 954, 965, + 968, 981, 984, 994, 1018, 1017, 1037, 1059, 1077, 1099, + 1117, 1147, 1177, 1195, 1213, 1239, 1257, 1256, 1279, 1297, + 1336, 1342, 1348, 1355, 1380, 1405, 1422, 1421, 1441, 1458, + 1486, 1503, 1523, 1541, 1559, 1574, 1573, 1599, 1604, 1609, + 1614, 1619, 1639, 1645, 1656, 1657, 1662, 1665, 1669, 1692, + 1715, 1738, 1766, 1787, 1808, 1830, 1850, 1944, 1963, 1977, + 2086, 2095, 2099, 2114, 2141, 2158, 2172, 2178, 2184, 2193, + 2207, 2255, 2273, 2288, 2307, 2319, 2343, 2347, 2354, 2360, + 2365, 2371, 2380, 2397, 2414, 2433, 2452, 2480, 2488, 2494, + 2501, 2505, 2514, 2522, 2530, 2539, 2538, 2551, 2550, 2563, + 2562, 2575, 2574, 2587, 2594, 2601, 2608, 2615, 2622, 2629, + 2636, 2643, 2651, 2650, 2662, 2661, 2673, 2672, 2684, 2683, + 2695, 2694, 2706, 2705, 2717, 2716, 2728, 2727, 2739, 2738, + 2753, 2756, 2762, 2771, 2791, 2814, 2818, 2842, 2845, 2861, + 2864, 2877, 2880, 2886, 2889, 2896, 2952, 3022, 3027, 3094, + 3137, 3163, 3186, 3209, 3212, 3221, 3225, 3241, 3242, 3243, + 3244, 3245, 3246, 3247, 3248, 3249, 3256, 3257, 3258, 3259, + 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3269, + 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3278, 3279, + 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287, 3289, 3290, + 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, + 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3318, + 3319, 3320, 3321, 3322, 3323, 3324, 3328, 3341, 3353, 3368, + 3378, 3388, 3406, 3411, 3416, 3426, 3436, 3444, 3448, 3452, + 3456, 3460, 3467, 3471, 3475, 3479, 3486, 3491, 3498, 3503, + 3507, 3512, 3516, 3524, 3535, 3539, 3551, 3559, 3567, 3574, + 3585, 3605, 3615, 3625, 3635, 3655, 3660, 3664, 3668, 3680, + 3684, 3696, 3703, 3713, 3717, 3732, 3737, 3744, 3748, 3761, + 3769, 3780, 3784, 3792, 3800, 3814, 3828, 3832 }; #endif @@ -1057,8 +1061,8 @@ static const char *const yytname[] = "tSplit", "tDelete", "tCoherence", "tIntersect", "tLayers", "tHole", "tAlias", "tAliasWithOptions", "tText2D", "tText3D", "tInterpolationScheme", "tTime", "tCombine", "tBSpline", "tBezier", - "tNurbs", "tOrder", "tKnots", "tColor", "tColorTable", "tFor", "tIn", - "tEndFor", "tIf", "tEndIf", "tExit", "tField", "tReturn", "tCall", + "tNurbs", "tNurbsOrder", "tNurbsKnots", "tColor", "tColorTable", "tFor", + "tIn", "tEndFor", "tIf", "tEndIf", "tExit", "tField", "tReturn", "tCall", "tFunction", "tShow", "tHide", "tGetValue", "tGMSH_MAJOR_VERSION", "tGMSH_MINOR_VERSION", "tGMSH_PATCH_VERSION", "tAFFECTDIVIDE", "tAFFECTTIMES", "tAFFECTMINUS", "tAFFECTPLUS", "'?'", "tOR", "tAND", @@ -3040,44 +3044,44 @@ static const yytype_uint8 yystos[] = 6, 6, 6, 223, 6 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ + YYERROR; \ + } \ while (YYID (0)) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. @@ -3086,22 +3090,22 @@ while (YYID (0)) #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) #endif @@ -3112,10 +3116,10 @@ while (YYID (0)) #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -3138,21 +3142,21 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ } while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ } while (YYID (0)) @@ -3184,7 +3188,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) switch (yytype) { default: - break; + break; } } @@ -3236,10 +3240,10 @@ yy_stack_print (bottom, top) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) @@ -3262,21 +3266,21 @@ yy_reduce_print (yyvsp, yyrule) int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); fprintf (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) @@ -3292,7 +3296,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -3379,27 +3383,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -3437,7 +3441,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) # if 0 /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ + constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); @@ -3450,13 +3454,13 @@ yysyntax_error (char *yyresult, int yystate, int yychar) static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ + YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ @@ -3468,22 +3472,22 @@ yysyntax_error (char *yyresult, int yystate, int yychar) yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); @@ -3491,29 +3495,29 @@ yysyntax_error (char *yyresult, int yystate, int yychar) yysize = yysize1; if (yysize_overflow) - return YYSIZE_MAXIMUM; + return YYSIZE_MAXIMUM; if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } return yysize; } } @@ -3547,7 +3551,7 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } @@ -3660,7 +3664,7 @@ yyparse () yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack @@ -3690,25 +3694,25 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); + &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -3716,23 +3720,23 @@ yyparse () # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -3742,10 +3746,10 @@ yyparse () YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -3794,7 +3798,7 @@ yybackup: if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -3852,101 +3856,101 @@ yyreduce: switch (yyn) { case 3: -#line 143 "Gmsh.y" +#line 147 "Gmsh.y" { yyerrok; return 1; ;} break; case 6: -#line 154 "Gmsh.y" +#line 158 "Gmsh.y" { return 1; ;} break; case 7: -#line 155 "Gmsh.y" +#line 159 "Gmsh.y" { return 1; ;} break; case 8: -#line 156 "Gmsh.y" +#line 160 "Gmsh.y" { return 1; ;} break; case 9: -#line 157 "Gmsh.y" +#line 161 "Gmsh.y" { return 1; ;} break; case 10: -#line 158 "Gmsh.y" +#line 162 "Gmsh.y" { List_Delete((yyvsp[(1) - (1)].l)); return 1; ;} break; case 11: -#line 159 "Gmsh.y" +#line 163 "Gmsh.y" { return 1; ;} break; case 12: -#line 160 "Gmsh.y" +#line 164 "Gmsh.y" { return 1; ;} break; case 13: -#line 161 "Gmsh.y" +#line 165 "Gmsh.y" { return 1; ;} break; case 14: -#line 162 "Gmsh.y" +#line 166 "Gmsh.y" { List_Delete((yyvsp[(1) - (1)].l)); return 1; ;} break; case 15: -#line 163 "Gmsh.y" +#line 167 "Gmsh.y" { return 1; ;} break; case 16: -#line 164 "Gmsh.y" +#line 168 "Gmsh.y" { return 1; ;} break; case 17: -#line 165 "Gmsh.y" +#line 169 "Gmsh.y" { return 1; ;} break; case 18: -#line 166 "Gmsh.y" +#line 170 "Gmsh.y" { return 1; ;} break; case 19: -#line 167 "Gmsh.y" +#line 171 "Gmsh.y" { return 1; ;} break; case 20: -#line 168 "Gmsh.y" +#line 172 "Gmsh.y" { return 1; ;} break; case 21: -#line 173 "Gmsh.y" +#line 177 "Gmsh.y" { (yyval.c) = (char*)"w"; ;} break; case 22: -#line 177 "Gmsh.y" +#line 181 "Gmsh.y" { (yyval.c) = (char*)"a"; ;} break; case 23: -#line 184 "Gmsh.y" +#line 188 "Gmsh.y" { Msg::Direct((yyvsp[(3) - (5)].c)); Free((yyvsp[(3) - (5)].c)); @@ -3954,17 +3958,17 @@ yyreduce: break; case 24: -#line 189 "Gmsh.y" +#line 193 "Gmsh.y" { char tmpstring[1024]; FixRelativePath((yyvsp[(6) - (7)].c), tmpstring); FILE *fp = fopen(tmpstring, (yyvsp[(5) - (7)].c)); if(!fp){ - yymsg(0, "Unable to open file '%s'", tmpstring); + yymsg(0, "Unable to open file '%s'", tmpstring); } else{ - fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c)); - fclose(fp); + fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c)); + fclose(fp); } Free((yyvsp[(3) - (7)].c)); Free((yyvsp[(6) - (7)].c)); @@ -3972,41 +3976,41 @@ yyreduce: break; case 25: -#line 204 "Gmsh.y" +#line 208 "Gmsh.y" { char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring); if(i < 0) - yymsg(0, "Too few arguments in Printf"); + yymsg(0, "Too few arguments in Printf"); else if(i > 0) - yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); + yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); else - Msg::Direct(tmpstring); + Msg::Direct(tmpstring); Free((yyvsp[(3) - (7)].c)); List_Delete((yyvsp[(5) - (7)].l)); ;} break; case 26: -#line 217 "Gmsh.y" +#line 221 "Gmsh.y" { char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (9)].c), (yyvsp[(5) - (9)].l), tmpstring); if(i < 0) - yymsg(0, "Too few arguments in Printf"); + yymsg(0, "Too few arguments in Printf"); else if(i > 0) - yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); + yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); else{ - char tmpstring2[1024]; - FixRelativePath((yyvsp[(8) - (9)].c), tmpstring2); - FILE *fp = fopen(tmpstring2, (yyvsp[(7) - (9)].c)); - if(!fp){ - yymsg(0, "Unable to open file '%s'", tmpstring2); - } - else{ - fprintf(fp, "%s\n", tmpstring); - fclose(fp); - } + char tmpstring2[1024]; + FixRelativePath((yyvsp[(8) - (9)].c), tmpstring2); + FILE *fp = fopen(tmpstring2, (yyvsp[(7) - (9)].c)); + if(!fp){ + yymsg(0, "Unable to open file '%s'", tmpstring2); + } + else{ + fprintf(fp, "%s\n", tmpstring); + fclose(fp); + } } Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(8) - (9)].c)); @@ -4015,30 +4019,30 @@ yyreduce: break; case 27: -#line 246 "Gmsh.y" +#line 250 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(1) - (6)].c), "View") && ViewData->finalize()){ - ViewData->setName((yyvsp[(2) - (6)].c)); - ViewData->setFileName(gmsh_yyname); - ViewData->setFileIndex(gmsh_yyviewindex++); - new PView(ViewData); + ViewData->setName((yyvsp[(2) - (6)].c)); + ViewData->setFileName(gmsh_yyname); + ViewData->setFileIndex(gmsh_yyviewindex++); + new PView(ViewData); } else - delete ViewData; + delete ViewData; #endif Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(2) - (6)].c)); ;} break; case 28: -#line 260 "Gmsh.y" +#line 264 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - new PView(PView::list[index], false); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + new PView(PView::list[index], false); } #endif Free((yyvsp[(2) - (6)].c)); @@ -4046,13 +4050,13 @@ yyreduce: break; case 29: -#line 271 "Gmsh.y" +#line 275 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - new PView(PView::list[index], true); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + new PView(PView::list[index], true); } #endif Free((yyvsp[(2) - (6)].c)); @@ -4060,7 +4064,7 @@ yyreduce: break; case 30: -#line 285 "Gmsh.y" +#line 289 "Gmsh.y" { #if !defined(HAVE_NO_POST) ViewData = new PViewDataList(); @@ -4069,125 +4073,125 @@ yyreduce: break; case 36: -#line 299 "Gmsh.y" +#line 303 "Gmsh.y" { ViewCoord.push_back((yyvsp[(1) - (1)].d)); ;} break; case 37: -#line 301 "Gmsh.y" +#line 305 "Gmsh.y" { ViewCoord.push_back((yyvsp[(3) - (3)].d)); ;} break; case 38: -#line 306 "Gmsh.y" +#line 310 "Gmsh.y" { if(ViewValueList) ViewValueList->push_back((yyvsp[(1) - (1)].d)); ;} break; case 39: -#line 308 "Gmsh.y" +#line 312 "Gmsh.y" { if(ViewValueList) ViewValueList->push_back((yyvsp[(3) - (3)].d)); ;} break; case 40: -#line 313 "Gmsh.y" +#line 317 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strncmp((yyvsp[(1) - (1)].c), "SP", 2)){ - ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP; + ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP; } else if(!strncmp((yyvsp[(1) - (1)].c), "VP", 2)){ - ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP; + ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP; } else if(!strncmp((yyvsp[(1) - (1)].c), "TP", 2)){ - ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP; + ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP; } else if(!strncmp((yyvsp[(1) - (1)].c), "SL", 2)){ - ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL; + ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "VL", 2)){ - ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL; + ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "TL", 2)){ - ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL; + ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "ST", 2)){ - ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST; + ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "VT", 2)){ - ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT; + ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "TT", 2)){ - ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT; + ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "SQ", 2)){ - ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ; + ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "VQ", 2)){ - ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ; + ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "TQ", 2)){ - ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ; + ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "SS", 2)){ - ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS; + ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "VS", 2)){ - ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS; + ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "TS", 2)){ - ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS; + ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "SH", 2)){ - ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH; + ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "VH", 2)){ - ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH; + ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "TH", 2)){ - ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH; + ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "SI", 2)){ - ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI; + ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "VI", 2)){ - ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI; + ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "TI", 2)){ - ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI; + ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "SY", 2)){ - ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY; + ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else if(!strncmp((yyvsp[(1) - (1)].c), "VY", 2)){ - ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY; + ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else if(!strncmp((yyvsp[(1) - (1)].c), "TY", 2)){ - ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY; + ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else{ - yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c)); - ViewValueList = 0; ViewNumList = 0; + yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c)); + ViewValueList = 0; ViewNumList = 0; } #endif ViewCoord.clear(); @@ -4196,20 +4200,20 @@ yyreduce: break; case 41: -#line 417 "Gmsh.y" +#line 421 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(ViewValueList){ - for(int i = 0; i < 3; i++) - for(unsigned int j = 0; j < ViewCoord.size() / 3; j++) - ViewValueList->push_back(ViewCoord[3 * j + i]); + for(int i = 0; i < 3; i++) + for(unsigned int j = 0; j < ViewCoord.size() / 3; j++) + ViewValueList->push_back(ViewCoord[3 * j + i]); } #endif ;} break; case 42: -#line 427 "Gmsh.y" +#line 431 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(ViewValueList) (*ViewNumList)++; @@ -4218,7 +4222,7 @@ yyreduce: break; case 43: -#line 436 "Gmsh.y" +#line 440 "Gmsh.y" { #if !defined(HAVE_NO_POST) for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(1) - (1)].c)[i]); @@ -4228,7 +4232,7 @@ yyreduce: break; case 44: -#line 443 "Gmsh.y" +#line 447 "Gmsh.y" { #if !defined(HAVE_NO_POST) for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T2C.push_back((yyvsp[(3) - (3)].c)[i]); @@ -4238,7 +4242,7 @@ yyreduce: break; case 45: -#line 453 "Gmsh.y" +#line 457 "Gmsh.y" { #if !defined(HAVE_NO_POST) ViewData->T2D.push_back((yyvsp[(3) - (8)].d)); @@ -4250,7 +4254,7 @@ yyreduce: break; case 46: -#line 462 "Gmsh.y" +#line 466 "Gmsh.y" { #if !defined(HAVE_NO_POST) ViewData->NbT2++; @@ -4259,7 +4263,7 @@ yyreduce: break; case 47: -#line 471 "Gmsh.y" +#line 475 "Gmsh.y" { #if !defined(HAVE_NO_POST) for(int i = 0; i < (int)strlen((yyvsp[(1) - (1)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(1) - (1)].c)[i]); @@ -4269,7 +4273,7 @@ yyreduce: break; case 48: -#line 478 "Gmsh.y" +#line 482 "Gmsh.y" { #if !defined(HAVE_NO_POST) for(int i = 0; i < (int)strlen((yyvsp[(3) - (3)].c)) + 1; i++) ViewData->T3C.push_back((yyvsp[(3) - (3)].c)[i]); @@ -4279,7 +4283,7 @@ yyreduce: break; case 49: -#line 488 "Gmsh.y" +#line 492 "Gmsh.y" { #if !defined(HAVE_NO_POST) ViewData->T3D.push_back((yyvsp[(3) - (10)].d)); ViewData->T3D.push_back((yyvsp[(5) - (10)].d)); @@ -4290,7 +4294,7 @@ yyreduce: break; case 50: -#line 496 "Gmsh.y" +#line 500 "Gmsh.y" { #if !defined(HAVE_NO_POST) ViewData->NbT3++; @@ -4299,18 +4303,18 @@ yyreduce: break; case 51: -#line 506 "Gmsh.y" +#line 510 "Gmsh.y" { #if !defined(HAVE_NO_POST) int type = - (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : - (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : - (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : - (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : - (ViewData->NbSY || ViewData->NbVY) ? TYPE_PYR : - (ViewData->NbSI || ViewData->NbVI) ? TYPE_PRI : - (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : - 0; + (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : + (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : + (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : + (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : + (ViewData->NbSY || ViewData->NbVY) ? TYPE_PYR : + (ViewData->NbSI || ViewData->NbVI) ? TYPE_PRI : + (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : + 0; ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (8)].l)), ListOfListOfDouble2Matrix((yyvsp[(6) - (8)].l))); #endif @@ -4318,16 +4322,16 @@ yyreduce: break; case 52: -#line 525 "Gmsh.y" +#line 529 "Gmsh.y" { #if !defined(HAVE_NO_POST) int type = - (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : - (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : - (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : - (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : - (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : - 0; + (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : + (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : + (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : + (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : + (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : + 0; ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (14)].l)), ListOfListOfDouble2Matrix((yyvsp[(6) - (14)].l)), ListOfListOfDouble2Matrix((yyvsp[(9) - (14)].l)), @@ -4337,7 +4341,7 @@ yyreduce: break; case 53: -#line 544 "Gmsh.y" +#line 548 "Gmsh.y" { #if !defined(HAVE_NO_POST) ViewValueList = &ViewData->Time; @@ -4346,137 +4350,137 @@ yyreduce: break; case 54: -#line 550 "Gmsh.y" +#line 554 "Gmsh.y" { ;} break; case 55: -#line 557 "Gmsh.y" +#line 561 "Gmsh.y" { (yyval.i) = 0; ;} break; case 56: -#line 558 "Gmsh.y" +#line 562 "Gmsh.y" { (yyval.i) = 1; ;} break; case 57: -#line 559 "Gmsh.y" +#line 563 "Gmsh.y" { (yyval.i) = 2; ;} break; case 58: -#line 560 "Gmsh.y" +#line 564 "Gmsh.y" { (yyval.i) = 3; ;} break; case 59: -#line 561 "Gmsh.y" +#line 565 "Gmsh.y" { (yyval.i) = 4; ;} break; case 60: -#line 565 "Gmsh.y" +#line 569 "Gmsh.y" { (yyval.i) = 1; ;} break; case 61: -#line 566 "Gmsh.y" +#line 570 "Gmsh.y" { (yyval.i) = -1; ;} break; case 62: -#line 574 "Gmsh.y" +#line 578 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){ - if(!(yyvsp[(2) - (4)].i)) - gmsh_yysymbols[(yyvsp[(1) - (4)].c)].push_back((yyvsp[(3) - (4)].d)); - else - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); + if(!(yyvsp[(2) - (4)].i)) + gmsh_yysymbols[(yyvsp[(1) - (4)].c)].push_back((yyvsp[(3) - (4)].d)); + else + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); } else{ - switch((yyvsp[(2) - (4)].i)){ - case 0 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] = (yyvsp[(3) - (4)].d); break; - case 1 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] += (yyvsp[(3) - (4)].d); break; - case 2 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] -= (yyvsp[(3) - (4)].d); break; - case 3 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] *= (yyvsp[(3) - (4)].d); break; - case 4 : - if((yyvsp[(3) - (4)].d)) gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] /= (yyvsp[(3) - (4)].d); - else yymsg(0, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].d)); - break; - } + switch((yyvsp[(2) - (4)].i)){ + case 0 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] = (yyvsp[(3) - (4)].d); break; + case 1 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] += (yyvsp[(3) - (4)].d); break; + case 2 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] -= (yyvsp[(3) - (4)].d); break; + case 3 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] *= (yyvsp[(3) - (4)].d); break; + case 4 : + if((yyvsp[(3) - (4)].d)) gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] /= (yyvsp[(3) - (4)].d); + else yymsg(0, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].d)); + break; + } } Free((yyvsp[(1) - (4)].c)); ;} break; case 63: -#line 596 "Gmsh.y" +#line 600 "Gmsh.y" { int index = (int)(yyvsp[(3) - (7)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (7)].c))){ - if(!(yyvsp[(5) - (7)].i)){ - gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); - gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); - } - else - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (7)].c)); + if(!(yyvsp[(5) - (7)].i)){ + gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); + gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); + } + else + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (7)].c)); } else{ - if((int)gmsh_yysymbols[(yyvsp[(1) - (7)].c)].size() < index + 1) - gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); - switch((yyvsp[(5) - (7)].i)){ - case 0 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); break; - case 1 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] += (yyvsp[(6) - (7)].d); break; - case 2 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] -= (yyvsp[(6) - (7)].d); break; - case 3 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] *= (yyvsp[(6) - (7)].d); break; - case 4 : - if((yyvsp[(6) - (7)].d)) gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] /= (yyvsp[(6) - (7)].d); - else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), index, (yyvsp[(6) - (7)].d)); - break; - } + if((int)gmsh_yysymbols[(yyvsp[(1) - (7)].c)].size() < index + 1) + gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); + switch((yyvsp[(5) - (7)].i)){ + case 0 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); break; + case 1 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] += (yyvsp[(6) - (7)].d); break; + case 2 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] -= (yyvsp[(6) - (7)].d); break; + case 3 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] *= (yyvsp[(6) - (7)].d); break; + case 4 : + if((yyvsp[(6) - (7)].d)) gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] /= (yyvsp[(6) - (7)].d); + else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), index, (yyvsp[(6) - (7)].d)); + break; + } } Free((yyvsp[(1) - (7)].c)); ;} break; case 64: -#line 623 "Gmsh.y" +#line 627 "Gmsh.y" { if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){ - yymsg(0, "Incompatible array dimensions in affectation"); + yymsg(0, "Incompatible array dimensions in affectation"); } else{ - if(!gmsh_yysymbols.count((yyvsp[(1) - (9)].c))){ - if(!(yyvsp[(7) - (9)].i)){ - for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ - int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); - gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); - gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); - } - } - else - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (9)].c)); - } - else{ - for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ - int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); - double d = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); - if((int)gmsh_yysymbols[(yyvsp[(1) - (9)].c)].size() < index + 1) - gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); - switch((yyvsp[(7) - (9)].i)){ - case 0 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = d; break; - case 1 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] += d; break; - case 2 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] -= d; break; - case 3 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] *= d; break; - case 4 : - if((yyvsp[(8) - (9)].l)) gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] /= d; - else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), index, d); - break; - } - } - } + if(!gmsh_yysymbols.count((yyvsp[(1) - (9)].c))){ + if(!(yyvsp[(7) - (9)].i)){ + for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ + int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); + gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); + gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); + } + } + else + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (9)].c)); + } + else{ + for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ + int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); + double d = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); + if((int)gmsh_yysymbols[(yyvsp[(1) - (9)].c)].size() < index + 1) + gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); + switch((yyvsp[(7) - (9)].i)){ + case 0 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = d; break; + case 1 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] += d; break; + case 2 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] -= d; break; + case 3 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] *= d; break; + case 4 : + if((yyvsp[(8) - (9)].l)) gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] /= d; + else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), index, d); + break; + } + } + } } Free((yyvsp[(1) - (9)].c)); List_Delete((yyvsp[(4) - (9)].l)); @@ -4485,10 +4489,10 @@ yyreduce: break; case 65: -#line 663 "Gmsh.y" +#line 667 "Gmsh.y" { if(gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - gmsh_yysymbols[(yyvsp[(1) - (6)].c)].clear(); + gmsh_yysymbols[(yyvsp[(1) - (6)].c)].clear(); gmsh_yysymbols[(yyvsp[(1) - (6)].c)] = std::vector<double>(); for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++) gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i)); @@ -4498,44 +4502,44 @@ yyreduce: break; case 66: -#line 673 "Gmsh.y" +#line 677 "Gmsh.y" { // appends to the list for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++) - gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i)); + gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i)); Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(5) - (6)].l)); ;} break; case 67: -#line 681 "Gmsh.y" +#line 685 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); else - gmsh_yysymbols[(yyvsp[(1) - (3)].c)][0] += (yyvsp[(2) - (3)].i); + gmsh_yysymbols[(yyvsp[(1) - (3)].c)][0] += (yyvsp[(2) - (3)].i); Free((yyvsp[(1) - (3)].c)); ;} break; case 68: -#line 689 "Gmsh.y" +#line 693 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); else{ - int index = (int)(yyvsp[(3) - (6)].d); - if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) - gmsh_yysymbols[(yyvsp[(1) - (6)].c)].resize(index + 1, 0.); - gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index] += (yyvsp[(5) - (6)].i); + int index = (int)(yyvsp[(3) - (6)].d); + if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) + gmsh_yysymbols[(yyvsp[(1) - (6)].c)].resize(index + 1, 0.); + gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index] += (yyvsp[(5) - (6)].i); } Free((yyvsp[(1) - (6)].c)); ;} break; case 69: -#line 701 "Gmsh.y" +#line 705 "Gmsh.y" { gmsh_yystringsymbols[(yyvsp[(1) - (4)].c)] = std::string((yyvsp[(3) - (4)].c)); Free((yyvsp[(1) - (4)].c)); @@ -4544,7 +4548,7 @@ yyreduce: break; case 70: -#line 710 "Gmsh.y" +#line 714 "Gmsh.y" { std::string tmp((yyvsp[(5) - (6)].c)); StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), tmp); @@ -4553,7 +4557,7 @@ yyreduce: break; case 71: -#line 716 "Gmsh.y" +#line 720 "Gmsh.y" { std::string tmp((yyvsp[(8) - (9)].c)); StringOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), tmp); @@ -4562,73 +4566,73 @@ yyreduce: break; case 72: -#line 725 "Gmsh.y" +#line 729 "Gmsh.y" { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d)){ - switch((yyvsp[(4) - (6)].i)){ - case 0 : d = (yyvsp[(5) - (6)].d); break; - case 1 : d += (yyvsp[(5) - (6)].d); break; - case 2 : d -= (yyvsp[(5) - (6)].d); break; - case 3 : d *= (yyvsp[(5) - (6)].d); break; - case 4 : - if((yyvsp[(5) - (6)].d)) d /= (yyvsp[(5) - (6)].d); - else yymsg(0, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d)); - break; - } - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d); + switch((yyvsp[(4) - (6)].i)){ + case 0 : d = (yyvsp[(5) - (6)].d); break; + case 1 : d += (yyvsp[(5) - (6)].d); break; + case 2 : d -= (yyvsp[(5) - (6)].d); break; + case 3 : d *= (yyvsp[(5) - (6)].d); break; + case 4 : + if((yyvsp[(5) - (6)].d)) d /= (yyvsp[(5) - (6)].d); + else yymsg(0, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d)); + break; + } + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d); } Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(3) - (6)].c)); ;} break; case 73: -#line 743 "Gmsh.y" +#line 747 "Gmsh.y" { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d)){ - switch((yyvsp[(7) - (9)].i)){ - case 0 : d = (yyvsp[(8) - (9)].d); break; - case 1 : d += (yyvsp[(8) - (9)].d); break; - case 2 : d -= (yyvsp[(8) - (9)].d); break; - case 3 : d *= (yyvsp[(8) - (9)].d); break; - case 4 : - if((yyvsp[(8) - (9)].d)) d /= (yyvsp[(8) - (9)].d); - else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); - break; - } - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d); + switch((yyvsp[(7) - (9)].i)){ + case 0 : d = (yyvsp[(8) - (9)].d); break; + case 1 : d += (yyvsp[(8) - (9)].d); break; + case 2 : d -= (yyvsp[(8) - (9)].d); break; + case 3 : d *= (yyvsp[(8) - (9)].d); break; + case 4 : + if((yyvsp[(8) - (9)].d)) d /= (yyvsp[(8) - (9)].d); + else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); + break; + } + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d); } Free((yyvsp[(1) - (9)].c)); Free((yyvsp[(6) - (9)].c)); ;} break; case 74: -#line 761 "Gmsh.y" +#line 765 "Gmsh.y" { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d)){ - d += (yyvsp[(4) - (5)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d); + d += (yyvsp[(4) - (5)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d); } Free((yyvsp[(1) - (5)].c)); Free((yyvsp[(3) - (5)].c)); ;} break; case 75: -#line 770 "Gmsh.y" +#line 774 "Gmsh.y" { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d)){ - d += (yyvsp[(7) - (8)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d); + d += (yyvsp[(7) - (8)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d); } Free((yyvsp[(1) - (8)].c)); Free((yyvsp[(6) - (8)].c)); ;} break; case 76: -#line 782 "Gmsh.y" +#line 786 "Gmsh.y" { ColorOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), 0, (yyvsp[(5) - (8)].c), (yyvsp[(7) - (8)].u)); Free((yyvsp[(1) - (8)].c)); Free((yyvsp[(5) - (8)].c)); @@ -4636,7 +4640,7 @@ yyreduce: break; case 77: -#line 787 "Gmsh.y" +#line 791 "Gmsh.y" { ColorOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (11)].c), (int)(yyvsp[(3) - (11)].d), (yyvsp[(8) - (11)].c), (yyvsp[(10) - (11)].u)); Free((yyvsp[(1) - (11)].c)); Free((yyvsp[(8) - (11)].c)); @@ -4644,22 +4648,22 @@ yyreduce: break; case 78: -#line 795 "Gmsh.y" +#line 799 "Gmsh.y" { GmshColorTable *ct = GetColorTable(0); if(!ct) - yymsg(0, "View[%d] does not exist", 0); + yymsg(0, "View[%d] does not exist", 0); else{ - ct->size = List_Nbr((yyvsp[(5) - (6)].l)); - if(ct->size > COLORTABLE_NBMAX_COLOR) - yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", - ct->size, COLORTABLE_NBMAX_COLOR, 0); - else - for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(5) - (6)].l), i, &ct->table[i]); - if(ct->size == 1){ - ct->size = 2; - ct->table[1] = ct->table[0]; - } + ct->size = List_Nbr((yyvsp[(5) - (6)].l)); + if(ct->size > COLORTABLE_NBMAX_COLOR) + yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", + ct->size, COLORTABLE_NBMAX_COLOR, 0); + else + for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(5) - (6)].l), i, &ct->table[i]); + if(ct->size == 1){ + ct->size = 2; + ct->table[1] = ct->table[0]; + } } Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(5) - (6)].l)); @@ -4667,22 +4671,22 @@ yyreduce: break; case 79: -#line 815 "Gmsh.y" +#line 819 "Gmsh.y" { GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (9)].d)); if(!ct) - yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d)); else{ - ct->size = List_Nbr((yyvsp[(8) - (9)].l)); - if(ct->size > COLORTABLE_NBMAX_COLOR) - yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", - ct->size, COLORTABLE_NBMAX_COLOR, (int)(yyvsp[(3) - (9)].d)); - else - for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(8) - (9)].l), i, &ct->table[i]); - if(ct->size == 1){ - ct->size = 2; - ct->table[1] = ct->table[0]; - } + ct->size = List_Nbr((yyvsp[(8) - (9)].l)); + if(ct->size > COLORTABLE_NBMAX_COLOR) + yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", + ct->size, COLORTABLE_NBMAX_COLOR, (int)(yyvsp[(3) - (9)].d)); + else + for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(8) - (9)].l), i, &ct->table[i]); + if(ct->size == 1){ + ct->size = 2; + ct->table[1] = ct->table[0]; + } } Free((yyvsp[(1) - (9)].c)); List_Delete((yyvsp[(8) - (9)].l)); @@ -4690,106 +4694,106 @@ yyreduce: break; case 80: -#line 838 "Gmsh.y" +#line 842 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (5)].c),"Background")) - GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d); + GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d); else - yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c)); + yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c)); ;} break; case 81: -#line 845 "Gmsh.y" +#line 849 "Gmsh.y" { if(!GModel::current()->getFields()->newField((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c))) - yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)); + yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} break; case 82: -#line 851 "Gmsh.y" +#line 855 "Gmsh.y" { Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d)); if(field){ - FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; - if(option){ - try { option->numericalValue((yyvsp[(8) - (9)].d)); } - catch(...){ - yymsg(0, "Cannot assign a numerical value to option '%s' " - "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); - } - } - else - yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; + if(option){ + try { option->numericalValue((yyvsp[(8) - (9)].d)); } + catch(...){ + yymsg(0, "Cannot assign a numerical value to option '%s' " + "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + } + } + else + yymsg(0, "Unknown option '%s' in field %i of type '%s'", + (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); Free((yyvsp[(6) - (9)].c)); ;} break; case 83: -#line 871 "Gmsh.y" +#line 875 "Gmsh.y" { Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d)); if(field){ - FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; - if(option){ - try { option->string() = (yyvsp[(8) - (9)].c); } - catch (...){ - yymsg(0, "Cannot assign a string value to option '%s' " - "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); - } - } - else - yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; + if(option){ + try { option->string() = (yyvsp[(8) - (9)].c); } + catch (...){ + yymsg(0, "Cannot assign a string value to option '%s' " + "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + } + } + else + yymsg(0, "Unknown option '%s' in field %i of type '%s'", + (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c)); ;} break; case 84: -#line 892 "Gmsh.y" +#line 896 "Gmsh.y" { Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (11)].d)); if(field){ - FieldOption *option = field->options[(yyvsp[(6) - (11)].c)]; - if(option){ - std::list<int> &vl = option->list(); - vl.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(9) - (11)].l)); i++){ - double id; - List_Read((yyvsp[(9) - (11)].l), i, &id); - vl.push_back((int)id); - } - } - else - yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->getName()); + FieldOption *option = field->options[(yyvsp[(6) - (11)].c)]; + if(option){ + std::list<int> &vl = option->list(); + vl.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(9) - (11)].l)); i++){ + double id; + List_Read((yyvsp[(9) - (11)].l), i, &id); + vl.push_back((int)id); + } + } + else + yymsg(0, "Unknown option '%s' in field %i of type '%s'", + (yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->getName()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d)); Free((yyvsp[(6) - (11)].c)); List_Delete((yyvsp[(9) - (11)].l)); ;} break; case 85: -#line 918 "Gmsh.y" +#line 922 "Gmsh.y" { #if !defined(HAVE_NO_POST) try { - PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); + PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); } catch (...) { - yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); + yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); } #endif Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); @@ -4797,14 +4801,14 @@ yyreduce: break; case 86: -#line 930 "Gmsh.y" +#line 934 "Gmsh.y" { #if !defined(HAVE_NO_POST) try { - PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); + PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); } catch (...) { - yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); + yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); } #endif Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c)); @@ -4812,14 +4816,14 @@ yyreduce: break; case 87: -#line 947 "Gmsh.y" +#line 951 "Gmsh.y" { (yyval.i) = (int)(yyvsp[(1) - (1)].d); ;} break; case 88: -#line 951 "Gmsh.y" +#line 955 "Gmsh.y" { (yyval.i) = GModel::current()->setPhysicalName (std::string((yyvsp[(1) - (1)].c)), curPhysDim, @@ -4829,59 +4833,59 @@ yyreduce: break; case 89: -#line 961 "Gmsh.y" +#line 965 "Gmsh.y" { (yyval.l) = 0; ;} break; case 90: -#line 965 "Gmsh.y" +#line 969 "Gmsh.y" { (yyval.l) = List_Create(1, 1, sizeof(Vertex*)); Vertex *v = FindPoint((int)(yyvsp[(4) - (5)].d)); if(!v) - yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d)); + yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d)); else{ - List_Add((yyval.l), &v); + List_Add((yyval.l), &v); } ;} break; case 91: -#line 977 "Gmsh.y" +#line 981 "Gmsh.y" { for(int i = 0; i < 4; i++) (yyval.v)[i] = 0.; ;} break; case 92: -#line 981 "Gmsh.y" +#line 985 "Gmsh.y" { for(int i = 0; i < 4; i++) (yyval.v)[i] = (yyvsp[(2) - (2)].v)[i]; ;} break; case 93: -#line 991 "Gmsh.y" +#line 995 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if(FindPoint(num)){ - yymsg(0, "Point %d already exists", num); + yymsg(0, "Point %d already exists", num); } else{ - double x = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[0]; - double y = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[1]; - double z = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[2]; - double lc = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[3]; - if(lc == 0.) lc = MAX_LC; // no mesh size given at the point - Vertex *v; - if(!myGmshSurface) - v = Create_Vertex(num, x, y, z, lc, 1.0); - else - v = Create_Vertex(num, x, y, myGmshSurface, lc); - Tree_Add(GModel::current()->getGEOInternals()->Points, &v); - AddToTemporaryBoundingBox(v->Pos.X, v->Pos.Y, v->Pos.Z); + double x = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[0]; + double y = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[1]; + double z = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[2]; + double lc = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[3]; + if(lc == 0.) lc = MAX_LC; // no mesh size given at the point + Vertex *v; + if(!myGmshSurface) + v = Create_Vertex(num, x, y, z, lc, 1.0); + else + v = Create_Vertex(num, x, y, myGmshSurface, lc); + Tree_Add(GModel::current()->getGEOInternals()->Points, &v); + AddToTemporaryBoundingBox(v->Pos.X, v->Pos.Y, v->Pos.Z); } (yyval.s).Type = MSH_POINT; (yyval.s).Num = num; @@ -4889,24 +4893,24 @@ yyreduce: break; case 94: -#line 1014 "Gmsh.y" +#line 1018 "Gmsh.y" { curPhysDim = 0; ;} break; case 95: -#line 1018 "Gmsh.y" +#line 1022 "Gmsh.y" { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT)){ - yymsg(0, "Physical point %d already exists", num); + yymsg(0, "Physical point %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_POINT; @@ -4915,19 +4919,19 @@ yyreduce: break; case 96: -#line 1034 "Gmsh.y" +#line 1038 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (6)].l), i, &d); - Vertex *v = FindPoint((int)d); - if(v) - v->lc = (yyvsp[(5) - (6)].d); - else{ - GVertex *gv = GModel::current()->getVertexByTag((int)d); - if(gv) - gv->setPrescribedMeshSizeAtVertex((yyvsp[(5) - (6)].d)); - } + double d; + List_Read((yyvsp[(3) - (6)].l), i, &d); + Vertex *v = FindPoint((int)d); + if(v) + v->lc = (yyvsp[(5) - (6)].d); + else{ + GVertex *gv = GModel::current()->getVertexByTag((int)d); + if(gv) + gv->setPrescribedMeshSizeAtVertex((yyvsp[(5) - (6)].d)); + } } List_Delete((yyvsp[(3) - (6)].l)); // dummy values @@ -4937,19 +4941,19 @@ yyreduce: break; case 97: -#line 1056 "Gmsh.y" +#line 1060 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_LINE, 1, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_LINE, 1, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_LINE; @@ -4958,43 +4962,43 @@ yyreduce: break; case 98: -#line 1074 "Gmsh.y" +#line 1078 "Gmsh.y" { for (int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - double dnum; - List_Read((yyvsp[(3) - (4)].l), i, &dnum); - int num = (int) fabs(dnum); - Curve *c = FindCurve(num); - if (c){ - c->degenerated = true; - } - else{ - GEdge *ge = GModel::current()->getEdgeByTag(num); - if (!ge){ - yymsg(0, "Curve %d does not exist", num); - } - else{ - ge->setTooSmall(true); - } - } + double dnum; + List_Read((yyvsp[(3) - (4)].l), i, &dnum); + int num = (int) fabs(dnum); + Curve *c = FindCurve(num); + if (c){ + c->degenerated = true; + } + else{ + GEdge *ge = GModel::current()->getEdgeByTag(num); + if (!ge){ + yymsg(0, "Curve %d does not exist", num); + } + else{ + ge->setTooSmall(true); + } + } } ;} break; case 99: -#line 1096 "Gmsh.y" +#line 1100 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_SPLN, 3, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_SPLN, 3, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_SPLN; @@ -5003,31 +5007,31 @@ yyreduce: break; case 100: -#line 1114 "Gmsh.y" +#line 1118 "Gmsh.y" { int num = (int)(yyvsp[(3) - (8)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL, - -1, -1, 0., 1.); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL, + -1, -1, 0., 1.); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ c->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; c->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; c->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(c); } - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - Curve *rc = CreateReversedCurve(c); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + Curve *rc = CreateReversedCurve(c); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ rc->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; rc->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; rc->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(rc); } - List_Delete(temp); + List_Delete(temp); } List_Delete((yyvsp[(6) - (8)].l)); (yyval.s).Type = MSH_SEGM_CIRC; @@ -5036,31 +5040,31 @@ yyreduce: break; case 101: -#line 1144 "Gmsh.y" +#line 1148 "Gmsh.y" { int num = (int)(yyvsp[(3) - (8)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL, - -1, -1, 0., 1.); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL, + -1, -1, 0., 1.); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ c->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; c->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; c->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(c); } - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - Curve *rc = CreateReversedCurve(c); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + Curve *rc = CreateReversedCurve(c); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ rc->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; rc->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; rc->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(rc); } - List_Delete(temp); + List_Delete(temp); } List_Delete((yyvsp[(6) - (8)].l)); (yyval.s).Type = MSH_SEGM_ELLI; @@ -5069,19 +5073,19 @@ yyreduce: break; case 102: -#line 1174 "Gmsh.y" +#line 1178 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_BSPLN, 2, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_BSPLN, 2, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_BSPLN; @@ -5090,19 +5094,19 @@ yyreduce: break; case 103: -#line 1192 "Gmsh.y" +#line 1196 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_BEZIER, 2, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_BEZIER, 2, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_BEZIER; @@ -5111,26 +5115,26 @@ yyreduce: break; case 104: -#line 1210 "Gmsh.y" +#line 1214 "Gmsh.y" { int num = (int)(yyvsp[(3) - (11)].d); if(List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1 != List_Nbr((yyvsp[(8) - (11)].l))){ - yymsg(0, "Wrong definition of Nurbs Curve %d: " - "got %d knots, need N + D + 1 = %d + %d + 1 = %d", - (int)(yyvsp[(3) - (11)].d), List_Nbr((yyvsp[(8) - (11)].l)), List_Nbr((yyvsp[(6) - (11)].l)), (int)(yyvsp[(10) - (11)].d), List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1); + yymsg(0, "Wrong definition of Nurbs Curve %d: " + "got %d knots, need N + D + 1 = %d + %d + 1 = %d", + (int)(yyvsp[(3) - (11)].d), List_Nbr((yyvsp[(8) - (11)].l)), List_Nbr((yyvsp[(6) - (11)].l)), (int)(yyvsp[(10) - (11)].d), List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1); } else{ - if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); - } - else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (11)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_NURBS, (int)(yyvsp[(10) - (11)].d), temp, (yyvsp[(8) - (11)].l), - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); - } + if(FindCurve(num)){ + yymsg(0, "Curve %d already exists", num); + } + else{ + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (11)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_NURBS, (int)(yyvsp[(10) - (11)].d), temp, (yyvsp[(8) - (11)].l), + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); + } } List_Delete((yyvsp[(6) - (11)].l)); List_Delete((yyvsp[(8) - (11)].l)); @@ -5140,18 +5144,18 @@ yyreduce: break; case 105: -#line 1236 "Gmsh.y" +#line 1240 "Gmsh.y" { int num = (int)(yyvsp[(4) - (8)].d); if(FindEdgeLoop(num)){ - yymsg(0, "Line loop %d already exists", num); + yymsg(0, "Line loop %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - sortEdgesInLoop(num, temp); - EdgeLoop *l = Create_EdgeLoop(num, temp); - Tree_Add(GModel::current()->getGEOInternals()->EdgeLoops, &l); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + sortEdgesInLoop(num, temp); + EdgeLoop *l = Create_EdgeLoop(num, temp); + Tree_Add(GModel::current()->getGEOInternals()->EdgeLoops, &l); + List_Delete(temp); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SEGM_LOOP; @@ -5160,24 +5164,24 @@ yyreduce: break; case 106: -#line 1253 "Gmsh.y" +#line 1257 "Gmsh.y" { curPhysDim = 1; ;} break; case 107: -#line 1257 "Gmsh.y" +#line 1261 "Gmsh.y" { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){ - yymsg(0, "Physical line %d already exists", num); + yymsg(0, "Physical line %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_LINE; @@ -5186,19 +5190,19 @@ yyreduce: break; case 108: -#line 1276 "Gmsh.y" +#line 1280 "Gmsh.y" { int num = (int)(yyvsp[(4) - (8)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - Surface *s = Create_Surface(num, MSH_SURF_PLAN); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - setSurfaceGeneratrices(s, temp); - List_Delete(temp); - End_Surface(s); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + Surface *s = Create_Surface(num, MSH_SURF_PLAN); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + setSurfaceGeneratrices(s, temp); + List_Delete(temp); + End_Surface(s); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SURF_PLAN; @@ -5207,40 +5211,40 @@ yyreduce: break; case 109: -#line 1294 "Gmsh.y" +#line 1298 "Gmsh.y" { int num = (int)(yyvsp[(4) - (9)].d), type = 0; if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - double d; - List_Read((yyvsp[(7) - (9)].l), 0, &d); - EdgeLoop *el = FindEdgeLoop((int)fabs(d)); - if(!el){ - yymsg(0, "Unknown line loop %d", (int)d); - } - else{ - int j = List_Nbr(el->Curves); - if(j == 4){ - type = MSH_SURF_REGL; - } - else if(j == 3){ - type = MSH_SURF_TRIC; - } - else{ - yymsg(0, "Wrong definition of Ruled Surface %d: " - "%d borders instead of 3 or 4", num, j); - type = MSH_SURF_PLAN; - } - Surface *s = Create_Surface(num, type); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l)); - setSurfaceGeneratrices(s, temp); - List_Delete(temp); - End_Surface(s); - s->InSphereCenter = (yyvsp[(8) - (9)].l); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); - } + double d; + List_Read((yyvsp[(7) - (9)].l), 0, &d); + EdgeLoop *el = FindEdgeLoop((int)fabs(d)); + if(!el){ + yymsg(0, "Unknown line loop %d", (int)d); + } + else{ + int j = List_Nbr(el->Curves); + if(j == 4){ + type = MSH_SURF_REGL; + } + else if(j == 3){ + type = MSH_SURF_TRIC; + } + else{ + yymsg(0, "Wrong definition of Ruled Surface %d: " + "%d borders instead of 3 or 4", num, j); + type = MSH_SURF_PLAN; + } + Surface *s = Create_Surface(num, type); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l)); + setSurfaceGeneratrices(s, temp); + List_Delete(temp); + End_Surface(s); + s->InSphereCenter = (yyvsp[(8) - (9)].l); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + } } List_Delete((yyvsp[(7) - (9)].l)); (yyval.s).Type = type; @@ -5249,7 +5253,7 @@ yyreduce: break; case 110: -#line 1333 "Gmsh.y" +#line 1337 "Gmsh.y" { myGmshSurface = 0; (yyval.s).Type = 0; @@ -5258,7 +5262,7 @@ yyreduce: break; case 111: -#line 1339 "Gmsh.y" +#line 1343 "Gmsh.y" { myGmshSurface = gmshSurface::getSurface((int)(yyvsp[(3) - (4)].d)); (yyval.s).Type = 0; @@ -5267,7 +5271,7 @@ yyreduce: break; case 112: -#line 1345 "Gmsh.y" +#line 1349 "Gmsh.y" { int num = (int)(yyvsp[(4) - (10)].d); myGmshSurface = gmshParametricSurface::NewParametricSurface(num, (yyvsp[(7) - (10)].c), (yyvsp[(8) - (10)].c), (yyvsp[(9) - (10)].c)); @@ -5277,27 +5281,27 @@ yyreduce: break; case 113: -#line 1352 "Gmsh.y" +#line 1356 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){ - yymsg(0, "Sphere %d has to be defined using 2 points (center + " - "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); + yymsg(0, "Sphere %d has to be defined using 2 points (center + " + "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); } else{ - double p1,p2; - List_Read((yyvsp[(6) - (7)].l), 0, &p1); - List_Read((yyvsp[(6) - (7)].l), 1, &p2); - Vertex *v1 = FindPoint((int)p1); - Vertex *v2 = FindPoint((int)p2); - if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1); - if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2); - if(v1 && v2) - myGmshSurface = gmshSphere::NewSphere - (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, - sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + - (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + - (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); + double p1,p2; + List_Read((yyvsp[(6) - (7)].l), 0, &p1); + List_Read((yyvsp[(6) - (7)].l), 1, &p2); + Vertex *v1 = FindPoint((int)p1); + Vertex *v2 = FindPoint((int)p2); + if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1); + if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2); + if(v1 && v2) + myGmshSurface = gmshSphere::NewSphere + (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, + sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + + (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + + (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); } (yyval.s).Type = 0; (yyval.s).Num = num; @@ -5305,27 +5309,27 @@ yyreduce: break; case 114: -#line 1377 "Gmsh.y" +#line 1381 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){ - yymsg(0, "PolarSphere %d has to be defined using 2 points (center + " - "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); + yymsg(0, "PolarSphere %d has to be defined using 2 points (center + " + "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); } else{ - double p1,p2; - List_Read((yyvsp[(6) - (7)].l), 0, &p1); - List_Read((yyvsp[(6) - (7)].l), 1, &p2); - Vertex *v1 = FindPoint((int)p1); - Vertex *v2 = FindPoint((int)p2); - if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1); - if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2); - if(v1 && v2) - myGmshSurface = gmshPolarSphere::NewPolarSphere - (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, - sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + - (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + - (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); + double p1,p2; + List_Read((yyvsp[(6) - (7)].l), 0, &p1); + List_Read((yyvsp[(6) - (7)].l), 1, &p2); + Vertex *v1 = FindPoint((int)p1); + Vertex *v2 = FindPoint((int)p2); + if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1); + if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2); + if(v1 && v2) + myGmshSurface = gmshPolarSphere::NewPolarSphere + (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, + sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + + (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + + (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); } (yyval.s).Type = 0; (yyval.s).Num = num; @@ -5333,17 +5337,17 @@ yyreduce: break; case 115: -#line 1402 "Gmsh.y" +#line 1406 "Gmsh.y" { int num = (int)(yyvsp[(4) - (8)].d); if(FindSurfaceLoop(num)){ - yymsg(0, "Surface loop %d already exists", num); + yymsg(0, "Surface loop %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - SurfaceLoop *l = Create_SurfaceLoop(num, temp); - Tree_Add(GModel::current()->getGEOInternals()->SurfaceLoops, &l); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + SurfaceLoop *l = Create_SurfaceLoop(num, temp); + Tree_Add(GModel::current()->getGEOInternals()->SurfaceLoops, &l); + List_Delete(temp); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SURF_LOOP; @@ -5352,24 +5356,24 @@ yyreduce: break; case 116: -#line 1418 "Gmsh.y" +#line 1422 "Gmsh.y" { curPhysDim = 2; ;} break; case 117: -#line 1422 "Gmsh.y" +#line 1426 "Gmsh.y" { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){ - yymsg(0, "Physical surface %d already exists", num); + yymsg(0, "Physical surface %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_SURFACE; @@ -5378,17 +5382,17 @@ yyreduce: break; case 118: -#line 1438 "Gmsh.y" +#line 1442 "Gmsh.y" { int num = (int)(yyvsp[(4) - (8)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){ - yymsg(0, "Physical volume %d already exists", num); + yymsg(0, "Physical volume %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - List_T *S[4] = {temp, 0, 0, 0}; - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp, S); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + List_T *S[4] = {temp, 0, 0, 0}; + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp, S); + List_Delete(temp); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (8)].l)); @@ -5398,25 +5402,25 @@ yyreduce: break; case 119: -#line 1456 "Gmsh.y" +#line 1460 "Gmsh.y" { int num = (int)(yyvsp[(4) - (12)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){ - yymsg(0, "Physical surface %d already exists", num); + yymsg(0, "Physical surface %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (12)].l)); - List_T *S[4] = {0, 0, 0, 0}; - for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++){ - List_T *ll; - List_Read((yyvsp[(10) - (12)].l), i, &ll); - S[i] = ListOfDouble2ListOfInt(ll); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (12)].l)); + List_T *S[4] = {0, 0, 0, 0}; + for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++){ + List_T *ll; + List_Read((yyvsp[(10) - (12)].l), i, &ll); + S[i] = ListOfDouble2ListOfInt(ll); List_Delete(ll); - } - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); - List_Delete(temp); - for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++) - List_Delete(S[i]); + } + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); + List_Delete(temp); + for (int i = 0; i < List_Nbr((yyvsp[(10) - (12)].l)); i++) + List_Delete(S[i]); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (12)].l)); @@ -5428,17 +5432,17 @@ yyreduce: break; case 120: -#line 1483 "Gmsh.y" +#line 1487 "Gmsh.y" { int num = (int)(yyvsp[(4) - (8)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){ - yymsg(0, "Physical surface %d already exists", num); + yymsg(0, "Physical surface %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - List_T *S[4] = {0, 0, 0, 0}; - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + List_T *S[4] = {0, 0, 0, 0}; + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp, S); + List_Delete(temp); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (8)].l)); @@ -5448,17 +5452,17 @@ yyreduce: break; case 121: -#line 1500 "Gmsh.y" +#line 1504 "Gmsh.y" { int num = (int)(yyvsp[(4) - (8)].d); if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){ - yymsg(0, "Physical line %d already exists", num); + yymsg(0, "Physical line %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - List_T *S[4] = {temp, 0, 0, 0}; - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp, S); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + List_T *S[4] = {temp, 0, 0, 0}; + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp, S); + List_Delete(temp); List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(7) - (8)].l)); @@ -5468,19 +5472,19 @@ yyreduce: break; case 122: -#line 1520 "Gmsh.y" +#line 1524 "Gmsh.y" { yymsg(0, "'Complex Volume' command is deprecated: use 'Volume' instead"); int num = (int)(yyvsp[(4) - (8)].d); if(FindVolume(num)){ - yymsg(0, "Volume %d already exists", num); + yymsg(0, "Volume %d already exists", num); } else{ - Volume *v = Create_Volume(num, MSH_VOLUME); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - setVolumeSurfaces(v, temp); - List_Delete(temp); - Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); + Volume *v = Create_Volume(num, MSH_VOLUME); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + setVolumeSurfaces(v, temp); + List_Delete(temp); + Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_VOLUME; @@ -5489,18 +5493,18 @@ yyreduce: break; case 123: -#line 1538 "Gmsh.y" +#line 1542 "Gmsh.y" { int num = (int)(yyvsp[(3) - (7)].d); if(FindVolume(num)){ - yymsg(0, "Volume %d already exists", num); + yymsg(0, "Volume %d already exists", num); } else{ - Volume *v = Create_Volume(num, MSH_VOLUME); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - setVolumeSurfaces(v, temp); - List_Delete(temp); - Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); + Volume *v = Create_Volume(num, MSH_VOLUME); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + setVolumeSurfaces(v, temp); + List_Delete(temp); + Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_VOLUME; @@ -5509,7 +5513,7 @@ yyreduce: break; case 124: -#line 1556 "Gmsh.y" +#line 1560 "Gmsh.y" { #if defined(HAVE_OCC) std::vector<double> data; @@ -5525,24 +5529,24 @@ yyreduce: break; case 125: -#line 1570 "Gmsh.y" +#line 1574 "Gmsh.y" { curPhysDim = 3; ;} break; case 126: -#line 1574 "Gmsh.y" +#line 1578 "Gmsh.y" { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){ - yymsg(0, "Physical volume %d already exists", num); + yymsg(0, "Physical volume %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_VOLUME; @@ -5551,7 +5555,7 @@ yyreduce: break; case 127: -#line 1596 "Gmsh.y" +#line 1600 "Gmsh.y" { TranslateShapes((yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], (yyvsp[(4) - (5)].l)); (yyval.l) = (yyvsp[(4) - (5)].l); @@ -5559,7 +5563,7 @@ yyreduce: break; case 128: -#line 1601 "Gmsh.y" +#line 1605 "Gmsh.y" { RotateShapes((yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d), (yyvsp[(10) - (11)].l)); (yyval.l) = (yyvsp[(10) - (11)].l); @@ -5567,7 +5571,7 @@ yyreduce: break; case 129: -#line 1606 "Gmsh.y" +#line 1610 "Gmsh.y" { SymmetryShapes((yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], (yyvsp[(2) - (5)].v)[3], (yyvsp[(4) - (5)].l)); (yyval.l) = (yyvsp[(4) - (5)].l); @@ -5575,7 +5579,7 @@ yyreduce: break; case 130: -#line 1611 "Gmsh.y" +#line 1615 "Gmsh.y" { DilatShapes((yyvsp[(3) - (9)].v)[0], (yyvsp[(3) - (9)].v)[1], (yyvsp[(3) - (9)].v)[2], (yyvsp[(5) - (9)].d), (yyvsp[(8) - (9)].l)); (yyval.l) = (yyvsp[(8) - (9)].l); @@ -5583,7 +5587,7 @@ yyreduce: break; case 131: -#line 1616 "Gmsh.y" +#line 1620 "Gmsh.y" { (yyval.l) = List_Create(3, 3, sizeof(Shape)); if(!strcmp((yyvsp[(1) - (4)].c), "Duplicata")){ @@ -5606,7 +5610,7 @@ yyreduce: break; case 132: -#line 1636 "Gmsh.y" +#line 1640 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); IntersectCurvesWithSurface((yyvsp[(4) - (9)].l), (int)(yyvsp[(8) - (9)].d), (yyval.l)); @@ -5615,7 +5619,7 @@ yyreduce: break; case 133: -#line 1642 "Gmsh.y" +#line 1646 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape*)); List_T *tmp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l)); @@ -5626,141 +5630,141 @@ yyreduce: break; case 134: -#line 1652 "Gmsh.y" +#line 1656 "Gmsh.y" { (yyval.l) = (yyvsp[(1) - (1)].l); ;} break; case 135: -#line 1653 "Gmsh.y" +#line 1657 "Gmsh.y" { (yyval.l) = (yyvsp[(1) - (1)].l); ;} break; case 136: -#line 1658 "Gmsh.y" +#line 1662 "Gmsh.y" { (yyval.l) = List_Create(3, 3, sizeof(Shape)); ;} break; case 137: -#line 1662 "Gmsh.y" +#line 1666 "Gmsh.y" { List_Add((yyval.l), &(yyvsp[(2) - (2)].s)); ;} break; case 138: -#line 1666 "Gmsh.y" +#line 1670 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Vertex *v = FindPoint(std::abs(TheShape.Num)); - if(v){ - TheShape.Type = MSH_POINT; - List_Add((yyval.l), &TheShape); - } - else{ - GVertex *gv = GModel::current()->getVertexByTag(std::abs(TheShape.Num)); - if(gv){ - TheShape.Type = MSH_POINT_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown point %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Vertex *v = FindPoint(std::abs(TheShape.Num)); + if(v){ + TheShape.Type = MSH_POINT; + List_Add((yyval.l), &TheShape); + } + else{ + GVertex *gv = GModel::current()->getVertexByTag(std::abs(TheShape.Num)); + if(gv){ + TheShape.Type = MSH_POINT_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown point %d", TheShape.Num); + } } ;} break; case 139: -#line 1689 "Gmsh.y" +#line 1693 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Curve *c = FindCurve(std::abs(TheShape.Num)); - if(c){ - TheShape.Type = c->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GEdge *ge = GModel::current()->getEdgeByTag(std::abs(TheShape.Num)); - if(ge){ - TheShape.Type = MSH_SEGM_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown curve %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Curve *c = FindCurve(std::abs(TheShape.Num)); + if(c){ + TheShape.Type = c->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GEdge *ge = GModel::current()->getEdgeByTag(std::abs(TheShape.Num)); + if(ge){ + TheShape.Type = MSH_SEGM_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown curve %d", TheShape.Num); + } } ;} break; case 140: -#line 1712 "Gmsh.y" +#line 1716 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Surface *s = FindSurface(std::abs(TheShape.Num)); - if(s){ - TheShape.Type = s->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GFace *gf = GModel::current()->getFaceByTag(std::abs(TheShape.Num)); - if(gf){ - TheShape.Type = MSH_SURF_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown surface %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Surface *s = FindSurface(std::abs(TheShape.Num)); + if(s){ + TheShape.Type = s->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GFace *gf = GModel::current()->getFaceByTag(std::abs(TheShape.Num)); + if(gf){ + TheShape.Type = MSH_SURF_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown surface %d", TheShape.Num); + } } ;} break; case 141: -#line 1735 "Gmsh.y" +#line 1739 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Volume *v = FindVolume(std::abs(TheShape.Num)); - if(v){ - TheShape.Type = v->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GRegion *gr = GModel::current()->getRegionByTag(std::abs(TheShape.Num)); - if(gr){ - TheShape.Type = MSH_VOLUME_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown volume %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Volume *v = FindVolume(std::abs(TheShape.Num)); + if(v){ + TheShape.Type = v->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GRegion *gr = GModel::current()->getRegionByTag(std::abs(TheShape.Num)); + if(gr){ + TheShape.Type = MSH_VOLUME_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown volume %d", TheShape.Num); + } } ;} break; case 142: -#line 1763 "Gmsh.y" +#line 1767 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(List_Nbr((yyvsp[(7) - (8)].l)) == 4){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[4]; @@ -5778,13 +5782,13 @@ yyreduce: break; case 143: -#line 1785 "Gmsh.y" +#line 1789 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(List_Nbr((yyvsp[(12) - (14)].l)) == 0){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]}; @@ -5801,13 +5805,13 @@ yyreduce: break; case 144: -#line 1806 "Gmsh.y" +#line 1810 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(List_Nbr((yyvsp[(14) - (16)].l)) == 0){ int t = (int)(yyvsp[(4) - (16)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double pt1[3] = {(yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2]}; @@ -5825,13 +5829,13 @@ yyreduce: break; case 145: -#line 1827 "Gmsh.y" +#line 1831 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(List_Nbr((yyvsp[(10) - (12)].l)) == 1){ int t = (int)(yyvsp[(4) - (12)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -5848,20 +5852,20 @@ yyreduce: break; case 146: -#line 1847 "Gmsh.y" +#line 1851 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(!strcmp((yyvsp[(2) - (8)].c), "Union")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Union %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Union %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetUnion(vl); @@ -5872,14 +5876,14 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Intersection")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Intersection %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Intersection %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetIntersection(vl); @@ -5890,14 +5894,14 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Cut")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Cut %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Cut %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetCut(vl); @@ -5908,14 +5912,14 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Crack")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Crack %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Crack %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetCrack(vl); @@ -5926,7 +5930,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "PostView")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { if(List_Nbr((yyvsp[(7) - (8)].l)) > 0){ @@ -5945,13 +5949,13 @@ yyreduce: break; case 147: -#line 1941 "Gmsh.y" +#line 1945 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(!strcmp((yyvsp[(2) - (8)].c), "MathEval")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { gLevelset *ls = new gLevelsetMathEval((yyvsp[(7) - (8)].c), t); @@ -5967,7 +5971,7 @@ yyreduce: break; case 148: -#line 1960 "Gmsh.y" +#line 1964 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(!strcmp((yyvsp[(2) - (6)].c), "CutMesh")){ @@ -5984,13 +5988,13 @@ yyreduce: break; case 149: -#line 1975 "Gmsh.y" +#line 1979 "Gmsh.y" { #if defined(HAVE_DINTEGRATION) if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 1){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -6005,7 +6009,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Cone") && List_Nbr((yyvsp[(12) - (14)].l)) == 1){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -6020,7 +6024,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 2){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[2]; @@ -6036,7 +6040,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 3){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[3]; @@ -6052,7 +6056,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Ellipsoid") && List_Nbr((yyvsp[(12) - (14)].l)) == 3){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[3]; @@ -6068,7 +6072,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Quadric") && List_Nbr((yyvsp[(12) - (14)].l)) == 5){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[5]; @@ -6090,44 +6094,44 @@ yyreduce: break; case 150: -#line 2083 "Gmsh.y" +#line 2087 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - DeleteShape(TheShape.Type, TheShape.Num); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + DeleteShape(TheShape.Type, TheShape.Num); } List_Delete((yyvsp[(3) - (4)].l)); ;} break; case 151: -#line 2092 "Gmsh.y" +#line 2096 "Gmsh.y" { GModel::current()->getFields()->deleteField((int)(yyvsp[(4) - (6)].d)); ;} break; case 152: -#line 2096 "Gmsh.y" +#line 2100 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - delete PView::list[index]; - else - yymsg(0, "Unknown view %d", index); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + delete PView::list[index]; + else + yymsg(0, "Unknown view %d", index); } else - yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c)); + yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c)); #endif Free((yyvsp[(2) - (6)].c)); ;} break; case 153: -#line 2111 "Gmsh.y" +#line 2115 "Gmsh.y" { if(!strcmp((yyvsp[(2) - (3)].c), "Meshes") || !strcmp((yyvsp[(2) - (3)].c), "All")){ for(unsigned int i = 0; i < GModel::list.size(); i++){ @@ -6136,216 +6140,216 @@ yyreduce: } } else if(!strcmp((yyvsp[(2) - (3)].c), "Model")){ - GModel::current()->destroy(); - GModel::current()->getGEOInternals()->destroy(); + GModel::current()->destroy(); + GModel::current()->getGEOInternals()->destroy(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Physicals")){ - GModel::current()->getGEOInternals()->reset_physicals(); - GModel::current()->deletePhysicalGroups(); + GModel::current()->getGEOInternals()->reset_physicals(); + GModel::current()->deletePhysicalGroups(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Variables")){ - gmsh_yysymbols.clear(); + gmsh_yysymbols.clear(); } else{ - if(gmsh_yysymbols.count((yyvsp[(2) - (3)].c))) - gmsh_yysymbols.erase((yyvsp[(2) - (3)].c)); - else - yymsg(0, "Unknown object or expression to delete '%s'", (yyvsp[(2) - (3)].c)); + if(gmsh_yysymbols.count((yyvsp[(2) - (3)].c))) + gmsh_yysymbols.erase((yyvsp[(2) - (3)].c)); + else + yymsg(0, "Unknown object or expression to delete '%s'", (yyvsp[(2) - (3)].c)); } Free((yyvsp[(2) - (3)].c)); ;} break; case 154: -#line 2138 "Gmsh.y" +#line 2142 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (4)].c), "Empty") && !strcmp((yyvsp[(3) - (4)].c), "Views")){ - for(int i = PView::list.size() - 1; i >= 0; i--) - if(PView::list[i]->getData()->empty()) delete PView::list[i]; + for(int i = PView::list.size() - 1; i >= 0; i--) + if(PView::list[i]->getData()->empty()) delete PView::list[i]; } else - yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c)); + yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c)); #endif Free((yyvsp[(2) - (4)].c)); Free((yyvsp[(3) - (4)].c)); ;} break; case 155: -#line 2155 "Gmsh.y" +#line 2159 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(4) - (5)].l), i, &TheShape); - ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(2) - (5)].u)); + Shape TheShape; + List_Read((yyvsp[(4) - (5)].l), i, &TheShape); + ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(2) - (5)].u)); } List_Delete((yyvsp[(4) - (5)].l)); ;} break; case 156: -#line 2169 "Gmsh.y" +#line 2173 "Gmsh.y" { for(int i = 0; i < 4; i++) - VisibilityShape((yyvsp[(2) - (3)].c), i, 1); + VisibilityShape((yyvsp[(2) - (3)].c), i, 1); Free((yyvsp[(2) - (3)].c)); ;} break; case 157: -#line 2175 "Gmsh.y" +#line 2179 "Gmsh.y" { for(int i = 0; i < 4; i++) - VisibilityShape((yyvsp[(2) - (3)].c), i, 0); + VisibilityShape((yyvsp[(2) - (3)].c), i, 0); Free((yyvsp[(2) - (3)].c)); ;} break; case 158: -#line 2181 "Gmsh.y" +#line 2185 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, 1); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + VisibilityShape(TheShape.Type, TheShape.Num, 1); } List_Delete((yyvsp[(3) - (4)].l)); ;} break; case 159: -#line 2190 "Gmsh.y" +#line 2194 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, 0); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + VisibilityShape(TheShape.Type, TheShape.Num, 0); } List_Delete((yyvsp[(3) - (4)].l)); ;} break; case 160: -#line 2204 "Gmsh.y" +#line 2208 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (3)].c), "Include")){ - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - // Warning: we *don't* close included files (to allow user - // functions in these files). If you need to include many many - // files and don't have functions in the files, use "Merge" - // instead: some OSes limit the number of files a process can - // open simultaneously. The right solution would be of course - // to modify FunctionManager to reopen the files instead of - // using the FILE pointer, but hey, I'm lazy... - Msg::StatusBar(2, true, "Reading '%s'", tmpstring); - ParseFile(tmpstring, false, true); - SetBoundingBox(); - Msg::StatusBar(2, true, "Read '%s'", tmpstring); + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + // Warning: we *don't* close included files (to allow user + // functions in these files). If you need to include many many + // files and don't have functions in the files, use "Merge" + // instead: some OSes limit the number of files a process can + // open simultaneously. The right solution would be of course + // to modify FunctionManager to reopen the files instead of + // using the FILE pointer, but hey, I'm lazy... + Msg::StatusBar(2, true, "Reading '%s'", tmpstring); + ParseFile(tmpstring, false, true); + SetBoundingBox(); + Msg::StatusBar(2, true, "Read '%s'", tmpstring); } else if(!strcmp((yyvsp[(1) - (3)].c), "Print")){ #if defined(HAVE_FLTK) - // make sure we have the latest data from GEO_Internals in GModel - // (fixes bug where we would have no geometry in the picture if - // the print command is in the same file as the geometry) - GModel::current()->importGEOInternals(); - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - CreateOutputFile(tmpstring, CTX::instance()->print.format); + // make sure we have the latest data from GEO_Internals in GModel + // (fixes bug where we would have no geometry in the picture if + // the print command is in the same file as the geometry) + GModel::current()->importGEOInternals(); + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + CreateOutputFile(tmpstring, CTX::instance()->print.format); #endif } else if(!strcmp((yyvsp[(1) - (3)].c), "Save")){ #if defined(HAVE_FLTK) - GModel::current()->importGEOInternals(); - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - CreateOutputFile(tmpstring, CTX::instance()->mesh.format); + GModel::current()->importGEOInternals(); + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + CreateOutputFile(tmpstring, CTX::instance()->mesh.format); #endif } else if(!strcmp((yyvsp[(1) - (3)].c), "Merge") || !strcmp((yyvsp[(1) - (3)].c), "MergeWithBoundingBox")){ - // MergeWithBoundingBox is deprecated - char tmpstring[1024]; - FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); - MergeFile(tmpstring, true); + // MergeWithBoundingBox is deprecated + char tmpstring[1024]; + FixRelativePath((yyvsp[(2) - (3)].c), tmpstring); + MergeFile(tmpstring, true); } else if(!strcmp((yyvsp[(1) - (3)].c), "System")) - SystemCall((yyvsp[(2) - (3)].c)); + SystemCall((yyvsp[(2) - (3)].c)); else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(2) - (3)].c)); ;} break; case 161: -#line 2252 "Gmsh.y" +#line 2256 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(1) - (7)].c), "Save") && !strcmp((yyvsp[(2) - (7)].c), "View")){ - int index = (int)(yyvsp[(4) - (7)].d); - if(index >= 0 && index < (int)PView::list.size()){ - char tmpstring[1024]; - FixRelativePath((yyvsp[(6) - (7)].c), tmpstring); - PView::list[index]->write(tmpstring, CTX::instance()->post.fileFormat); - } - else - yymsg(0, "Unknown view %d", index); + int index = (int)(yyvsp[(4) - (7)].d); + if(index >= 0 && index < (int)PView::list.size()){ + char tmpstring[1024]; + FixRelativePath((yyvsp[(6) - (7)].c), tmpstring); + PView::list[index]->write(tmpstring, CTX::instance()->post.fileFormat); + } + else + yymsg(0, "Unknown view %d", index); } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); #endif Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} break; case 162: -#line 2270 "Gmsh.y" +#line 2274 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(1) - (7)].c), "Background") && !strcmp((yyvsp[(2) - (7)].c), "Mesh") && !strcmp((yyvsp[(3) - (7)].c), "View")){ - int index = (int)(yyvsp[(5) - (7)].d); - if(index >= 0 && index < (int)PView::list.size()) - GModel::current()->getFields()->setBackgroundMesh(index); - else - yymsg(0, "Unknown view %d", index); + int index = (int)(yyvsp[(5) - (7)].d); + if(index >= 0 && index < (int)PView::list.size()) + GModel::current()->getFields()->setBackgroundMesh(index); + else + yymsg(0, "Unknown view %d", index); } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); #endif Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(3) - (7)].c)); ;} break; case 163: -#line 2285 "Gmsh.y" +#line 2289 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (3)].c), "Sleep")){ - SleepInSeconds((yyvsp[(2) - (3)].d)); + SleepInSeconds((yyvsp[(2) - (3)].d)); } else if(!strcmp((yyvsp[(1) - (3)].c), "Remesh")){ - yymsg(0, "Surface remeshing must be reinterfaced"); + yymsg(0, "Surface remeshing must be reinterfaced"); } else if(!strcmp((yyvsp[(1) - (3)].c), "Mesh")){ - int lock = CTX::instance()->lock; - CTX::instance()->lock = 0; - GModel::current()->importGEOInternals(); - GModel::current()->mesh((int)(yyvsp[(2) - (3)].d)); - CTX::instance()->lock = lock; + int lock = CTX::instance()->lock; + CTX::instance()->lock = 0; + GModel::current()->importGEOInternals(); + GModel::current()->mesh((int)(yyvsp[(2) - (3)].d)); + CTX::instance()->lock = lock; } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); Free((yyvsp[(1) - (3)].c)); ;} break; case 164: -#line 2304 "Gmsh.y" +#line 2308 "Gmsh.y" { #if !defined(HAVE_NO_POST) try { - PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0); + PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0); } catch(...) { - yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c)); + yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c)); } #endif Free((yyvsp[(3) - (7)].c)); Free((yyvsp[(6) - (7)].c)); @@ -6353,41 +6357,41 @@ yyreduce: break; case 165: -#line 2316 "Gmsh.y" +#line 2320 "Gmsh.y" { #if !defined(HAVE_NO_POST) if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromAllViews")) - PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromVisibleViews")) - PView::combine(false, 0, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 0, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "ElementsByViewName")) - PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsFromAllViews")) - PView::combine(true, 1, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 1, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsFromVisibleViews")) - PView::combine(true, 0, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 0, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsByViewName")) - PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "Views")) - PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeSteps")) - PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); else - yymsg(0, "Unknown 'Combine' command"); + yymsg(0, "Unknown 'Combine' command"); #endif Free((yyvsp[(2) - (3)].c)); ;} break; case 166: -#line 2340 "Gmsh.y" +#line 2344 "Gmsh.y" { exit(0); ;} break; case 167: -#line 2344 "Gmsh.y" +#line 2348 "Gmsh.y" { // FIXME: this is a hack to force a transfer from the old DB to // the new DB. This will become unnecessary if/when we fill the @@ -6397,7 +6401,7 @@ yyreduce: break; case 168: -#line 2351 "Gmsh.y" +#line 2355 "Gmsh.y" { CTX::instance()->forcedBBox = 0; GModel::current()->importGEOInternals(); @@ -6406,7 +6410,7 @@ yyreduce: break; case 169: -#line 2357 "Gmsh.y" +#line 2361 "Gmsh.y" { CTX::instance()->forcedBBox = 1; SetBoundingBox((yyvsp[(3) - (15)].d), (yyvsp[(5) - (15)].d), (yyvsp[(7) - (15)].d), (yyvsp[(9) - (15)].d), (yyvsp[(11) - (15)].d), (yyvsp[(13) - (15)].d)); @@ -6414,23 +6418,23 @@ yyreduce: break; case 170: -#line 2362 "Gmsh.y" +#line 2366 "Gmsh.y" { #if defined(HAVE_FLTK) - Draw(); + drawContext::global()->draw(); #endif ;} break; case 171: -#line 2368 "Gmsh.y" +#line 2372 "Gmsh.y" { GModel::current()->createTopologyFromMesh(); ;} break; case 172: -#line 2377 "Gmsh.y" +#line 2381 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (6)].d); LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (6)].d); @@ -6439,18 +6443,18 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if((yyvsp[(3) - (6)].d) > (yyvsp[(5) - (6)].d)) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; case 173: -#line 2394 "Gmsh.y" +#line 2398 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (8)].d); LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (8)].d); @@ -6459,18 +6463,18 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if(((yyvsp[(7) - (8)].d) > 0. && (yyvsp[(3) - (8)].d) > (yyvsp[(5) - (8)].d)) || ((yyvsp[(7) - (8)].d) < 0. && (yyvsp[(3) - (8)].d) < (yyvsp[(5) - (8)].d))) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; case 174: -#line 2411 "Gmsh.y" +#line 2415 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (8)].d); LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (8)].d); @@ -6481,18 +6485,18 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if((yyvsp[(5) - (8)].d) > (yyvsp[(7) - (8)].d)) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; case 175: -#line 2430 "Gmsh.y" +#line 2434 "Gmsh.y" { LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (10)].d); LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (10)].d); @@ -6503,451 +6507,451 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if(((yyvsp[(9) - (10)].d) > 0. && (yyvsp[(5) - (10)].d) > (yyvsp[(7) - (10)].d)) || ((yyvsp[(9) - (10)].d) < 0. && (yyvsp[(5) - (10)].d) < (yyvsp[(7) - (10)].d))) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; case 176: -#line 2449 "Gmsh.y" +#line 2453 "Gmsh.y" { if(ImbricatedLoop <= 0){ - yymsg(0, "Invalid For/EndFor loop"); - ImbricatedLoop = 0; + yymsg(0, "Invalid For/EndFor loop"); + ImbricatedLoop = 0; } else{ - double x0 = LoopControlVariablesTab[ImbricatedLoop - 1][0]; - double x1 = LoopControlVariablesTab[ImbricatedLoop - 1][1]; - double step = LoopControlVariablesTab[ImbricatedLoop - 1][2]; - int do_next = (step > 0.) ? (x0 + step <= x1) : (x0 + step >= x1); - if(do_next){ - LoopControlVariablesTab[ImbricatedLoop - 1][0] += - LoopControlVariablesTab[ImbricatedLoop - 1][2]; - if(LoopControlVariablesNameTab[ImbricatedLoop - 1]){ - if(!gmsh_yysymbols.count(LoopControlVariablesNameTab[ImbricatedLoop - 1])) - yymsg(0, "Unknown loop variable"); - else - gmsh_yysymbols[LoopControlVariablesNameTab[ImbricatedLoop - 1]][0] += - LoopControlVariablesTab[ImbricatedLoop - 1][2]; - } - fsetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop - 1]); - gmsh_yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop - 1]; - } - else - ImbricatedLoop--; + double x0 = LoopControlVariablesTab[ImbricatedLoop - 1][0]; + double x1 = LoopControlVariablesTab[ImbricatedLoop - 1][1]; + double step = LoopControlVariablesTab[ImbricatedLoop - 1][2]; + int do_next = (step > 0.) ? (x0 + step <= x1) : (x0 + step >= x1); + if(do_next){ + LoopControlVariablesTab[ImbricatedLoop - 1][0] += + LoopControlVariablesTab[ImbricatedLoop - 1][2]; + if(LoopControlVariablesNameTab[ImbricatedLoop - 1]){ + if(!gmsh_yysymbols.count(LoopControlVariablesNameTab[ImbricatedLoop - 1])) + yymsg(0, "Unknown loop variable"); + else + gmsh_yysymbols[LoopControlVariablesNameTab[ImbricatedLoop - 1]][0] += + LoopControlVariablesTab[ImbricatedLoop - 1][2]; + } + fsetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop - 1]); + gmsh_yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop - 1]; + } + else + ImbricatedLoop--; } ;} break; case 177: -#line 2477 "Gmsh.y" +#line 2481 "Gmsh.y" { if(!FunctionManager::Instance()->createFunction ((yyvsp[(2) - (2)].c), gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c)); + yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c)); skip_until(NULL, "Return"); //FIXME: wee leak $2 ;} break; case 178: -#line 2485 "Gmsh.y" +#line 2489 "Gmsh.y" { if(!FunctionManager::Instance()->leaveFunction (&gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Error while exiting function"); + yymsg(0, "Error while exiting function"); ;} break; case 179: -#line 2491 "Gmsh.y" +#line 2495 "Gmsh.y" { if(!FunctionManager::Instance()->enterFunction ((yyvsp[(2) - (3)].c), &gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c)); + yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c)); //FIXME: wee leak $2 ;} break; case 180: -#line 2498 "Gmsh.y" +#line 2502 "Gmsh.y" { if(!(yyvsp[(3) - (4)].d)) skip_until("If", "EndIf"); ;} break; case 181: -#line 2502 "Gmsh.y" +#line 2506 "Gmsh.y" { ;} break; case 182: -#line 2511 "Gmsh.y" +#line 2515 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (5)].l), - (yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); List_Delete((yyvsp[(4) - (5)].l)); ;} break; case 183: -#line 2519 "Gmsh.y" +#line 2523 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, (yyvsp[(10) - (11)].l), - 0., 0., 0., (yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d), + NULL, (yyval.l)); List_Delete((yyvsp[(10) - (11)].l)); ;} break; case 184: -#line 2527 "Gmsh.y" +#line 2531 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (13)].l), - (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].v)[0], (yyvsp[(7) - (13)].v)[1], (yyvsp[(7) - (13)].v)[2], (yyvsp[(9) - (13)].d), - NULL, (yyval.l)); + (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].v)[0], (yyvsp[(7) - (13)].v)[1], (yyvsp[(7) - (13)].v)[2], (yyvsp[(9) - (13)].d), + NULL, (yyval.l)); List_Delete((yyvsp[(12) - (13)].l)); ;} break; case 185: -#line 2535 "Gmsh.y" +#line 2539 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 186: -#line 2539 "Gmsh.y" +#line 2543 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (7)].l), - (yyvsp[(2) - (7)].v)[0], (yyvsp[(2) - (7)].v)[1], (yyvsp[(2) - (7)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(2) - (7)].v)[0], (yyvsp[(2) - (7)].v)[1], (yyvsp[(2) - (7)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); List_Delete((yyvsp[(4) - (7)].l)); ;} break; case 187: -#line 2547 "Gmsh.y" +#line 2551 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 188: -#line 2551 "Gmsh.y" +#line 2555 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, (yyvsp[(10) - (13)].l), - 0., 0., 0., (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].d), + &extr, (yyval.l)); List_Delete((yyvsp[(10) - (13)].l)); ;} break; case 189: -#line 2559 "Gmsh.y" +#line 2563 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 190: -#line 2563 "Gmsh.y" +#line 2567 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (15)].l), - (yyvsp[(3) - (15)].v)[0], (yyvsp[(3) - (15)].v)[1], (yyvsp[(3) - (15)].v)[2], (yyvsp[(5) - (15)].v)[0], (yyvsp[(5) - (15)].v)[1], (yyvsp[(5) - (15)].v)[2], (yyvsp[(7) - (15)].v)[0], (yyvsp[(7) - (15)].v)[1], (yyvsp[(7) - (15)].v)[2], (yyvsp[(9) - (15)].d), - &extr, (yyval.l)); + (yyvsp[(3) - (15)].v)[0], (yyvsp[(3) - (15)].v)[1], (yyvsp[(3) - (15)].v)[2], (yyvsp[(5) - (15)].v)[0], (yyvsp[(5) - (15)].v)[1], (yyvsp[(5) - (15)].v)[2], (yyvsp[(7) - (15)].v)[0], (yyvsp[(7) - (15)].v)[1], (yyvsp[(7) - (15)].v)[2], (yyvsp[(9) - (15)].d), + &extr, (yyval.l)); List_Delete((yyvsp[(12) - (15)].l)); ;} break; case 191: -#line 2571 "Gmsh.y" +#line 2575 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 192: -#line 2575 "Gmsh.y" +#line 2579 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(BOUNDARY_LAYER, (yyvsp[(3) - (6)].l), 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + &extr, (yyval.l)); List_Delete((yyvsp[(3) - (6)].l)); ;} break; case 193: -#line 2584 "Gmsh.y" +#line 2588 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; case 194: -#line 2591 "Gmsh.y" +#line 2595 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; case 195: -#line 2598 "Gmsh.y" +#line 2602 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; case 196: -#line 2605 "Gmsh.y" +#line 2609 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; case 197: -#line 2612 "Gmsh.y" +#line 2616 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; case 198: -#line 2619 "Gmsh.y" +#line 2623 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; case 199: -#line 2626 "Gmsh.y" +#line 2630 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; case 200: -#line 2633 "Gmsh.y" +#line 2637 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; case 201: -#line 2640 "Gmsh.y" +#line 2644 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; case 202: -#line 2647 "Gmsh.y" +#line 2651 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 203: -#line 2651 "Gmsh.y" +#line 2655 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; case 204: -#line 2658 "Gmsh.y" +#line 2662 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 205: -#line 2662 "Gmsh.y" +#line 2666 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; case 206: -#line 2669 "Gmsh.y" +#line 2673 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 207: -#line 2673 "Gmsh.y" +#line 2677 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; case 208: -#line 2680 "Gmsh.y" +#line 2684 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 209: -#line 2684 "Gmsh.y" +#line 2688 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; case 210: -#line 2691 "Gmsh.y" +#line 2695 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 211: -#line 2695 "Gmsh.y" +#line 2699 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; case 212: -#line 2702 "Gmsh.y" +#line 2706 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 213: -#line 2706 "Gmsh.y" +#line 2710 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; case 214: -#line 2713 "Gmsh.y" +#line 2717 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 215: -#line 2717 "Gmsh.y" +#line 2721 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; case 216: -#line 2724 "Gmsh.y" +#line 2728 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 217: -#line 2728 "Gmsh.y" +#line 2732 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; case 218: -#line 2735 "Gmsh.y" +#line 2739 "Gmsh.y" { extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false; ;} break; case 219: -#line 2739 "Gmsh.y" +#line 2743 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; case 220: -#line 2750 "Gmsh.y" +#line 2754 "Gmsh.y" { ;} break; case 221: -#line 2753 "Gmsh.y" +#line 2757 "Gmsh.y" { ;} break; case 222: -#line 2759 "Gmsh.y" +#line 2763 "Gmsh.y" { extr.mesh.ExtrudeMesh = true; extr.mesh.NbLayer = 1; @@ -6959,48 +6963,48 @@ yyreduce: break; case 223: -#line 2768 "Gmsh.y" +#line 2772 "Gmsh.y" { extr.mesh.ExtrudeMesh = true; extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (7)].l)); if(List_Nbr((yyvsp[(3) - (7)].l)) == List_Nbr((yyvsp[(5) - (7)].l))){ - extr.mesh.NbElmLayer.clear(); - extr.mesh.hLayer.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(3) - (7)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (7)].l), i, &d); - extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); - List_Read((yyvsp[(5) - (7)].l), i, &d); - extr.mesh.hLayer.push_back(d); - } + extr.mesh.NbElmLayer.clear(); + extr.mesh.hLayer.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(3) - (7)].l)); i++){ + double d; + List_Read((yyvsp[(3) - (7)].l), i, &d); + extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); + List_Read((yyvsp[(5) - (7)].l), i, &d); + extr.mesh.hLayer.push_back(d); + } } else - yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l))); + yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l))); List_Delete((yyvsp[(3) - (7)].l)); List_Delete((yyvsp[(5) - (7)].l)); ;} break; case 224: -#line 2788 "Gmsh.y" +#line 2792 "Gmsh.y" { yymsg(0, "Explicit region numbers in layers are deprecated"); extr.mesh.ExtrudeMesh = true; extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (9)].l)); if(List_Nbr((yyvsp[(3) - (9)].l)) == List_Nbr((yyvsp[(5) - (9)].l)) && List_Nbr((yyvsp[(3) - (9)].l)) == List_Nbr((yyvsp[(7) - (9)].l))){ - extr.mesh.NbElmLayer.clear(); - extr.mesh.hLayer.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (9)].l), i, &d); - extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); - List_Read((yyvsp[(7) - (9)].l), i, &d); - extr.mesh.hLayer.push_back(d); - } + extr.mesh.NbElmLayer.clear(); + extr.mesh.hLayer.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){ + double d; + List_Read((yyvsp[(3) - (9)].l), i, &d); + extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); + List_Read((yyvsp[(7) - (9)].l), i, &d); + extr.mesh.hLayer.push_back(d); + } } else - yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), - List_Nbr((yyvsp[(5) - (9)].l)), List_Nbr((yyvsp[(7) - (9)].l))); + yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), + List_Nbr((yyvsp[(5) - (9)].l)), List_Nbr((yyvsp[(7) - (9)].l))); List_Delete((yyvsp[(3) - (9)].l)); List_Delete((yyvsp[(5) - (9)].l)); List_Delete((yyvsp[(7) - (9)].l)); @@ -7008,43 +7012,43 @@ yyreduce: break; case 225: -#line 2811 "Gmsh.y" +#line 2815 "Gmsh.y" { extr.mesh.Recombine = true; ;} break; case 226: -#line 2815 "Gmsh.y" +#line 2819 "Gmsh.y" { int num = (int)(yyvsp[(3) - (9)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - Surface *s = Create_Surface(num, MSH_SURF_DISCRETE); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); - extr.mesh.Holes[num].first = (yyvsp[(8) - (9)].d); - extr.mesh.Holes[num].second.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(6) - (9)].l)); i++){ - double d; - List_Read((yyvsp[(6) - (9)].l), i, &d); - extr.mesh.Holes[num].second.push_back((int)d); - } + Surface *s = Create_Surface(num, MSH_SURF_DISCRETE); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + extr.mesh.Holes[num].first = (yyvsp[(8) - (9)].d); + extr.mesh.Holes[num].second.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(6) - (9)].l)); i++){ + double d; + List_Read((yyvsp[(6) - (9)].l), i, &d); + extr.mesh.Holes[num].second.push_back((int)d); + } } List_Delete((yyvsp[(6) - (9)].l)); ;} break; case 227: -#line 2838 "Gmsh.y" +#line 2842 "Gmsh.y" { (yyval.v)[0] = (yyval.v)[1] = 1.; ;} break; case 228: -#line 2842 "Gmsh.y" +#line 2846 "Gmsh.y" { if(!strcmp((yyvsp[(2) - (3)].c), "Progression") || !strcmp((yyvsp[(2) - (3)].c), "Power")) (yyval.v)[0] = 1.; @@ -7060,14 +7064,14 @@ yyreduce: break; case 229: -#line 2857 "Gmsh.y" +#line 2861 "Gmsh.y" { (yyval.i) = -1; // left ;} break; case 230: -#line 2861 "Gmsh.y" +#line 2865 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (1)].c), "Right")) (yyval.i) = 1; @@ -7080,35 +7084,35 @@ yyreduce: break; case 231: -#line 2873 "Gmsh.y" +#line 2877 "Gmsh.y" { (yyval.l) = List_Create(1, 1, sizeof(double)); ;} break; case 232: -#line 2877 "Gmsh.y" +#line 2881 "Gmsh.y" { (yyval.l) = (yyvsp[(2) - (2)].l); ;} break; case 233: -#line 2882 "Gmsh.y" +#line 2886 "Gmsh.y" { (yyval.i) = 45; ;} break; case 234: -#line 2886 "Gmsh.y" +#line 2890 "Gmsh.y" { (yyval.i) = (int)(yyvsp[(2) - (2)].d); ;} break; case 235: -#line 2893 "Gmsh.y" +#line 2897 "Gmsh.y" { int type = (int)(yyvsp[(6) - (7)].v)[0]; double coef = fabs((yyvsp[(6) - (7)].v)[1]); @@ -7167,7 +7171,7 @@ yyreduce: break; case 236: -#line 2949 "Gmsh.y" +#line 2953 "Gmsh.y" { int k = List_Nbr((yyvsp[(4) - (6)].l)); if(k != 0 && k != 3 && k != 4){ @@ -7240,7 +7244,7 @@ yyreduce: break; case 237: -#line 3019 "Gmsh.y" +#line 3023 "Gmsh.y" { yymsg(1, "Elliptic Surface is deprecated: use Transfinite instead (with smoothing)"); List_Delete((yyvsp[(7) - (8)].l)); @@ -7248,7 +7252,7 @@ yyreduce: break; case 238: -#line 3024 "Gmsh.y" +#line 3028 "Gmsh.y" { int k = List_Nbr((yyvsp[(4) - (5)].l)); if(k != 0 && k != 6 && k != 8){ @@ -7318,10 +7322,10 @@ yyreduce: break; case 239: -#line 3091 "Gmsh.y" +#line 3095 "Gmsh.y" { if(!(yyvsp[(3) - (5)].l)){ - List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces); + List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces); if(List_Nbr(tmp)){ for(int i = 0; i < List_Nbr(tmp); i++){ Surface *s; @@ -7364,22 +7368,22 @@ yyreduce: break; case 240: -#line 3134 "Gmsh.y" +#line 3138 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (6)].l), i, &d); - int j = (int)d; - Surface *s = FindSurface(j); - if(s){ + double d; + List_Read((yyvsp[(3) - (6)].l), i, &d); + int j = (int)d; + Surface *s = FindSurface(j); + if(s){ s->TransfiniteSmoothing = (int)(yyvsp[(5) - (6)].d); } else{ - GFace *gf = GModel::current()->getFaceByTag(j); - if(gf) + GFace *gf = GModel::current()->getFaceByTag(j); + if(gf) gf->meshAttributes.transfiniteSmoothing = (int)(yyvsp[(5) - (6)].d); else - yymsg(1, "Unknown surface %d", (int)(yyvsp[(5) - (6)].d)); + yymsg(1, "Unknown surface %d", (int)(yyvsp[(5) - (6)].d)); } } List_Delete((yyvsp[(3) - (6)].l)); @@ -7387,11 +7391,11 @@ yyreduce: break; case 241: -#line 3160 "Gmsh.y" +#line 3164 "Gmsh.y" { Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d)); if(s){ - setSurfaceEmbeddedPoints(s, (yyvsp[(3) - (10)].l)); + setSurfaceEmbeddedPoints(s, (yyvsp[(3) - (10)].l)); } else{ GFace *gf = GModel::current()->getFaceByTag((int)(yyvsp[(8) - (10)].d)); @@ -7413,11 +7417,11 @@ yyreduce: break; case 242: -#line 3183 "Gmsh.y" +#line 3187 "Gmsh.y" { Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d)); if(s){ - setSurfaceEmbeddedCurves(s, (yyvsp[(3) - (10)].l)); + setSurfaceEmbeddedCurves(s, (yyvsp[(3) - (10)].l)); } else{ GFace *gf = GModel::current()->getFaceByTag((int)(yyvsp[(8) - (10)].d)); @@ -7439,26 +7443,26 @@ yyreduce: break; case 243: -#line 3206 "Gmsh.y" +#line 3210 "Gmsh.y" { ;} break; case 244: -#line 3209 "Gmsh.y" +#line 3213 "Gmsh.y" { ;} break; case 245: -#line 3218 "Gmsh.y" +#line 3222 "Gmsh.y" { ReplaceAllDuplicates(); ;} break; case 246: -#line 3222 "Gmsh.y" +#line 3226 "Gmsh.y" { if(!strcmp((yyvsp[(2) - (3)].c), "Geometry")) ReplaceAllDuplicates(); @@ -7471,447 +7475,447 @@ yyreduce: break; case 247: -#line 3237 "Gmsh.y" +#line 3241 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (1)].d); ;} break; case 248: -#line 3238 "Gmsh.y" +#line 3242 "Gmsh.y" { (yyval.d) = (yyvsp[(2) - (3)].d); ;} break; case 249: -#line 3239 "Gmsh.y" +#line 3243 "Gmsh.y" { (yyval.d) = -(yyvsp[(2) - (2)].d); ;} break; case 250: -#line 3240 "Gmsh.y" +#line 3244 "Gmsh.y" { (yyval.d) = (yyvsp[(2) - (2)].d); ;} break; case 251: -#line 3241 "Gmsh.y" +#line 3245 "Gmsh.y" { (yyval.d) = !(yyvsp[(2) - (2)].d); ;} break; case 252: -#line 3242 "Gmsh.y" +#line 3246 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) - (yyvsp[(3) - (3)].d); ;} break; case 253: -#line 3243 "Gmsh.y" +#line 3247 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) + (yyvsp[(3) - (3)].d); ;} break; case 254: -#line 3244 "Gmsh.y" +#line 3248 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) * (yyvsp[(3) - (3)].d); ;} break; case 255: -#line 3246 "Gmsh.y" +#line 3250 "Gmsh.y" { if(!(yyvsp[(3) - (3)].d)) - yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d)); + yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d)); else - (yyval.d) = (yyvsp[(1) - (3)].d) / (yyvsp[(3) - (3)].d); + (yyval.d) = (yyvsp[(1) - (3)].d) / (yyvsp[(3) - (3)].d); ;} break; case 256: -#line 3252 "Gmsh.y" +#line 3256 "Gmsh.y" { (yyval.d) = (int)(yyvsp[(1) - (3)].d) % (int)(yyvsp[(3) - (3)].d); ;} break; case 257: -#line 3253 "Gmsh.y" +#line 3257 "Gmsh.y" { (yyval.d) = pow((yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d)); ;} break; case 258: -#line 3254 "Gmsh.y" +#line 3258 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d); ;} break; case 259: -#line 3255 "Gmsh.y" +#line 3259 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) > (yyvsp[(3) - (3)].d); ;} break; case 260: -#line 3256 "Gmsh.y" +#line 3260 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) <= (yyvsp[(3) - (3)].d); ;} break; case 261: -#line 3257 "Gmsh.y" +#line 3261 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) >= (yyvsp[(3) - (3)].d); ;} break; case 262: -#line 3258 "Gmsh.y" +#line 3262 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) == (yyvsp[(3) - (3)].d); ;} break; case 263: -#line 3259 "Gmsh.y" +#line 3263 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) != (yyvsp[(3) - (3)].d); ;} break; case 264: -#line 3260 "Gmsh.y" +#line 3264 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) && (yyvsp[(3) - (3)].d); ;} break; case 265: -#line 3261 "Gmsh.y" +#line 3265 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (3)].d) || (yyvsp[(3) - (3)].d); ;} break; case 266: -#line 3262 "Gmsh.y" +#line 3266 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (5)].d) ? (yyvsp[(3) - (5)].d) : (yyvsp[(5) - (5)].d); ;} break; case 267: -#line 3263 "Gmsh.y" +#line 3267 "Gmsh.y" { (yyval.d) = exp((yyvsp[(3) - (4)].d)); ;} break; case 268: -#line 3264 "Gmsh.y" +#line 3268 "Gmsh.y" { (yyval.d) = log((yyvsp[(3) - (4)].d)); ;} break; case 269: -#line 3265 "Gmsh.y" +#line 3269 "Gmsh.y" { (yyval.d) = log10((yyvsp[(3) - (4)].d)); ;} break; case 270: -#line 3266 "Gmsh.y" +#line 3270 "Gmsh.y" { (yyval.d) = sqrt((yyvsp[(3) - (4)].d)); ;} break; case 271: -#line 3267 "Gmsh.y" +#line 3271 "Gmsh.y" { (yyval.d) = sin((yyvsp[(3) - (4)].d)); ;} break; case 272: -#line 3268 "Gmsh.y" +#line 3272 "Gmsh.y" { (yyval.d) = asin((yyvsp[(3) - (4)].d)); ;} break; case 273: -#line 3269 "Gmsh.y" +#line 3273 "Gmsh.y" { (yyval.d) = cos((yyvsp[(3) - (4)].d)); ;} break; case 274: -#line 3270 "Gmsh.y" +#line 3274 "Gmsh.y" { (yyval.d) = acos((yyvsp[(3) - (4)].d)); ;} break; case 275: -#line 3271 "Gmsh.y" +#line 3275 "Gmsh.y" { (yyval.d) = tan((yyvsp[(3) - (4)].d)); ;} break; case 276: -#line 3272 "Gmsh.y" +#line 3276 "Gmsh.y" { (yyval.d) = atan((yyvsp[(3) - (4)].d)); ;} break; case 277: -#line 3273 "Gmsh.y" +#line 3277 "Gmsh.y" { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;} break; case 278: -#line 3274 "Gmsh.y" +#line 3278 "Gmsh.y" { (yyval.d) = sinh((yyvsp[(3) - (4)].d)); ;} break; case 279: -#line 3275 "Gmsh.y" +#line 3279 "Gmsh.y" { (yyval.d) = cosh((yyvsp[(3) - (4)].d)); ;} break; case 280: -#line 3276 "Gmsh.y" +#line 3280 "Gmsh.y" { (yyval.d) = tanh((yyvsp[(3) - (4)].d)); ;} break; case 281: -#line 3277 "Gmsh.y" +#line 3281 "Gmsh.y" { (yyval.d) = fabs((yyvsp[(3) - (4)].d)); ;} break; case 282: -#line 3278 "Gmsh.y" +#line 3282 "Gmsh.y" { (yyval.d) = floor((yyvsp[(3) - (4)].d)); ;} break; case 283: -#line 3279 "Gmsh.y" +#line 3283 "Gmsh.y" { (yyval.d) = ceil((yyvsp[(3) - (4)].d)); ;} break; case 284: -#line 3280 "Gmsh.y" +#line 3284 "Gmsh.y" { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;} break; case 285: -#line 3281 "Gmsh.y" +#line 3285 "Gmsh.y" { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;} break; case 286: -#line 3282 "Gmsh.y" +#line 3286 "Gmsh.y" { (yyval.d) = sqrt((yyvsp[(3) - (6)].d) * (yyvsp[(3) - (6)].d) + (yyvsp[(5) - (6)].d) * (yyvsp[(5) - (6)].d)); ;} break; case 287: -#line 3283 "Gmsh.y" +#line 3287 "Gmsh.y" { (yyval.d) = (yyvsp[(3) - (4)].d) * (double)rand() / (double)RAND_MAX; ;} break; case 288: -#line 3285 "Gmsh.y" +#line 3289 "Gmsh.y" { (yyval.d) = exp((yyvsp[(3) - (4)].d)); ;} break; case 289: -#line 3286 "Gmsh.y" +#line 3290 "Gmsh.y" { (yyval.d) = log((yyvsp[(3) - (4)].d)); ;} break; case 290: -#line 3287 "Gmsh.y" +#line 3291 "Gmsh.y" { (yyval.d) = log10((yyvsp[(3) - (4)].d)); ;} break; case 291: -#line 3288 "Gmsh.y" +#line 3292 "Gmsh.y" { (yyval.d) = sqrt((yyvsp[(3) - (4)].d)); ;} break; case 292: -#line 3289 "Gmsh.y" +#line 3293 "Gmsh.y" { (yyval.d) = sin((yyvsp[(3) - (4)].d)); ;} break; case 293: -#line 3290 "Gmsh.y" +#line 3294 "Gmsh.y" { (yyval.d) = asin((yyvsp[(3) - (4)].d)); ;} break; case 294: -#line 3291 "Gmsh.y" +#line 3295 "Gmsh.y" { (yyval.d) = cos((yyvsp[(3) - (4)].d)); ;} break; case 295: -#line 3292 "Gmsh.y" +#line 3296 "Gmsh.y" { (yyval.d) = acos((yyvsp[(3) - (4)].d)); ;} break; case 296: -#line 3293 "Gmsh.y" +#line 3297 "Gmsh.y" { (yyval.d) = tan((yyvsp[(3) - (4)].d)); ;} break; case 297: -#line 3294 "Gmsh.y" +#line 3298 "Gmsh.y" { (yyval.d) = atan((yyvsp[(3) - (4)].d)); ;} break; case 298: -#line 3295 "Gmsh.y" +#line 3299 "Gmsh.y" { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;} break; case 299: -#line 3296 "Gmsh.y" +#line 3300 "Gmsh.y" { (yyval.d) = sinh((yyvsp[(3) - (4)].d)); ;} break; case 300: -#line 3297 "Gmsh.y" +#line 3301 "Gmsh.y" { (yyval.d) = cosh((yyvsp[(3) - (4)].d)); ;} break; case 301: -#line 3298 "Gmsh.y" +#line 3302 "Gmsh.y" { (yyval.d) = tanh((yyvsp[(3) - (4)].d)); ;} break; case 302: -#line 3299 "Gmsh.y" +#line 3303 "Gmsh.y" { (yyval.d) = fabs((yyvsp[(3) - (4)].d)); ;} break; case 303: -#line 3300 "Gmsh.y" +#line 3304 "Gmsh.y" { (yyval.d) = floor((yyvsp[(3) - (4)].d)); ;} break; case 304: -#line 3301 "Gmsh.y" +#line 3305 "Gmsh.y" { (yyval.d) = ceil((yyvsp[(3) - (4)].d)); ;} break; case 305: -#line 3302 "Gmsh.y" +#line 3306 "Gmsh.y" { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;} break; case 306: -#line 3303 "Gmsh.y" +#line 3307 "Gmsh.y" { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;} break; case 307: -#line 3304 "Gmsh.y" +#line 3308 "Gmsh.y" { (yyval.d) = sqrt((yyvsp[(3) - (6)].d) * (yyvsp[(3) - (6)].d) + (yyvsp[(5) - (6)].d) * (yyvsp[(5) - (6)].d)); ;} break; case 308: -#line 3305 "Gmsh.y" +#line 3309 "Gmsh.y" { (yyval.d) = (yyvsp[(3) - (4)].d) * (double)rand() / (double)RAND_MAX; ;} break; case 309: -#line 3314 "Gmsh.y" +#line 3318 "Gmsh.y" { (yyval.d) = (yyvsp[(1) - (1)].d); ;} break; case 310: -#line 3315 "Gmsh.y" +#line 3319 "Gmsh.y" { (yyval.d) = 3.141592653589793; ;} break; case 311: -#line 3316 "Gmsh.y" +#line 3320 "Gmsh.y" { (yyval.d) = Msg::GetCommRank(); ;} break; case 312: -#line 3317 "Gmsh.y" +#line 3321 "Gmsh.y" { (yyval.d) = Msg::GetCommSize(); ;} break; case 313: -#line 3318 "Gmsh.y" +#line 3322 "Gmsh.y" { (yyval.d) = GetGmshMajorVersion(); ;} break; case 314: -#line 3319 "Gmsh.y" +#line 3323 "Gmsh.y" { (yyval.d) = GetGmshMinorVersion(); ;} break; case 315: -#line 3320 "Gmsh.y" +#line 3324 "Gmsh.y" { (yyval.d) = GetGmshPatchVersion(); ;} break; case 316: -#line 3325 "Gmsh.y" +#line 3329 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (1)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c)); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (1)].c)][0]; + (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (1)].c)][0]; Free((yyvsp[(1) - (1)].c)); ;} break; case 317: -#line 3338 "Gmsh.y" +#line 3342 "Gmsh.y" { char tmpstring[1024]; sprintf(tmpstring, "%s_%d", (yyvsp[(1) - (5)].c), (int)(yyvsp[(4) - (5)].d)) ; if(!gmsh_yysymbols.count(tmpstring)){ - yymsg(0, "Unknown variable '%s'", tmpstring); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", tmpstring); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[tmpstring][0]; + (yyval.d) = gmsh_yysymbols[tmpstring][0]; Free((yyvsp[(1) - (5)].c)); ;} break; case 318: -#line 3350 "Gmsh.y" +#line 3354 "Gmsh.y" { int index = (int)(yyvsp[(3) - (4)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); + (yyval.d) = 0.; } else if((int)gmsh_yysymbols[(yyvsp[(1) - (4)].c)].size() < index + 1){ - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), index); - (yyval.d) = 0.; + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), index); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (4)].c)][index]; + (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (4)].c)][index]; Free((yyvsp[(1) - (4)].c)); ;} break; case 319: -#line 3365 "Gmsh.y" +#line 3369 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(2) - (4)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c)); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(2) - (4)].c)].size(); + (yyval.d) = gmsh_yysymbols[(yyvsp[(2) - (4)].c)].size(); Free((yyvsp[(2) - (4)].c)); ;} break; case 320: -#line 3375 "Gmsh.y" +#line 3379 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (2)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c)); + (yyval.d) = 0.; } else - (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (2)].c)][0] += (yyvsp[(2) - (2)].i)); + (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (2)].c)][0] += (yyvsp[(2) - (2)].i)); Free((yyvsp[(1) - (2)].c)); ;} break; case 321: -#line 3385 "Gmsh.y" +#line 3389 "Gmsh.y" { int index = (int)(yyvsp[(3) - (5)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (5)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (5)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (5)].c)); + (yyval.d) = 0.; } else if((int)gmsh_yysymbols[(yyvsp[(1) - (5)].c)].size() < index + 1){ - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), index); - (yyval.d) = 0.; + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), index); + (yyval.d) = 0.; } else - (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (5)].c)][index] += (yyvsp[(5) - (5)].i)); + (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (5)].c)][index] += (yyvsp[(5) - (5)].i)); Free((yyvsp[(1) - (5)].c)); ;} break; case 322: -#line 3403 "Gmsh.y" +#line 3407 "Gmsh.y" { NumberOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), (yyval.d)); Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(3) - (3)].c)); @@ -7919,7 +7923,7 @@ yyreduce: break; case 323: -#line 3408 "Gmsh.y" +#line 3412 "Gmsh.y" { NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), (yyval.d)); Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(6) - (6)].c)); @@ -7927,33 +7931,33 @@ yyreduce: break; case 324: -#line 3413 "Gmsh.y" +#line 3417 "Gmsh.y" { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d)){ - d += (yyvsp[(4) - (4)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d); - (yyval.d) = d; + d += (yyvsp[(4) - (4)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d); + (yyval.d) = d; } Free((yyvsp[(1) - (4)].c)); Free((yyvsp[(3) - (4)].c)); ;} break; case 325: -#line 3423 "Gmsh.y" +#line 3427 "Gmsh.y" { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d)){ - d += (yyvsp[(7) - (7)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d); - (yyval.d) = d; + d += (yyvsp[(7) - (7)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d); + (yyval.d) = d; } Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} break; case 326: -#line 3433 "Gmsh.y" +#line 3437 "Gmsh.y" { (yyval.d) = Msg::GetValue((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d)); Free((yyvsp[(3) - (6)].c)); @@ -7961,70 +7965,70 @@ yyreduce: break; case 327: -#line 3441 "Gmsh.y" +#line 3445 "Gmsh.y" { memcpy((yyval.v), (yyvsp[(1) - (1)].v), 5*sizeof(double)); ;} break; case 328: -#line 3445 "Gmsh.y" +#line 3449 "Gmsh.y" { for(int i = 0; i < 5; i++) (yyval.v)[i] = -(yyvsp[(2) - (2)].v)[i]; ;} break; case 329: -#line 3449 "Gmsh.y" +#line 3453 "Gmsh.y" { for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(2) - (2)].v)[i]; ;} break; case 330: -#line 3453 "Gmsh.y" +#line 3457 "Gmsh.y" { for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] - (yyvsp[(3) - (3)].v)[i]; ;} break; case 331: -#line 3457 "Gmsh.y" +#line 3461 "Gmsh.y" { for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] + (yyvsp[(3) - (3)].v)[i]; ;} break; case 332: -#line 3464 "Gmsh.y" +#line 3468 "Gmsh.y" { (yyval.v)[0] = (yyvsp[(2) - (11)].d); (yyval.v)[1] = (yyvsp[(4) - (11)].d); (yyval.v)[2] = (yyvsp[(6) - (11)].d); (yyval.v)[3] = (yyvsp[(8) - (11)].d); (yyval.v)[4] = (yyvsp[(10) - (11)].d); ;} break; case 333: -#line 3468 "Gmsh.y" +#line 3472 "Gmsh.y" { (yyval.v)[0] = (yyvsp[(2) - (9)].d); (yyval.v)[1] = (yyvsp[(4) - (9)].d); (yyval.v)[2] = (yyvsp[(6) - (9)].d); (yyval.v)[3] = (yyvsp[(8) - (9)].d); (yyval.v)[4] = 1.0; ;} break; case 334: -#line 3472 "Gmsh.y" +#line 3476 "Gmsh.y" { (yyval.v)[0] = (yyvsp[(2) - (7)].d); (yyval.v)[1] = (yyvsp[(4) - (7)].d); (yyval.v)[2] = (yyvsp[(6) - (7)].d); (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0; ;} break; case 335: -#line 3476 "Gmsh.y" +#line 3480 "Gmsh.y" { (yyval.v)[0] = (yyvsp[(2) - (7)].d); (yyval.v)[1] = (yyvsp[(4) - (7)].d); (yyval.v)[2] = (yyvsp[(6) - (7)].d); (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0; ;} break; case 336: -#line 3483 "Gmsh.y" +#line 3487 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(List_T*)); List_Add((yyval.l), &((yyvsp[(1) - (1)].l))); @@ -8032,14 +8036,14 @@ yyreduce: break; case 337: -#line 3488 "Gmsh.y" +#line 3492 "Gmsh.y" { List_Add((yyval.l), &((yyvsp[(3) - (3)].l))); ;} break; case 338: -#line 3495 "Gmsh.y" +#line 3499 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(double)); List_Add((yyval.l), &((yyvsp[(1) - (1)].d))); @@ -8047,14 +8051,14 @@ yyreduce: break; case 339: -#line 3500 "Gmsh.y" +#line 3504 "Gmsh.y" { (yyval.l) = (yyvsp[(1) - (1)].l); ;} break; case 340: -#line 3504 "Gmsh.y" +#line 3508 "Gmsh.y" { // creates an empty list (yyval.l) = List_Create(2, 1, sizeof(double)); @@ -8062,43 +8066,43 @@ yyreduce: break; case 341: -#line 3509 "Gmsh.y" +#line 3513 "Gmsh.y" { (yyval.l) = (yyvsp[(2) - (3)].l); ;} break; case 342: -#line 3513 "Gmsh.y" +#line 3517 "Gmsh.y" { (yyval.l) = (yyvsp[(3) - (4)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) = - (*pd); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) = - (*pd); } ;} break; case 343: -#line 3521 "Gmsh.y" +#line 3525 "Gmsh.y" { (yyval.l) = (yyvsp[(4) - (5)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) *= (yyvsp[(1) - (5)].d); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) *= (yyvsp[(1) - (5)].d); } ;} break; case 344: -#line 3532 "Gmsh.y" +#line 3536 "Gmsh.y" { (yyval.l) = (yyvsp[(1) - (1)].l); ;} break; case 345: -#line 3536 "Gmsh.y" +#line 3540 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (1)].c), "*") || !strcmp((yyvsp[(1) - (1)].c), "all")) (yyval.l) = 0; @@ -8110,53 +8114,53 @@ yyreduce: break; case 346: -#line 3548 "Gmsh.y" +#line 3552 "Gmsh.y" { (yyval.l) = (yyvsp[(2) - (2)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) = - (*pd); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) = - (*pd); } ;} break; case 347: -#line 3556 "Gmsh.y" +#line 3560 "Gmsh.y" { (yyval.l) = (yyvsp[(3) - (3)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) *= (yyvsp[(1) - (3)].d); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) *= (yyvsp[(1) - (3)].d); } ;} break; case 348: -#line 3564 "Gmsh.y" +#line 3568 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(double)); for(double d = (yyvsp[(1) - (3)].d); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d <= (yyvsp[(3) - (3)].d)) : (d >= (yyvsp[(3) - (3)].d)); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d += 1.) : (d -= 1.)) - List_Add((yyval.l), &d); + List_Add((yyval.l), &d); ;} break; case 349: -#line 3571 "Gmsh.y" +#line 3575 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(double)); if(!(yyvsp[(5) - (5)].d) || ((yyvsp[(1) - (5)].d) < (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) < 0) || ((yyvsp[(1) - (5)].d) > (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) > 0)){ yymsg(0, "Wrong increment in '%g:%g:%g'", (yyvsp[(1) - (5)].d), (yyvsp[(3) - (5)].d), (yyvsp[(5) - (5)].d)); - List_Add((yyval.l), &((yyvsp[(1) - (5)].d))); + List_Add((yyval.l), &((yyvsp[(1) - (5)].d))); } else - for(double d = (yyvsp[(1) - (5)].d); ((yyvsp[(5) - (5)].d) > 0) ? (d <= (yyvsp[(3) - (5)].d)) : (d >= (yyvsp[(3) - (5)].d)); d += (yyvsp[(5) - (5)].d)) - List_Add((yyval.l), &d); + for(double d = (yyvsp[(1) - (5)].d); ((yyvsp[(5) - (5)].d) > 0) ? (d <= (yyvsp[(3) - (5)].d)) : (d >= (yyvsp[(3) - (5)].d)); d += (yyvsp[(5) - (5)].d)) + List_Add((yyval.l), &d); ;} break; case 350: -#line 3582 "Gmsh.y" +#line 3586 "Gmsh.y" { // Returns the coordinates of a point and fills a list with it. // This allows to ensure e.g. that relative point positions are @@ -8164,73 +8168,73 @@ yyreduce: Vertex *v = FindPoint((int)(yyvsp[(3) - (4)].d)); (yyval.l) = List_Create(3, 1, sizeof(double)); if(!v) { - yymsg(0, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d)); - double d = 0.0; - List_Add((yyval.l), &d); - List_Add((yyval.l), &d); - List_Add((yyval.l), &d); + yymsg(0, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d)); + double d = 0.0; + List_Add((yyval.l), &d); + List_Add((yyval.l), &d); + List_Add((yyval.l), &d); } else{ - List_Add((yyval.l), &v->Pos.X); - List_Add((yyval.l), &v->Pos.Y); - List_Add((yyval.l), &v->Pos.Z); + List_Add((yyval.l), &v->Pos.X); + List_Add((yyval.l), &v->Pos.Y); + List_Add((yyval.l), &v->Pos.Z); } ;} break; case 351: -#line 3602 "Gmsh.y" +#line 3606 "Gmsh.y" { (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double)); for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){ - Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); - double d = s->Num; - List_Add((yyval.l), &d); + Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); + double d = s->Num; + List_Add((yyval.l), &d); } List_Delete((yyvsp[(1) - (1)].l)); ;} break; case 352: -#line 3612 "Gmsh.y" +#line 3616 "Gmsh.y" { (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double)); for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){ - Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); - double d = s->Num; - List_Add((yyval.l), &d); + Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); + double d = s->Num; + List_Add((yyval.l), &d); } List_Delete((yyvsp[(1) - (1)].l)); ;} break; case 353: -#line 3622 "Gmsh.y" +#line 3626 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(double)); if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); else - for(unsigned int i = 0; i < gmsh_yysymbols[(yyvsp[(1) - (3)].c)].size(); i++) - List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (3)].c)][i]); + for(unsigned int i = 0; i < gmsh_yysymbols[(yyvsp[(1) - (3)].c)].size(); i++) + List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (3)].c)][i]); Free((yyvsp[(1) - (3)].c)); ;} break; case 354: -#line 3632 "Gmsh.y" +#line 3636 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(double)); if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); else{ - for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - int index = (int)(*(double*)List_Pointer_Fast((yyvsp[(4) - (6)].l), i)); - if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index); - else - List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index]); - } + for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ + int index = (int)(*(double*)List_Pointer_Fast((yyvsp[(4) - (6)].l), i)); + if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index); + else + List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index]); + } } Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(4) - (6)].l)); @@ -8238,7 +8242,7 @@ yyreduce: break; case 355: -#line 3652 "Gmsh.y" +#line 3656 "Gmsh.y" { (yyval.l) = List_Create(2, 1, sizeof(double)); List_Add((yyval.l), &((yyvsp[(1) - (1)].d))); @@ -8246,47 +8250,47 @@ yyreduce: break; case 356: -#line 3657 "Gmsh.y" +#line 3661 "Gmsh.y" { (yyval.l) = (yyvsp[(1) - (1)].l); ;} break; case 357: -#line 3661 "Gmsh.y" +#line 3665 "Gmsh.y" { List_Add((yyval.l), &((yyvsp[(3) - (3)].d))); ;} break; case 358: -#line 3665 "Gmsh.y" +#line 3669 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (3)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (3)].l), i, &d); - List_Add((yyval.l), &d); + double d; + List_Read((yyvsp[(3) - (3)].l), i, &d); + List_Add((yyval.l), &d); } List_Delete((yyvsp[(3) - (3)].l)); ;} break; case 359: -#line 3677 "Gmsh.y" +#line 3681 "Gmsh.y" { (yyval.u) = CTX::instance()->packColor((int)(yyvsp[(2) - (9)].d), (int)(yyvsp[(4) - (9)].d), (int)(yyvsp[(6) - (9)].d), (int)(yyvsp[(8) - (9)].d)); ;} break; case 360: -#line 3681 "Gmsh.y" +#line 3685 "Gmsh.y" { (yyval.u) = CTX::instance()->packColor((int)(yyvsp[(2) - (7)].d), (int)(yyvsp[(4) - (7)].d), (int)(yyvsp[(6) - (7)].d), 255); ;} break; case 361: -#line 3693 "Gmsh.y" +#line 3697 "Gmsh.y" { int flag; (yyval.u) = GetColorForString(ColorString, -1, (yyvsp[(1) - (1)].c), &flag); @@ -8296,7 +8300,7 @@ yyreduce: break; case 362: -#line 3700 "Gmsh.y" +#line 3704 "Gmsh.y" { unsigned int val = 0; ColorOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(5) - (5)].c), val); @@ -8306,29 +8310,29 @@ yyreduce: break; case 363: -#line 3710 "Gmsh.y" +#line 3714 "Gmsh.y" { (yyval.l) = (yyvsp[(2) - (3)].l); ;} break; case 364: -#line 3714 "Gmsh.y" +#line 3718 "Gmsh.y" { (yyval.l) = List_Create(256, 10, sizeof(unsigned int)); GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (6)].d)); if(!ct) - yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d)); + yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d)); else{ - for(int i = 0; i < ct->size; i++) - List_Add((yyval.l), &ct->table[i]); + for(int i = 0; i < ct->size; i++) + List_Add((yyval.l), &ct->table[i]); } Free((yyvsp[(1) - (6)].c)); ;} break; case 365: -#line 3729 "Gmsh.y" +#line 3733 "Gmsh.y" { (yyval.l) = List_Create(256, 10, sizeof(unsigned int)); List_Add((yyval.l), &((yyvsp[(1) - (1)].u))); @@ -8336,37 +8340,37 @@ yyreduce: break; case 366: -#line 3734 "Gmsh.y" +#line 3738 "Gmsh.y" { List_Add((yyval.l), &((yyvsp[(3) - (3)].u))); ;} break; case 367: -#line 3741 "Gmsh.y" +#line 3745 "Gmsh.y" { (yyval.c) = (yyvsp[(1) - (1)].c); ;} break; case 368: -#line 3745 "Gmsh.y" +#line 3749 "Gmsh.y" { if(!gmsh_yystringsymbols.count((yyvsp[(1) - (1)].c))){ - yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c)); - (yyval.c) = (yyvsp[(1) - (1)].c); + yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c)); + (yyval.c) = (yyvsp[(1) - (1)].c); } else{ - std::string val = gmsh_yystringsymbols[(yyvsp[(1) - (1)].c)]; - (yyval.c) = (char *)Malloc((val.size() + 1) * sizeof(char)); - strcpy((yyval.c), val.c_str()); - Free((yyvsp[(1) - (1)].c)); + std::string val = gmsh_yystringsymbols[(yyvsp[(1) - (1)].c)]; + (yyval.c) = (char *)Malloc((val.size() + 1) * sizeof(char)); + strcpy((yyval.c), val.c_str()); + Free((yyvsp[(1) - (1)].c)); } ;} break; case 369: -#line 3758 "Gmsh.y" +#line 3762 "Gmsh.y" { std::string out; StringOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), out); @@ -8377,7 +8381,7 @@ yyreduce: break; case 370: -#line 3766 "Gmsh.y" +#line 3770 "Gmsh.y" { std::string out; StringOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), out); @@ -8388,14 +8392,14 @@ yyreduce: break; case 371: -#line 3777 "Gmsh.y" +#line 3781 "Gmsh.y" { (yyval.c) = (yyvsp[(1) - (1)].c); ;} break; case 372: -#line 3781 "Gmsh.y" +#line 3785 "Gmsh.y" { (yyval.c) = (char *)Malloc(32 * sizeof(char)); time_t now; @@ -8406,7 +8410,7 @@ yyreduce: break; case 373: -#line 3789 "Gmsh.y" +#line 3793 "Gmsh.y" { (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (6)].c)) + strlen((yyvsp[(5) - (6)].c)) + 1) * sizeof(char)); strcpy((yyval.c), (yyvsp[(3) - (6)].c)); @@ -8417,16 +8421,16 @@ yyreduce: break; case 374: -#line 3797 "Gmsh.y" +#line 3801 "Gmsh.y" { (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char)); int i; for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){ - if((yyvsp[(3) - (4)].c)[i] == '.'){ - strncpy((yyval.c), (yyvsp[(3) - (4)].c), i); - (yyval.c)[i]='\0'; - break; - } + if((yyvsp[(3) - (4)].c)[i] == '.'){ + strncpy((yyval.c), (yyvsp[(3) - (4)].c), i); + (yyval.c)[i]='\0'; + break; + } } if(i <= 0) strcpy((yyval.c), (yyvsp[(3) - (4)].c)); Free((yyvsp[(3) - (4)].c)); @@ -8434,46 +8438,46 @@ yyreduce: break; case 375: -#line 3811 "Gmsh.y" +#line 3815 "Gmsh.y" { (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char)); int i; for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){ - if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\') - break; + if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\') + break; } if(i <= 0) - strcpy((yyval.c), (yyvsp[(3) - (4)].c)); + strcpy((yyval.c), (yyvsp[(3) - (4)].c)); else - strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]); + strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]); Free((yyvsp[(3) - (4)].c)); ;} break; case 376: -#line 3825 "Gmsh.y" +#line 3829 "Gmsh.y" { (yyval.c) = (yyvsp[(3) - (4)].c); ;} break; case 377: -#line 3829 "Gmsh.y" +#line 3833 "Gmsh.y" { char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring); if(i < 0){ - yymsg(0, "Too few arguments in Sprintf"); - (yyval.c) = (yyvsp[(3) - (6)].c); + yymsg(0, "Too few arguments in Sprintf"); + (yyval.c) = (yyvsp[(3) - (6)].c); } else if(i > 0){ - yymsg(0, "%d extra argument%s in Sprintf", i, (i > 1) ? "s" : ""); - (yyval.c) = (yyvsp[(3) - (6)].c); + yymsg(0, "%d extra argument%s in Sprintf", i, (i > 1) ? "s" : ""); + (yyval.c) = (yyvsp[(3) - (6)].c); } else{ - (yyval.c) = (char*)Malloc((strlen(tmpstring) + 1) * sizeof(char)); - strcpy((yyval.c), tmpstring); - Free((yyvsp[(3) - (6)].c)); + (yyval.c) = (char*)Malloc((strlen(tmpstring) + 1) * sizeof(char)); + strcpy((yyval.c), tmpstring); + Free((yyvsp[(3) - (6)].c)); } List_Delete((yyvsp[(5) - (6)].l)); ;} @@ -8481,7 +8485,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 8485 "Gmsh.tab.cpp" +#line 8489 "Gmsh.tab.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -8520,35 +8524,35 @@ yyerrlab: yyerror (YY_("syntax error")); #else { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } } #endif } @@ -8558,20 +8562,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse look-ahead token after shifting the error @@ -8603,29 +8607,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -8671,7 +8675,7 @@ yyexhaustedlab: yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -8679,7 +8683,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -8695,7 +8699,7 @@ yyreturn: } -#line 3849 "Gmsh.y" +#line 3853 "Gmsh.y" int PrintListOfDouble(char *format, List_T *list, char *buffer) @@ -8714,15 +8718,15 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer) j++; if(j < (int)strlen(format)){ if(format[j] == '%'){ - strcat(buffer, "%"); - j++; + strcat(buffer, "%"); + j++; } while(j < (int)strlen(format) && format[j] != '%') j++; if(k != j){ - strncpy(tmp1, &(format[k]), j-k); - tmp1[j-k] = '\0'; - sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i)); - strcat(buffer, tmp2); + strncpy(tmp1, &(format[k]), j-k); + tmp1[j-k] = '\0'; + sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i)); + strcat(buffer, tmp2); } } else diff --git a/Parser/Gmsh.tab.hpp b/Parser/Gmsh.tab.hpp index 1fd495e553d89e715eadff693878181b78544159..f7d88fc3c20c596ba4a66ac5bb865d86efdb3a37 100644 --- a/Parser/Gmsh.tab.hpp +++ b/Parser/Gmsh.tab.hpp @@ -129,8 +129,8 @@ tBSpline = 345, tBezier = 346, tNurbs = 347, - tOrder = 348, - tKnots = 349, + tNurbsOrder = 348, + tNurbsKnots = 349, tColor = 350, tColorTable = 351, tFor = 352, @@ -255,8 +255,8 @@ #define tBSpline 345 #define tBezier 346 #define tNurbs 347 -#define tOrder 348 -#define tKnots 349 +#define tNurbsOrder 348 +#define tNurbsKnots 349 #define tColor 350 #define tColorTable 351 #define tFor 352 @@ -294,7 +294,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 74 "Gmsh.y" +#line 78 "Gmsh.y" { char *c; int i; diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 318c84d5a89074ac7b7adbb35224c7e1e3303022..b64a2f63021fbd2011a0ee10a42efb093d3cc161 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -19,7 +19,6 @@ #include "Geo.h" #include "GeoInterpolation.h" #include "Generator.h" -#include "Draw.h" #include "Options.h" #include "Colors.h" #include "Parser.h" @@ -33,12 +32,17 @@ #include "gmshLevelset.h" #include "Field.h" #include "BackgroundMesh.h" + #if !defined(HAVE_NO_POST) #include "PView.h" #include "PViewDataList.h" #include "PluginManager.h" #endif +#if defined(HAVE_FLTK) +#include "drawContext.h" +#endif + // Global parser variables std::string gmsh_yyname; int gmsh_yyerrorstate = 0; @@ -98,7 +102,7 @@ void FixRelativePath(const char *in, char *out); %token tLoop tRecombine tSmoother tSplit tDelete tCoherence tIntersect %token tLayers tHole tAlias tAliasWithOptions %token tText2D tText3D tInterpolationScheme tTime tCombine -%token tBSpline tBezier tNurbs tOrder tKnots +%token tBSpline tBezier tNurbs tNurbsOrder tNurbsKnots %token tColor tColorTable tFor tIn tEndFor tIf tEndIf tExit %token tField tReturn tCall tFunction tShow tHide tGetValue %token tGMSH_MAJOR_VERSION tGMSH_MINOR_VERSION tGMSH_PATCH_VERSION @@ -1206,7 +1210,7 @@ Shape : $$.Type = MSH_SEGM_BEZIER; $$.Num = num; } - | tNurbs '(' FExpr ')' tAFFECT ListOfDouble tKnots ListOfDouble tOrder FExpr tEND + | tNurbs '(' FExpr ')' tAFFECT ListOfDouble tNurbsKnots ListOfDouble tNurbsOrder FExpr tEND { int num = (int)$3; if(List_Nbr($6) + (int)$10 + 1 != List_Nbr($8)){ @@ -2361,7 +2365,7 @@ Command : | tDraw tEND { #if defined(HAVE_FLTK) - Draw(); + drawContext::global()->draw(); #endif } | tCreateTopology tEND diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 54ff7d22fac40621d70e242d2cc7a4b197dc2363..65ee28642a0a4fa6b68210a10db3e55739dc0be2 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -92,14 +92,14 @@ typedef unsigned int flex_uint32_t; /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -164,17 +164,17 @@ extern FILE *gmsh_yyin, *gmsh_yyout; /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up gmsh_yytext. */ \ + do \ + { \ + /* Undo effects of setting up gmsh_yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up gmsh_yytext again */ \ - } \ - while ( 0 ) + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gmsh_yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) @@ -191,66 +191,66 @@ typedef unsigned int yy_size_t; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via gmsh_yyrestart()), so that the user can continue scanning by - * just pointing gmsh_yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via gmsh_yyrestart()), so that the user can continue scanning by + * just pointing gmsh_yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ @@ -275,13 +275,13 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when gmsh_yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int gmsh_yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow gmsh_yywrap()'s to do buffer switches * instead of setting up a fresh gmsh_yyin. A bit of a hack ... @@ -313,24 +313,24 @@ void gmsh_yyfree (void * ); #define yy_new_buffer gmsh_yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ gmsh_yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ + { \ + if ( ! YY_CURRENT_BUFFER ){\ gmsh_yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) @@ -358,21 +358,21 @@ static void yy_fatal_error (yyconst char msg[] ); * corresponding action - sets up gmsh_yytext. */ #define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - gmsh_yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; \ + gmsh_yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 147 #define YY_END_OF_BUFFER 148 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; static yyconst flex_int16_t yy_accept[634] = { 0, 0, 0, 148, 146, 1, 1, 146, 5, 146, 6, @@ -863,20 +863,20 @@ char *strsave(char *ptr); void skipcomments(void); void skipline(void); -#define YY_INPUT(buf,result,max_size) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ){ \ - buf[n++] = (char) c; \ - gmsh_yylineno++; \ - } \ - if ( c == EOF && ferror( gmsh_yyin ) ) \ - Msg::Fatal("Input in flex scanner failed"); \ - result = n; \ - } \ +#define YY_INPUT(buf,result,max_size) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ){ \ + buf[n++] = (char) c; \ + gmsh_yylineno++; \ + } \ + if ( c == EOF && ferror( gmsh_yyin ) ) \ + Msg::Fatal("Input in flex scanner failed"); \ + result = n; \ + } \ #if defined(WIN32) #define isatty(arg) -1 @@ -951,33 +951,33 @@ static int input (void ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( gmsh_yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, gmsh_yyin))==0 && ferror(gmsh_yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(gmsh_yyin); \ - } \ - }\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( gmsh_yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, gmsh_yyin))==0 && ferror(gmsh_yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(gmsh_yyin); \ + } \ + }\ \ #endif @@ -1026,803 +1026,803 @@ extern int gmsh_yylex (void); #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; #line 49 "Gmsh.l" #line 1043 "Gmsh.yy.cpp" - if ( !(yy_init) ) - { - (yy_init) = 1; + if ( !(yy_init) ) + { + (yy_init) = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! gmsh_yyin ) - gmsh_yyin = stdin; + if ( ! gmsh_yyin ) + gmsh_yyin = stdin; - if ( ! gmsh_yyout ) - gmsh_yyout = stdout; + if ( ! gmsh_yyout ) + gmsh_yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - gmsh_yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); - } + if ( ! YY_CURRENT_BUFFER ) { + gmsh_yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); + } - gmsh_yy_load_buffer_state( ); - } + gmsh_yy_load_buffer_state( ); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of gmsh_yytext. */ - *yy_cp = (yy_hold_char); + /* Support of gmsh_yytext. */ + *yy_cp = (yy_hold_char); - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = (yy_start); + yy_current_state = (yy_start); yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 634 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 756 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 634 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 756 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 51 "Gmsh.l" /* none */; - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP #line 52 "Gmsh.l" return tEND; - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP #line 53 "Gmsh.l" skipcomments(); - YY_BREAK + YY_BREAK case 4: YY_RULE_SETUP #line 54 "Gmsh.l" skipline(); - YY_BREAK + YY_BREAK case 5: YY_RULE_SETUP #line 55 "Gmsh.l" { parsestring('\"'); return tBIGSTR; } - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP #line 56 "Gmsh.l" { parsestring('\''); return tBIGSTR; } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP #line 57 "Gmsh.l" { gmsh_yylval.d = NEWREG(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP #line 58 "Gmsh.l" { gmsh_yylval.d = NEWPOINT(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP #line 59 "Gmsh.l" { gmsh_yylval.d = NEWLINE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP #line 60 "Gmsh.l" { gmsh_yylval.d = NEWLINE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP #line 61 "Gmsh.l" { gmsh_yylval.d = NEWLINELOOP(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP #line 62 "Gmsh.l" { gmsh_yylval.d = NEWSURFACE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP #line 63 "Gmsh.l" { gmsh_yylval.d = NEWSURFACELOOP(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP #line 64 "Gmsh.l" { gmsh_yylval.d = NEWVOLUME(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP #line 65 "Gmsh.l" { gmsh_yylval.d = NEWFIELD(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 16: YY_RULE_SETUP #line 66 "Gmsh.l" return tAFFECT; - YY_BREAK + YY_BREAK case 17: YY_RULE_SETUP #line 67 "Gmsh.l" return tAFFECTPLUS; - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP #line 68 "Gmsh.l" return tAFFECTMINUS; - YY_BREAK + YY_BREAK case 19: YY_RULE_SETUP #line 69 "Gmsh.l" return tAFFECTTIMES; - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP #line 70 "Gmsh.l" return tAFFECTDIVIDE; - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP #line 71 "Gmsh.l" return tDOTS; - YY_BREAK + YY_BREAK case 22: YY_RULE_SETUP #line 72 "Gmsh.l" return tDOTS; - YY_BREAK + YY_BREAK case 23: YY_RULE_SETUP #line 73 "Gmsh.l" return tOR; - YY_BREAK + YY_BREAK case 24: YY_RULE_SETUP #line 74 "Gmsh.l" return tAND; - YY_BREAK + YY_BREAK case 25: YY_RULE_SETUP #line 75 "Gmsh.l" return tPLUSPLUS; - YY_BREAK + YY_BREAK case 26: YY_RULE_SETUP #line 76 "Gmsh.l" return tMINUSMINUS; - YY_BREAK + YY_BREAK case 27: YY_RULE_SETUP #line 77 "Gmsh.l" return tEQUAL; - YY_BREAK + YY_BREAK case 28: YY_RULE_SETUP #line 78 "Gmsh.l" return tNOTEQUAL; - YY_BREAK + YY_BREAK case 29: YY_RULE_SETUP #line 79 "Gmsh.l" return tLESSOREQUAL; - YY_BREAK + YY_BREAK case 30: YY_RULE_SETUP #line 80 "Gmsh.l" return tGREATEROREQUAL; - YY_BREAK + YY_BREAK case 31: YY_RULE_SETUP #line 82 "Gmsh.l" return tAcos; - YY_BREAK + YY_BREAK case 32: YY_RULE_SETUP #line 83 "Gmsh.l" return tAcos; - YY_BREAK + YY_BREAK case 33: YY_RULE_SETUP #line 84 "Gmsh.l" return tAlias; - YY_BREAK + YY_BREAK case 34: YY_RULE_SETUP #line 85 "Gmsh.l" return tAliasWithOptions; - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP #line 86 "Gmsh.l" return tAsin; - YY_BREAK + YY_BREAK case 36: YY_RULE_SETUP #line 87 "Gmsh.l" return tAsin; - YY_BREAK + YY_BREAK case 37: YY_RULE_SETUP #line 88 "Gmsh.l" return tAtan; - YY_BREAK + YY_BREAK case 38: YY_RULE_SETUP #line 89 "Gmsh.l" return tAtan; - YY_BREAK + YY_BREAK case 39: YY_RULE_SETUP #line 90 "Gmsh.l" return tAtan2; - YY_BREAK + YY_BREAK case 40: YY_RULE_SETUP #line 91 "Gmsh.l" return tAtan2; - YY_BREAK + YY_BREAK case 41: YY_RULE_SETUP #line 93 "Gmsh.l" return tBezier; - YY_BREAK + YY_BREAK case 42: YY_RULE_SETUP #line 94 "Gmsh.l" return tBSpline; - YY_BREAK + YY_BREAK case 43: YY_RULE_SETUP #line 95 "Gmsh.l" return tBoundingBox; - YY_BREAK + YY_BREAK case 44: YY_RULE_SETUP #line 97 "Gmsh.l" return tCeil; - YY_BREAK + YY_BREAK case 45: YY_RULE_SETUP #line 98 "Gmsh.l" return tCircle; - YY_BREAK + YY_BREAK case 46: YY_RULE_SETUP #line 99 "Gmsh.l" return tCoherence; - YY_BREAK + YY_BREAK case 47: YY_RULE_SETUP #line 100 "Gmsh.l" return tCombine; - YY_BREAK + YY_BREAK case 48: YY_RULE_SETUP #line 101 "Gmsh.l" return tCosh; - YY_BREAK + YY_BREAK case 49: YY_RULE_SETUP #line 102 "Gmsh.l" return tCos; - YY_BREAK + YY_BREAK case 50: YY_RULE_SETUP #line 103 "Gmsh.l" return tCharacteristic; - YY_BREAK + YY_BREAK case 51: YY_RULE_SETUP #line 104 "Gmsh.l" return tComplex; - YY_BREAK + YY_BREAK case 52: YY_RULE_SETUP #line 105 "Gmsh.l" return tColor; - YY_BREAK + YY_BREAK case 53: YY_RULE_SETUP #line 106 "Gmsh.l" return tColorTable; - YY_BREAK + YY_BREAK case 54: YY_RULE_SETUP #line 107 "Gmsh.l" return tCompound; - YY_BREAK + YY_BREAK case 55: YY_RULE_SETUP #line 108 "Gmsh.l" return tCoordinates; - YY_BREAK + YY_BREAK case 56: YY_RULE_SETUP #line 109 "Gmsh.l" return tSpline; - YY_BREAK + YY_BREAK case 57: YY_RULE_SETUP #line 110 "Gmsh.l" return tCall; - YY_BREAK + YY_BREAK case 58: YY_RULE_SETUP #line 111 "Gmsh.l" return tCreateTopology; - YY_BREAK + YY_BREAK case 59: YY_RULE_SETUP #line 113 "Gmsh.l" return tDelete; - YY_BREAK + YY_BREAK case 60: YY_RULE_SETUP #line 114 "Gmsh.l" return tDegenerated; - YY_BREAK + YY_BREAK case 61: YY_RULE_SETUP #line 115 "Gmsh.l" return tDilate; - YY_BREAK + YY_BREAK case 62: YY_RULE_SETUP #line 116 "Gmsh.l" return tDraw; - YY_BREAK + YY_BREAK case 63: YY_RULE_SETUP #line 118 "Gmsh.l" return tExp; - YY_BREAK + YY_BREAK case 64: YY_RULE_SETUP #line 119 "Gmsh.l" return tEllipse; - YY_BREAK + YY_BREAK case 65: YY_RULE_SETUP #line 120 "Gmsh.l" return tEllipse; - YY_BREAK + YY_BREAK case 66: YY_RULE_SETUP #line 121 "Gmsh.l" return tExtrude; - YY_BREAK + YY_BREAK case 67: YY_RULE_SETUP #line 122 "Gmsh.l" return tElliptic; - YY_BREAK + YY_BREAK case 68: YY_RULE_SETUP #line 123 "Gmsh.l" return tEndFor; - YY_BREAK + YY_BREAK case 69: YY_RULE_SETUP #line 124 "Gmsh.l" return tEndIf; - YY_BREAK + YY_BREAK case 70: YY_RULE_SETUP #line 125 "Gmsh.l" return tEuclidian; - YY_BREAK + YY_BREAK case 71: YY_RULE_SETUP #line 126 "Gmsh.l" return tExit; - YY_BREAK + YY_BREAK case 72: YY_RULE_SETUP #line 128 "Gmsh.l" return tFabs; - YY_BREAK + YY_BREAK case 73: YY_RULE_SETUP #line 129 "Gmsh.l" return tField; - YY_BREAK + YY_BREAK case 74: YY_RULE_SETUP #line 130 "Gmsh.l" return tFloor; - YY_BREAK + YY_BREAK case 75: YY_RULE_SETUP #line 131 "Gmsh.l" return tFmod; - YY_BREAK + YY_BREAK case 76: YY_RULE_SETUP #line 132 "Gmsh.l" return tFor; - YY_BREAK + YY_BREAK case 77: YY_RULE_SETUP #line 133 "Gmsh.l" return tFunction; - YY_BREAK + YY_BREAK case 78: YY_RULE_SETUP #line 135 "Gmsh.l" return tGetValue; - YY_BREAK + YY_BREAK case 79: YY_RULE_SETUP #line 136 "Gmsh.l" return tGMSH_MAJOR_VERSION; - YY_BREAK + YY_BREAK case 80: YY_RULE_SETUP #line 137 "Gmsh.l" return tGMSH_MINOR_VERSION; - YY_BREAK + YY_BREAK case 81: YY_RULE_SETUP #line 138 "Gmsh.l" return tGMSH_PATCH_VERSION; - YY_BREAK + YY_BREAK case 82: YY_RULE_SETUP #line 140 "Gmsh.l" return tHide; - YY_BREAK + YY_BREAK case 83: YY_RULE_SETUP #line 141 "Gmsh.l" return tHole; - YY_BREAK + YY_BREAK case 84: YY_RULE_SETUP #line 142 "Gmsh.l" return tHypot; - YY_BREAK + YY_BREAK case 85: YY_RULE_SETUP #line 144 "Gmsh.l" return tIn; - YY_BREAK + YY_BREAK case 86: YY_RULE_SETUP #line 145 "Gmsh.l" return tIf; - YY_BREAK + YY_BREAK case 87: YY_RULE_SETUP #line 146 "Gmsh.l" return tIntersect; - YY_BREAK + YY_BREAK case 88: YY_RULE_SETUP #line 147 "Gmsh.l" return tInterpolationScheme; - YY_BREAK + YY_BREAK case 89: YY_RULE_SETUP #line 149 "Gmsh.l" -return tKnots; - YY_BREAK +return tNurbsKnots; + YY_BREAK case 90: YY_RULE_SETUP #line 151 "Gmsh.l" return tLength; - YY_BREAK + YY_BREAK case 91: YY_RULE_SETUP #line 152 "Gmsh.l" return tLine; - YY_BREAK + YY_BREAK case 92: YY_RULE_SETUP #line 153 "Gmsh.l" return tLoop; - YY_BREAK + YY_BREAK case 93: YY_RULE_SETUP #line 154 "Gmsh.l" return tLog; - YY_BREAK + YY_BREAK case 94: YY_RULE_SETUP #line 155 "Gmsh.l" return tLog10; - YY_BREAK + YY_BREAK case 95: YY_RULE_SETUP #line 156 "Gmsh.l" return tLayers; - YY_BREAK + YY_BREAK case 96: YY_RULE_SETUP #line 157 "Gmsh.l" return tLevelset; - YY_BREAK + YY_BREAK case 97: YY_RULE_SETUP #line 159 "Gmsh.l" return tModulo; - YY_BREAK + YY_BREAK case 98: YY_RULE_SETUP #line 160 "Gmsh.l" return tMPI_Rank; - YY_BREAK + YY_BREAK case 99: YY_RULE_SETUP #line 161 "Gmsh.l" return tMPI_Size; - YY_BREAK + YY_BREAK case 100: YY_RULE_SETUP #line 163 "Gmsh.l" return tNurbs; - YY_BREAK + YY_BREAK case 101: YY_RULE_SETUP #line 165 "Gmsh.l" -return tOrder; - YY_BREAK +return tNurbsOrder; + YY_BREAK case 102: YY_RULE_SETUP #line 166 "Gmsh.l" return tOCCShape; - YY_BREAK + YY_BREAK case 103: YY_RULE_SETUP #line 168 "Gmsh.l" return tPhysical; - YY_BREAK + YY_BREAK case 104: YY_RULE_SETUP #line 169 "Gmsh.l" return tPi; - YY_BREAK + YY_BREAK case 105: YY_RULE_SETUP #line 170 "Gmsh.l" return tPlane; - YY_BREAK + YY_BREAK case 106: YY_RULE_SETUP #line 171 "Gmsh.l" return tPoint; - YY_BREAK + YY_BREAK case 107: YY_RULE_SETUP #line 172 "Gmsh.l" return tParametric; - YY_BREAK + YY_BREAK case 108: YY_RULE_SETUP #line 173 "Gmsh.l" return tPolarSphere; - YY_BREAK + YY_BREAK case 109: YY_RULE_SETUP #line 174 "Gmsh.l" return tPrintf; - YY_BREAK + YY_BREAK case 110: YY_RULE_SETUP #line 175 "Gmsh.l" return tPlugin; - YY_BREAK + YY_BREAK case 111: YY_RULE_SETUP #line 177 "Gmsh.l" return tRecombine; - YY_BREAK + YY_BREAK case 112: YY_RULE_SETUP #line 178 "Gmsh.l" return tRotate; - YY_BREAK + YY_BREAK case 113: YY_RULE_SETUP #line 179 "Gmsh.l" return tRuled; - YY_BREAK + YY_BREAK case 114: YY_RULE_SETUP #line 180 "Gmsh.l" return tRand; - YY_BREAK + YY_BREAK case 115: YY_RULE_SETUP #line 181 "Gmsh.l" return tReturn; - YY_BREAK + YY_BREAK case 116: YY_RULE_SETUP #line 183 "Gmsh.l" return tSmoother; - YY_BREAK + YY_BREAK case 117: YY_RULE_SETUP #line 184 "Gmsh.l" return tSqrt; - YY_BREAK + YY_BREAK case 118: YY_RULE_SETUP #line 185 "Gmsh.l" return tSin; - YY_BREAK + YY_BREAK case 119: YY_RULE_SETUP #line 186 "Gmsh.l" return tSinh; - YY_BREAK + YY_BREAK case 120: YY_RULE_SETUP #line 187 "Gmsh.l" return tSphere; - YY_BREAK + YY_BREAK case 121: YY_RULE_SETUP #line 188 "Gmsh.l" return tSpline; - YY_BREAK + YY_BREAK case 122: YY_RULE_SETUP #line 189 "Gmsh.l" return tSplit; - YY_BREAK + YY_BREAK case 123: YY_RULE_SETUP #line 190 "Gmsh.l" return tSurface; - YY_BREAK + YY_BREAK case 124: YY_RULE_SETUP #line 191 "Gmsh.l" return tSprintf; - YY_BREAK + YY_BREAK case 125: YY_RULE_SETUP #line 192 "Gmsh.l" return tStrCat; - YY_BREAK + YY_BREAK case 126: YY_RULE_SETUP #line 193 "Gmsh.l" return tStrPrefix; - YY_BREAK + YY_BREAK case 127: YY_RULE_SETUP #line 194 "Gmsh.l" return tStrRelative; - YY_BREAK + YY_BREAK case 128: YY_RULE_SETUP #line 195 "Gmsh.l" return tShow; - YY_BREAK + YY_BREAK case 129: YY_RULE_SETUP #line 196 "Gmsh.l" return tSymmetry; - YY_BREAK + YY_BREAK case 130: YY_RULE_SETUP #line 197 "Gmsh.l" return tSyncModel; - YY_BREAK + YY_BREAK case 131: YY_RULE_SETUP #line 199 "Gmsh.l" return tText2D; - YY_BREAK + YY_BREAK case 132: YY_RULE_SETUP #line 200 "Gmsh.l" return tText3D; - YY_BREAK + YY_BREAK case 133: YY_RULE_SETUP #line 201 "Gmsh.l" return tTime; - YY_BREAK + YY_BREAK case 134: YY_RULE_SETUP #line 202 "Gmsh.l" return tTransfinite; - YY_BREAK + YY_BREAK case 135: YY_RULE_SETUP #line 203 "Gmsh.l" return tTranslate; - YY_BREAK + YY_BREAK case 136: YY_RULE_SETUP #line 204 "Gmsh.l" return tTanh; - YY_BREAK + YY_BREAK case 137: YY_RULE_SETUP #line 205 "Gmsh.l" return tTan; - YY_BREAK + YY_BREAK case 138: YY_RULE_SETUP #line 206 "Gmsh.l" return tToday; - YY_BREAK + YY_BREAK case 139: YY_RULE_SETUP #line 208 "Gmsh.l" return tUsing; - YY_BREAK + YY_BREAK case 140: YY_RULE_SETUP #line 210 "Gmsh.l" return tVolume; - YY_BREAK + YY_BREAK case 141: #line 213 "Gmsh.l" case 142: @@ -1833,378 +1833,378 @@ case 144: YY_RULE_SETUP #line 215 "Gmsh.l" { gmsh_yylval.d = atof((char *)gmsh_yytext); return tDOUBLE; } - YY_BREAK + YY_BREAK case 145: YY_RULE_SETUP #line 217 "Gmsh.l" { gmsh_yylval.c = strsave((char*)gmsh_yytext); return tSTRING; } - YY_BREAK + YY_BREAK case 146: YY_RULE_SETUP #line 219 "Gmsh.l" return gmsh_yytext[0]; - YY_BREAK + YY_BREAK case 147: YY_RULE_SETUP #line 221 "Gmsh.l" ECHO; - YY_BREAK + YY_BREAK #line 1853 "Gmsh.yy.cpp" case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed gmsh_yyin at a new source and called - * gmsh_yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = gmsh_yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( gmsh_yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * gmsh_yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed gmsh_yyin at a new source and called + * gmsh_yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gmsh_yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( gmsh_yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * gmsh_yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ } /* end of gmsh_yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - gmsh_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - gmsh_yyrestart(gmsh_yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + gmsh_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + gmsh_yyrestart(gmsh_yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - return ret_val; + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 634 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 634 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 634 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 633); - - return yy_is_jam ? 0 : yy_current_state; + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 634 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 633); + + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { - register char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up gmsh_yytext */ - *yy_cp = (yy_hold_char); + /* undo effects of setting up gmsh_yytext */ + *yy_cp = (yy_hold_char); - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT @@ -2215,71 +2215,71 @@ static int yy_get_next_buffer (void) #endif { - int c; + int c; - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - gmsh_yyrestart(gmsh_yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( gmsh_yywrap( ) ) - return 0; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + gmsh_yyrestart(gmsh_yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( gmsh_yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve gmsh_yytext */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gmsh_yytext */ + (yy_hold_char) = *++(yy_c_buf_p); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. @@ -2289,14 +2289,14 @@ static int yy_get_next_buffer (void) void gmsh_yyrestart (FILE * input_file ) { - if ( ! YY_CURRENT_BUFFER ){ + if ( ! YY_CURRENT_BUFFER ){ gmsh_yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = + YY_CURRENT_BUFFER_LVALUE = gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); - } + } - gmsh_yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - gmsh_yy_load_buffer_state( ); + gmsh_yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + gmsh_yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -2306,40 +2306,40 @@ static int yy_get_next_buffer (void) void gmsh_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - /* TODO. We should be able to replace this entire function body - * with - * gmsh_yypop_buffer_state(); - * gmsh_yypush_buffer_state(new_buffer); + /* TODO. We should be able to replace this entire function body + * with + * gmsh_yypop_buffer_state(); + * gmsh_yypush_buffer_state(new_buffer); */ - gmsh_yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - gmsh_yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (gmsh_yywrap()) processing, but the only time this flag - * is looked at is after gmsh_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; + gmsh_yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gmsh_yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (gmsh_yywrap()) processing, but the only time this flag + * is looked at is after gmsh_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; } static void gmsh_yy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - gmsh_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gmsh_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. @@ -2350,26 +2350,26 @@ static void gmsh_yy_load_buffer_state (void) */ YY_BUFFER_STATE gmsh_yy_create_buffer (FILE * file, int size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); + b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) gmsh_yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) gmsh_yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - gmsh_yy_init_buffer(b,file ); + gmsh_yy_init_buffer(b,file ); - return b; + return b; } /** Destroy the buffer. @@ -2379,16 +2379,16 @@ static void gmsh_yy_load_buffer_state (void) void gmsh_yy_delete_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - gmsh_yyfree((void *) b->yy_ch_buf ); + if ( b->yy_is_our_buffer ) + gmsh_yyfree((void *) b->yy_ch_buf ); - gmsh_yyfree((void *) b ); + gmsh_yyfree((void *) b ); } #ifndef __cplusplus @@ -2402,12 +2402,12 @@ extern int isatty (int ); static void gmsh_yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { - int oerrno = errno; + int oerrno = errno; - gmsh_yy_flush_buffer(b ); + gmsh_yy_flush_buffer(b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; /* If b is the current buffer, then gmsh_yy_init_buffer was _probably_ * called from gmsh_yyrestart() or through yy_get_next_buffer. @@ -2420,7 +2420,7 @@ extern int isatty (int ); b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - errno = oerrno; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. @@ -2429,25 +2429,25 @@ extern int isatty (int ); */ void gmsh_yy_flush_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - gmsh_yy_load_buffer_state( ); + if ( b == YY_CURRENT_BUFFER ) + gmsh_yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2458,28 +2458,28 @@ extern int isatty (int ); */ void gmsh_yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) - return; - - gmsh_yyensure_buffer_stack(); - - /* This block is copied from gmsh_yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from gmsh_yy_switch_to_buffer. */ - gmsh_yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; + if (new_buffer == NULL) + return; + + gmsh_yyensure_buffer_stack(); + + /* This block is copied from gmsh_yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gmsh_yy_switch_to_buffer. */ + gmsh_yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. @@ -2488,18 +2488,18 @@ void gmsh_yypush_buffer_state (YY_BUFFER_STATE new_buffer ) */ void gmsh_yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; - - gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - gmsh_yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } + if (!YY_CURRENT_BUFFER) + return; + + gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gmsh_yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } } /* Allocates the stack if it does not exist. @@ -2507,41 +2507,41 @@ void gmsh_yypop_buffer_state (void) */ static void gmsh_yyensure_buffer_stack (void) { - int num_to_alloc; + int num_to_alloc; - if (!(yy_buffer_stack)) { + if (!(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -2552,31 +2552,31 @@ static void gmsh_yyensure_buffer_stack (void) */ YY_BUFFER_STATE gmsh_yy_scan_buffer (char * base, yy_size_t size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - gmsh_yy_switch_to_buffer(b ); - - return b; + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + gmsh_yy_switch_to_buffer(b ); + + return b; } /** Setup the input buffer state to scan a string. The next call to gmsh_yylex() will @@ -2590,7 +2590,7 @@ YY_BUFFER_STATE gmsh_yy_scan_buffer (char * base, yy_size_t size ) YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr ) { - return gmsh_yy_scan_bytes(yystr,strlen(yystr) ); + return gmsh_yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to gmsh_yylex() will @@ -2602,32 +2602,32 @@ YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr ) */ YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) gmsh_yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) gmsh_yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = gmsh_yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in gmsh_yy_scan_bytes()" ); + b = gmsh_yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in gmsh_yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; + return b; } #ifndef YY_EXIT_FAILURE @@ -2636,26 +2636,26 @@ YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up gmsh_yytext. */ \ + do \ + { \ + /* Undo effects of setting up gmsh_yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - gmsh_yytext[gmsh_yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = gmsh_yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - gmsh_yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + gmsh_yytext[gmsh_yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = gmsh_yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gmsh_yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ @@ -2770,15 +2770,15 @@ int gmsh_yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - gmsh_yypop_buffer_state(); - } + while(YY_CURRENT_BUFFER){ + gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gmsh_yypop_buffer_state(); + } - /* Destroy the stack itself. */ - gmsh_yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; + /* Destroy the stack itself. */ + gmsh_yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * gmsh_yylex() is called, initialization will occur. */ @@ -2794,43 +2794,43 @@ int gmsh_yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; - for ( n = 0; s[n]; ++n ) - ; + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif void *gmsh_yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( size ); } void *gmsh_yyrealloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); } void gmsh_yyfree (void * ptr ) { - free( (char *) ptr ); /* see gmsh_yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see gmsh_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" @@ -2850,7 +2850,7 @@ void skipcomments(void) while (1) { while ((c = yyinput()) != '*'){ if(feof(gmsh_yyin)){ - Msg::Error("End of file in commented region"); + Msg::Error("End of file in commented region"); return; } } @@ -2917,8 +2917,8 @@ void skip_until(const char *skip, const char *until) while (1){ chars[0] = yyinput(); if(feof(gmsh_yyin)){ - Msg::Error("Unexpected end of file"); - return; + Msg::Error("Unexpected end of file"); + return; } if(chars[0] == until[0]) break; if(skip && chars[0] == skip[0]) break; @@ -2932,17 +2932,17 @@ void skip_until(const char *skip, const char *until) for(i=1; i<l; i++){ chars[i] = yyinput(); if(feof(gmsh_yyin)){ - l = i; - break; + l = i; + break; } } if(!strncmp(chars,until,l_until)){ if(!nb_skip){ - return; + return; } else{ - nb_skip--; + nb_skip--; } } else if(skip && !strncmp(chars,skip,l_skip)){ @@ -2950,7 +2950,7 @@ void skip_until(const char *skip, const char *until) } else{ for(i=1;i<l-1;i++){ - unput(chars[l-i]); + unput(chars[l-i]); } } diff --git a/Plugin/Annotate.cpp b/Plugin/Annotate.cpp index ec256cd73d884787198dc84a4a82602bc678a1ba..db93a76a8718298cee3eb24c0f2039ba4af617a4 100644 --- a/Plugin/Annotate.cpp +++ b/Plugin/Annotate.cpp @@ -11,7 +11,6 @@ #if defined(HAVE_FLTK) #include <FL/gl.h> #include "drawContext.h" -#include "Draw.h" #endif StringXNumber AnnotateOptions_Number[] = { @@ -41,8 +40,10 @@ static double getStyle() { int fontsize = (int)AnnotateOptions_Number[4].def, font = 0, align = 0; #if defined(HAVE_FLTK) - font = GetFontIndex(AnnotateOptions_String[1].def.c_str()); - align = GetFontAlign(AnnotateOptions_String[2].def.c_str()); + font = drawContext::global()->getFontIndex + (AnnotateOptions_String[1].def.c_str()); + align = drawContext::global()->getFontAlign + (AnnotateOptions_String[2].def.c_str()); #endif return (double)((align<<16)|(font<<8)|(fontsize)); } diff --git a/Plugin/CutGrid.cpp b/Plugin/CutGrid.cpp index d5d1e0ec39aee16b45a878c7249c9a377f2c9a0d..d72ae2f05d14ae71aa3024e5ab01fceada4ad863 100644 --- a/Plugin/CutGrid.cpp +++ b/Plugin/CutGrid.cpp @@ -11,7 +11,6 @@ #if defined(HAVE_FLTK) #include <FL/gl.h> #include "drawContext.h" -#include "Draw.h" #endif StringXNumber CutGridOptions_Number[] = { diff --git a/Plugin/CutParametric.cpp b/Plugin/CutParametric.cpp index 51c646f64f1c5cf2432dfbbb6e223cca4b8b49f6..5f1aa85a8f33424a866031167c187f0f3a523b11 100644 --- a/Plugin/CutParametric.cpp +++ b/Plugin/CutParametric.cpp @@ -13,7 +13,6 @@ #if defined(HAVE_FLTK) #include <FL/gl.h> #include "drawContext.h" -#include "Draw.h" #endif StringXNumber CutParametricOptions_Number[] = { diff --git a/Plugin/CutPlane.cpp b/Plugin/CutPlane.cpp index 7b64146ae2710b3ecb419ef8a172e083a7029f76..4942dc8c579f536a359006231bb1996ce32f3f22 100644 --- a/Plugin/CutPlane.cpp +++ b/Plugin/CutPlane.cpp @@ -9,7 +9,6 @@ #if defined(HAVE_FLTK) #include "drawContext.h" -#include "Draw.h" #endif int GMSH_CutPlanePlugin::iview = 0; diff --git a/Plugin/CutSphere.cpp b/Plugin/CutSphere.cpp index a41b1ea95f6400a4f93e6a3d950ee1eafbd86afa..aa675dc5a44c4bc14b8641e4f52c79ab731ae900 100644 --- a/Plugin/CutSphere.cpp +++ b/Plugin/CutSphere.cpp @@ -10,7 +10,6 @@ #if defined(HAVE_FLTK) #include "drawContext.h" -#include "Draw.h" #endif StringXNumber CutSphereOptions_Number[] = { diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp index ef77cc61ff2b856c4ee2d1ae501349a09e93ce69..f8e7a5fdfe15b14630a6195b8ebdf4b88b467edf 100644 --- a/Plugin/Plugin.cpp +++ b/Plugin/Plugin.cpp @@ -8,7 +8,7 @@ #include "GmshConfig.h" #include "Plugin.h" #include "Context.h" -#include "Draw.h" +#include "drawContext.h" void (*GMSH_Plugin::draw)(void*) = 0; @@ -22,7 +22,7 @@ void GMSH_Plugin::setDrawFunction(void (*fct)(void *)) CTX::instance()->post.draw = 0; CTX::instance()->mesh.draw = 0; } - Draw(); + drawContext::global()->draw(); CTX::instance()->drawBBox = old; CTX::instance()->post.draw = 1; CTX::instance()->mesh.draw = 1; diff --git a/Plugin/PluginManager.cpp b/Plugin/PluginManager.cpp index f4e81e4028b26bea72673dce7b302a50947e9263..828d97827ef4b283c25c7a33d44f3392253fff72 100644 --- a/Plugin/PluginManager.cpp +++ b/Plugin/PluginManager.cpp @@ -8,7 +8,6 @@ #include "GmshConfig.h" #include "StringUtils.h" #include "Context.h" -#include "Draw.h" #include "Plugin.h" #include "PluginManager.h" #include "CutMap.h" diff --git a/Plugin/Probe.cpp b/Plugin/Probe.cpp index d860e4f19ee5de71313efb412bad8b1f39beb54a..e037d21a925ba0f7ecabda3d5a459530a25a0d6a 100644 --- a/Plugin/Probe.cpp +++ b/Plugin/Probe.cpp @@ -11,7 +11,6 @@ #if defined(HAVE_FLTK) #include <FL/gl.h> #include "drawContext.h" -#include "Draw.h" #endif int GMSH_ProbePlugin::iview = 0; diff --git a/Plugin/StreamLines.cpp b/Plugin/StreamLines.cpp index 3e535a859e783c75912a7e0236fedae30a76e1a2..3c721fc04d01ce7e6fbb3953d1754cb2fcef57e3 100644 --- a/Plugin/StreamLines.cpp +++ b/Plugin/StreamLines.cpp @@ -13,7 +13,6 @@ #if defined(HAVE_FLTK) #include <FL/gl.h> #include "drawContext.h" -#include "Draw.h" #endif StringXNumber StreamLinesOptions_Number[] = { diff --git a/Qt/CMakeLists.txt b/Qt/CMakeLists.txt index 15cd94e0c3cd54bac51b8a38c50b4b6f72133444..7a7323c327bb8a8bd97ad326d7d7a80a46d0e93f 100644 --- a/Qt/CMakeLists.txt +++ b/Qt/CMakeLists.txt @@ -5,7 +5,6 @@ set(SRC QGui.cpp - Draw.cpp GLWidget.cpp graphicWindow.cpp ) diff --git a/Qt/Draw.cpp b/Qt/Draw.cpp deleted file mode 100644 index 8dcfdda087eb4f06adf3022c633f0d5dc6252728..0000000000000000000000000000000000000000 --- a/Qt/Draw.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle -// -// See the LICENSE.txt file for license information. Please report all -// bugs and problems to <gmsh@geuz.org>. - -#include <string.h> -#include "QGui.h" -#include "gl2ps.h" -#include "Context.h" -#include "drawContext.h" - -void Draw() -{ - drawContext *ctx = QGui::instance()->getDrawContext(); - ctx->draw3d(); - ctx->draw2d(); -} - -void DrawCurrentOpenglWindow(bool make_current) -{ -} - -int GetFontIndex(const char *fontname) -{ - return 0; -} - -int GetFontEnum(int index) -{ - return 0; -} - -const char *GetFontName(int index) -{ - return "Helvetica"; -} - -int GetFontAlign(const char *alignstr) -{ - return 0; -} - -int GetFontSize() -{ - return 14; -} - -void SetFont(int fontid, int fontsize) -{ -} - -double GetStringWidth(const char *str) -{ - return 14.; -} - -int GetStringHeight() -{ - return 14.; -} - -int GetStringDescent() -{ - return 10.; -} - -void DrawString(const char *str) -{ -} diff --git a/Qt/GLWidget.cpp b/Qt/GLWidget.cpp index 83261bba44b838915b867ed2c179b6695f5d0a52..333e5476844190e5441b5068565139ec9d868e1d 100644 --- a/Qt/GLWidget.cpp +++ b/Qt/GLWidget.cpp @@ -2,7 +2,6 @@ #include <QtOpenGL> #include <math.h> #include "GLWidget.h" -#include "Draw.h" GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent) diff --git a/Qt/QGui.cpp b/Qt/QGui.cpp index 5c82925d5a503cff470b7bbfcb12906287cf4a7e..4805238add7f2be9261ee26b82880aa594c6e962 100644 --- a/Qt/QGui.cpp +++ b/Qt/QGui.cpp @@ -9,10 +9,21 @@ #include "QGui.h" #include "graphicWindow.h" +class drawContextQt : public drawContextGlobal{ + public: + void draw() + { + drawContext *ctx = QGui::instance()->getDrawContext(); + ctx->draw3d(); + ctx->draw2d(); + } +}; + QGui::QGui(int argc, char **argv) { _graphicWindow = new graphicWindow(); _graphicWindow->show(); + drawContext::setGlobal(new drawContextQt); } QGui *QGui::_instance = 0; diff --git a/doc/VERSIONS.txt b/doc/VERSIONS.txt index 3f4f3173cc1ab625bed21afc5804b19c6817be55..661b0da3d53f2d5a474b1e481692d12e904464aa 100644 --- a/doc/VERSIONS.txt +++ b/doc/VERSIONS.txt @@ -1,7 +1,7 @@ -$Id: VERSIONS.txt,v 1.56 2009-08-29 12:13:15 geuzaine Exp $ +$Id: VERSIONS.txt,v 1.57 2009-08-30 15:10:46 geuzaine Exp $ 2.4.1 (Aug 31, 2009): fixed surface mesh orientation bug introduced in -2.4.0; 2D meshing code refactoring and small bug fixes. +2.4.0; code refactoring and small bug fixes. 2.4.0 (Aug 22, 2009): switched build system to CMake; optionally copy transfinite mesh contraints during geometry transformations; bumped diff --git a/utils/api_demos/mainAntTweakBar.cpp b/utils/api_demos/mainAntTweakBar.cpp index e1936db9a2f369dd9631fb30824baec4bbfbe974..3454d79d3dc7f8d63f5150147e7feb6a7904648c 100644 --- a/utils/api_demos/mainAntTweakBar.cpp +++ b/utils/api_demos/mainAntTweakBar.cpp @@ -16,21 +16,22 @@ drawContext *ctx = 0; -// Gmsh redefinitions (implement all functions from Graphics/Draw.h) -void Draw(){ ctx->draw3d(); ctx->draw2d(); } -void DrawCurrentOpenglWindow(bool make_current){} -int GetFontIndex(const char *fontname){ return 0; } -int GetFontEnum(int index){ return 0; } -const char *GetFontName(int index){ return "Helvetica"; } -int GetFontAlign(const char *alignstr){ return 0; } -int GetFontSize(){ return 18; } -void SetFont(int fontid, int fontsize){} -double GetStringWidth(const char *str) -{ return glutBitmapLength(GLUT_BITMAP_HELVETICA_18, (const unsigned char*)str); } -int GetStringHeight(){ return 18; } -int GetStringDescent(){ return 6; } -void DrawString(const char *str){ for (int i = 0; i < strlen(str); i++) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str[i]); } +class drawContextTw : public drawContextGlobal{ + public: + void draw(){ ctx->draw3d(); ctx->draw2d(); } + const char *getFontName(int index){ return "Helvetica"; } + int getFontSize(){ return 18; } + double getStringWidth(const char *str) + { + return glutBitmapLength(GLUT_BITMAP_HELVETICA_18, (const unsigned char*)str); + } + int getStringHeight(){ return 18; } + int getStringDescent(){ return 6; } + void drawString(const char *str){ + for (int i = 0; i < strlen(str); i++) + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str[i]); + } +}; // GLUT callbacks void display() @@ -38,7 +39,7 @@ void display() glViewport(ctx->viewport[0], ctx->viewport[1], ctx->viewport[2], ctx->viewport[3]); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - Draw(); + drawContext::global()->draw(); TwDraw(); glutSwapBuffers(); glutPostRedisplay(); @@ -196,6 +197,7 @@ int main(int argc, char **argv) for(int i = 1; i < argc; i++) GmshMergeFile(argv[i]); ctx = new drawContext(); + drawContext::setGlobal(new drawContextTw); if(!TwInit(TW_OPENGL, NULL)){ printf("AntTweakBar initialization failed: %s\n", TwGetLastError()); diff --git a/utils/api_demos/mainGlut.cpp b/utils/api_demos/mainGlut.cpp index f0b01ab1c4c032e72857a6435a19e772f99bbfec..0894672103b2fee16b8a7266f9f2370719eba8ea 100644 --- a/utils/api_demos/mainGlut.cpp +++ b/utils/api_demos/mainGlut.cpp @@ -14,26 +14,22 @@ drawContext *ctx = 0; -// Gmsh redefinitions (implement all functions from Graphics/Draw.h) -void Draw(){ ctx->draw3d(); ctx->draw2d(); } -void DrawCurrentOpenglWindow(bool make_current){} -int GetFontIndex(const char *fontname){ return 0; } -int GetFontEnum(int index){ return 0; } -const char *GetFontName(int index){ return "Helvetica"; } -int GetFontAlign(const char *alignstr){ return 0; } -int GetFontSize(){ return 18; } -void SetFont(int fontid, int fontsize){} -double GetStringWidth(const char *str) -{ - return glutBitmapLength(GLUT_BITMAP_HELVETICA_18, (const unsigned char*)str); -} -int GetStringHeight(){ return 18; } -int GetStringDescent(){ return 6; } -void DrawString(const char *str) -{ - for (int i = 0; i < strlen(str); i++) - glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str[i]); -} +class drawContextGlut : public drawContextGlobal{ + public: + void draw(){ ctx->draw3d(); ctx->draw2d(); } + const char *getFontName(int index){ return "Helvetica"; } + int getFontSize(){ return 18; } + double getStringWidth(const char *str) + { + return glutBitmapLength(GLUT_BITMAP_HELVETICA_18, (const unsigned char*)str); + } + int getStringHeight(){ return 18; } + int getStringDescent(){ return 6; } + void drawString(const char *str){ + for (int i = 0; i < strlen(str); i++) + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str[i]); + } +}; // GLUT callbacks void display() @@ -41,7 +37,7 @@ void display() glViewport(ctx->viewport[0], ctx->viewport[1], ctx->viewport[2], ctx->viewport[3]); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - Draw(); + drawContext::global()->draw(); glutSwapBuffers(); } @@ -106,6 +102,7 @@ int main(int argc, char **argv) for(int i = 1; i < argc; i++) GmshMergeFile(argv[i]); ctx = new drawContext(); + drawContext::setGlobal(new drawContextGlut); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);