diff --git a/Box/Main.cpp b/Box/Main.cpp index 0dcd0338bb28808f60c9c1bac2766fd3ecaef7fe..1a32cad49cf3eb41485e1c21738e7857a5a43a13 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,11 +1,18 @@ -// $Id: Main.cpp,v 1.14 2001-12-05 10:53:11 geuzaine Exp $ +// $Id: Main.cpp,v 1.15 2002-02-13 09:17:48 stainier Exp $ #include <signal.h> #include "ParUtil.h" #include <signal.h> #if !defined(WIN32) || defined(__CYGWIN__) +#ifdef __APPLE__ +#include <sys/time.h> +#endif /* __APPLE__ */ #include <sys/resource.h> +#ifdef __APPLE__ +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN -1 +#endif /* __APPLE__ */ #endif #include "PluginManager.h" diff --git a/Common/ColorTable.cpp b/Common/ColorTable.cpp index 566fb89576a54427dda25f4b0a7c4b436f821f87..ba1d8ee1be90e4be16c6a8f4400c0af7369e7726 100644 --- a/Common/ColorTable.cpp +++ b/Common/ColorTable.cpp @@ -1,4 +1,4 @@ -// $Id: ColorTable.cpp,v 1.4 2001-12-03 08:41:43 geuzaine Exp $ +// $Id: ColorTable.cpp,v 1.5 2002-02-13 09:20:14 stainier Exp $ #include "Gmsh.h" #include "ColorTable.h" @@ -6,7 +6,7 @@ extern Context_T CTX ; -void ColorTable_InitParam(int number, ColorTable *ct, +void ColorTable_InitParam(int number, GmshColorTable *ct, int rgb_flag, int alpha_flag){ ct->ipar[COLORTABLE_NUMBER] = number; @@ -27,7 +27,7 @@ void ColorTable_InitParam(int number, ColorTable *ct, } -void ColorTable_Recompute(ColorTable *ct, int rgb_flag, int alpha_flag){ +void ColorTable_Recompute(GmshColorTable *ct, int rgb_flag, int alpha_flag){ float curve, bias; double gamma; int i,r,g,b,a,rotate; @@ -172,16 +172,16 @@ void ColorTable_Recompute(ColorTable *ct, int rgb_flag, int alpha_flag){ } -static ColorTable clip; +static GmshColorTable clip; -void ColorTable_Copy(ColorTable *ct){ +void ColorTable_Copy(GmshColorTable *ct){ clip.size = ct->size; memcpy(clip.table, ct->table, ct->size * sizeof(unsigned int)); memcpy(clip.ipar, ct->ipar, COLORTABLE_NBMAX_PARAM * sizeof(int)); memcpy(clip.fpar, ct->fpar, COLORTABLE_NBMAX_PARAM * sizeof(float)); } -void ColorTable_Paste(ColorTable *ct){ +void ColorTable_Paste(GmshColorTable *ct){ ct->size = clip.size; memcpy(ct->table, clip.table, clip.size * sizeof(unsigned int)); memcpy(ct->ipar, clip.ipar, COLORTABLE_NBMAX_PARAM * sizeof(int)); @@ -189,7 +189,7 @@ void ColorTable_Paste(ColorTable *ct){ } -void ColorTable_Print(ColorTable *ct, FILE *fp){ +void ColorTable_Print(GmshColorTable *ct, FILE *fp){ int i, r, g, b, a; char tmp1[1024],tmp2[1024]; diff --git a/Common/ColorTable.h b/Common/ColorTable.h index e0b1b52676beb57c63ded298f844bcf0dbc4617e..99ec36fe51ab27d8f105946b7065f69171fe01c8 100644 --- a/Common/ColorTable.h +++ b/Common/ColorTable.h @@ -9,7 +9,7 @@ typedef struct{ int size; // must be >= 2 int ipar[COLORTABLE_NBMAX_PARAM]; float fpar[COLORTABLE_NBMAX_PARAM]; -}ColorTable; +}GmshColorTable; /* COLORTABLE_MODE */ @@ -35,10 +35,10 @@ typedef struct{ #define COLORTABLE_ALPHAVAL 3 /* alpha channel value */ #define COLORTABLE_BETA 4 /* beta coeff for brighten */ -void ColorTable_InitParam (int number, ColorTable * ct, int rgb_flag, int alpha_flag); -void ColorTable_Recompute (ColorTable * ct, int rgb_flag, int alpha_flag); -void ColorTable_Copy(ColorTable *ct); -void ColorTable_Paste(ColorTable *ct); -void ColorTable_Print(ColorTable *ct, FILE *fp) ; +void ColorTable_InitParam (int number, GmshColorTable * ct, int rgb_flag, int alpha_flag); +void ColorTable_Recompute (GmshColorTable * ct, int rgb_flag, int alpha_flag); +void ColorTable_Copy(GmshColorTable *ct); +void ColorTable_Paste(GmshColorTable *ct); +void ColorTable_Print(GmshColorTable *ct, FILE *fp) ; #endif diff --git a/Common/GmshUI.h b/Common/GmshUI.h index 4440f4669f54bb31908116a902153149404dcbf9..c1e71a990019102c688a11c6759150f5b9405a75 100644 --- a/Common/GmshUI.h +++ b/Common/GmshUI.h @@ -10,7 +10,11 @@ #ifdef _FLTK #include <FL/Fl.H> #include <FL/gl.h> +#ifdef __APPLE__ +#include <OpenGL/glu.h> +#else #include <GL/glu.h> +#endif /* __APPLE__ */ #endif diff --git a/Common/Views.cpp b/Common/Views.cpp index c67d139dfe3c4ad4274c10ac9d71adccc3ff4f51..b76dc13d806d48371789d760314f75a2825264a0 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.63 2002-01-18 23:46:38 geuzaine Exp $ +// $Id: Views.cpp,v 1.64 2002-02-13 09:20:41 stainier Exp $ #include <set> #include "Gmsh.h" @@ -455,7 +455,7 @@ void CopyViewOptions(Post_View *src, Post_View *dest){ ColorTable_Paste(&dest->CT); } -ColorTable *Get_ColorTable(int num){ +GmshColorTable *Get_ColorTable(int num){ Post_View *v; if(!CTX.post.list) diff --git a/Common/Views.h b/Common/Views.h index d7784152f7bc8781fe43b4b953b9e4ff40b0cb15..dc470d259a5058df09f316398062e4657567407e 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -44,7 +44,7 @@ class Post_View{ int DrawScalars, DrawVectors, DrawTensors; int Boundary, Grid; double PointSize, LineWidth; - ColorTable CT; + GmshColorTable CT; // dynamic double (*GVFI) (double min, double max, int nb, int index); @@ -113,7 +113,7 @@ int CreateBGM(Post_View *ErrView, int OptiMethod, double Degree, double ErrorInView(Post_View * ErrView, int *n); Post_View *Create2DGraph(char *xname, char *yname, int nbdata, double *x, double *y); -ColorTable *Get_ColorTable(int num); +GmshColorTable *Get_ColorTable(int num); void Print_ColorTable(int num, char *prefix, FILE *file); #endif diff --git a/DataStr/Malloc.cpp b/DataStr/Malloc.cpp index fb02765f15ea032221496f02efc7c74488b749d7..afaa3bb92048cb67d4211ea341afc1a74b2d6ff1 100644 --- a/DataStr/Malloc.cpp +++ b/DataStr/Malloc.cpp @@ -1,7 +1,9 @@ -// $Id: Malloc.cpp,v 1.8 2001-06-07 15:13:08 geuzaine Exp $ +// $Id: Malloc.cpp,v 1.9 2002-02-13 09:20:41 stainier Exp $ #include <stdio.h> #include <stdlib.h> +#ifndef __APPLE__ #include <malloc.h> +#endif #include "Malloc.h" #include "Message.h" diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp index e01d75d10e6ebc8853745f595aa3aac010d0c933..9d671b972a0ec3cdc54f4da91033861afd2b223f 100644 --- a/Fltk/Colorbar_Window.cpp +++ b/Fltk/Colorbar_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Colorbar_Window.cpp,v 1.17 2001-11-23 13:32:21 geuzaine Exp $ +// $Id: Colorbar_Window.cpp,v 1.18 2002-02-13 09:20:41 stainier Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -328,7 +328,7 @@ void Colorbar_Window::draw(){ // Update void Colorbar_Window::update(char *name, float min, float max, - ColorTable *table, int *changed){ + GmshColorTable *table, int *changed){ label = name; ct = table; viewchanged = changed; diff --git a/Fltk/Colorbar_Window.h b/Fltk/Colorbar_Window.h index ce037d5d5a55256cffce3f09f47fdf36413f2874..1592706b789e9b97b09f8088aebd054bc22044bd 100644 --- a/Fltk/Colorbar_Window.h +++ b/Fltk/Colorbar_Window.h @@ -25,14 +25,14 @@ class Colorbar_Window : public Fl_Window { int help_flag; // if nonzero, print help message int marker_pos; // position of marker as index into table - ColorTable *ct; // pointer to the color table (allocated in Post_View) + GmshColorTable *ct; // pointer to the color table (allocated in Post_View) int *viewchanged;// pointer to changed bit in view Fl_Color color_bg; public: Colorbar_Window(int x,int y,int w,int h,const char *l=0); - void update(char *name, float min, float max, ColorTable *ct, int *changed); + void update(char *name, float min, float max, GmshColorTable *ct, int *changed); }; diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index a086c22559a0e3a7eb668afe762a2604d5f4a8bd..4399383ac314c43c5be0a2e49d5f034fe4d02367 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.150 2002-02-09 19:50:50 geuzaine Exp $ +// $Id: GUI.cpp,v 1.151 2002-02-13 09:20:41 stainier Exp $ // To make the interface as visually consistent as possible, please: // - use the IW, BB, BH, BW and WB values @@ -534,6 +534,8 @@ GUI::GUI(int argc, char **argv) { #ifdef WIN32 m_window->icon((char *)LoadImage(fl_display, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR)); +#elif defined(__APPLE__) + /* ??? */ #else fl_open_display(); Pixmap p1 = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index 150abcb3c6951f72ce739b73973036785ea94574..d077f8b99669b936fa5313d675abe9930b255646 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,9 +1,16 @@ -// $Id: Message.cpp,v 1.24 2001-11-20 09:04:54 geuzaine Exp $ +// $Id: Message.cpp,v 1.25 2002-02-13 09:20:41 stainier Exp $ #include <unistd.h> #include <signal.h> #if !defined(WIN32) || defined(__CYGWIN__) +#ifdef __APPLE__ +#include <sys/time.h> +#endif /* __APPLE__ */ #include <sys/resource.h> +#ifdef __APPLE__ +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN -1 +#endif /* __APPLE__ */ #endif #include "Gmsh.h" diff --git a/Graphics/Draw.h b/Graphics/Draw.h index 3cc47c267e3944727e371d49591a559f66b7f062..02b4094327e2bee12113d46416b3aa072fe8d175 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -26,7 +26,7 @@ void set_s(int i, double val); void Replot(void); void RaiseFill (int i, double Val, double ValMin, double Raise[3][5]); -void Palette (Post_View * View, int nbi, int i); +void Palette1 (Post_View * View, int nbi, int i); void Palette2 (Post_View * View, double min, double max, double val); void ColorSwitch(int i); diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index 4df574332c73d81c18f995733efa10e378f2f4b2..94e77fb5a82cbc400feba86b878d2c75a102d15b 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.31 2001-12-03 08:41:43 geuzaine Exp $ +// $Id: Post.cpp,v 1.32 2002-02-13 09:20:41 stainier Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -67,7 +67,7 @@ int GiveIndexFromValue_DoubleLog(double ValMin, double ValMax, int NbIso, double Color Palette ------------------------------------------------------------------------ */ -void Palette(Post_View *v, int nbi, int i){ /* i in [0,nbi-1] */ +void Palette1(Post_View *v, int nbi, int i){ /* i in [0,nbi-1] */ int index ; index = (nbi==1) ? diff --git a/Graphics/PostSimplex.cpp b/Graphics/PostSimplex.cpp index 85acc5d55c88628b34bf0865b8c4ffc79c855647..b322db0c6c2a2c1cc4a219b2dc189c1db192a38b 100644 --- a/Graphics/PostSimplex.cpp +++ b/Graphics/PostSimplex.cpp @@ -1,4 +1,4 @@ -// $Id: PostSimplex.cpp,v 1.31 2001-11-19 09:29:18 geuzaine Exp $ +// $Id: PostSimplex.cpp,v 1.32 2002-02-13 09:20:41 stainier Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -161,7 +161,7 @@ void Draw_ScalarLine(Post_View *View, } else{ for(k=0 ; k<View->NbIso ; k++){ - Palette(View,View->NbIso,k); + Palette1(View,View->NbIso,k); if(View->IntervalsType==DRAW_POST_DISCRETE){ CutLine1D(X,Y,Z,&Val[0], View->GVFI(ValMin,ValMax,View->NbIso+1,k), @@ -329,7 +329,7 @@ void Draw_ScalarTriangle(Post_View *View, int preproNormals, else{ for(k=0 ; k<View->NbIso ; k++){ if(View->IntervalsType == DRAW_POST_DISCRETE){ - Palette(View,View->NbIso,k); + Palette1(View,View->NbIso,k); CutTriangle2D(X,Y,Z,Val, View->GVFI(ValMin,ValMax,View->NbIso+1,k), View->GVFI(ValMin,ValMax,View->NbIso+1,k+1), @@ -341,7 +341,7 @@ void Draw_ScalarTriangle(Post_View *View, int preproNormals, } } else{ - Palette(View,View->NbIso,k); + Palette1(View,View->NbIso,k); thev = View->GVFI(ValMin,ValMax,View->NbIso,k); CutTriangle1D(X,Y,Z,Val, thev, ValMin,ValMax,Xp,Yp,Zp,&nb); @@ -421,7 +421,7 @@ void Draw_ScalarTetrahedron(Post_View *View, int preproNormals, } else{ for(k=0 ; k<View->NbIso ; k++){ - if(!preproNormals) Palette(View,View->NbIso,k); + if(!preproNormals) Palette1(View,View->NbIso,k); IsoSimplex(View, preproNormals, X, Y, Z, Val, View->GVFI(ValMin,ValMax,View->NbIso,k), ValMin, ValMax, Raise); @@ -500,7 +500,7 @@ void Draw_VectorSimplex(int nbnod, Post_View *View, dz /= (double)nbnod; zc /= (double)nbnod; dd = sqrt(dx*dx+dy*dy+dz*dz); if(dd!=0.0 && dd>=ValMin && dd<=ValMax){ - Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,dd)); + Palette1(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,dd)); if(View->IntervalsType == DRAW_POST_NUMERIC){ glRasterPos3d(xc, yc, zc); sprintf(Num, View->Format, dd); @@ -522,7 +522,7 @@ void Draw_VectorSimplex(int nbnod, Post_View *View, else{ for(k=0 ; k<nbnod ; k++){ if(d[k]!=0.0 && d[k]>=ValMin && d[k]<=ValMax){ - Palette(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d[k])); + Palette1(View,View->NbIso,View->GIFV(ValMin,ValMax,View->NbIso,d[k])); fact = CTX.pixel_equiv_x/CTX.s[0] * View->ArrowScale/ValMax ; if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin>0){ Val[k][0] /= d[k] ; Val[k][1] /= d[k] ; Val[k][2] /= d[k] ; diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp index cf545686c0ea7c5845e1cb6692faf6043776421d..a91048edac58824ed3f772b7f699a3eaaecb1b5b 100644 --- a/Graphics/Scale.cpp +++ b/Graphics/Scale.cpp @@ -1,4 +1,4 @@ -// $Id: Scale.cpp,v 1.27 2001-12-03 08:41:44 geuzaine Exp $ +// $Id: Scale.cpp,v 1.28 2002-02-13 09:20:41 stainier Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -85,7 +85,7 @@ void draw_scale(Post_View *v, for(i=0;i<v->NbIso;i++){ if(v->IntervalsType==DRAW_POST_DISCRETE){ - Palette(v,v->NbIso,i); + Palette1(v,v->NbIso,i); glBegin(GL_QUADS); glVertex2d(xmin, ymin+i*cs_bh); glVertex2d(xmin+width, ymin+i*cs_bh); @@ -104,7 +104,7 @@ void draw_scale(Post_View *v, glEnd(); } else{ - Palette(v,v->NbIso,i); + Palette1(v,v->NbIso,i); glBegin(GL_LINES); glVertex2d(xmin, ymin+i*cs_bh+0.5*cs_bh); glVertex2d(xmin+width, ymin+i*cs_bh+0.5*cs_bh); diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h index 51e21837c2fa34089b08deded8f36cb4a4d6249e..96888ff1238c858105c89686079ce795e9de6104 100644 --- a/Graphics/gl2ps.h +++ b/Graphics/gl2ps.h @@ -2,7 +2,7 @@ * GL2PS, an OpenGL to PostScript Printing Library * Copyright (C) 1999-2002 Christophe Geuzaine * - * $Id: gl2ps.h,v 1.17 2002-02-05 20:13:51 geuzaine Exp $ + * $Id: gl2ps.h,v 1.18 2002-02-13 09:20:41 stainier Exp $ * * E-mail: geuz@geuz.org * URL: http://www.geuz.org/gl2ps/ @@ -32,7 +32,11 @@ #ifdef WIN32 #include <windows.h> #endif +#ifdef __APPLE__ +#include <OpenGL/gl.h> +#else #include <GL/gl.h> +#endif /* __APPLE__ */ #define GL2PS_VERSION 0.52 #define GL2PS_NONE 0 diff --git a/Makefile b/Makefile index 10c7644763675520a5a1d262ff2eabae2808c0e1..e015367ee9457e5d409cde406ce987133e451bc7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.188 2002-02-12 23:26:04 geuzaine Exp $ +# $Id: Makefile,v 1.189 2002-02-13 09:16:06 stainier Exp $ GMSH_MAJOR_VERSION = 1 GMSH_MINOR_VERSION = 34 @@ -658,3 +658,23 @@ link-solaris-scorec: -L/usr/X11R6/lib -lX11 -lm -ldl -lsocket solaris-scorec: compile-solaris-scorec link-solaris-scorec +# +# MacOS X +# +compile-macosx: initialtag + @for i in $(GMSH_FLTK_DIR); do (cd $$i && $(MAKE) \ + "CXX=$(CXX)" \ + "CC=$(CC)" \ + "AR=ar ruv" \ + "OPT_FLAGS=-O2" \ + "OS_FLAGS=" \ + "VERSION_FLAGS=-D_FLTK -D_NODLL" \ + "GL_INCLUDE=" \ + "GUI_INCLUDE=-I$(HOME)/Projects/fltk" \ + ); done +link-macosx: + $(CXX) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB) -L../fltk/lib -lfltk_gl -lfltk_base \ + -framework AGL -framework OpenGL -framework Carbon -framework ApplicationServices + /Developer/Tools/Rez -t APPL -o $(GMSH_BIN_DIR)/gmsh ../fltk/FL/mac.r +macosx: compile-macosx link-macosx + diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 91d3e81b6a907fbf4bfebe28cb43067661526675..998416f120b9f95b5da7441e6baed48b44ccda18 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -177,7 +177,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.134 2001-12-16 05:16:37 remacle Exp $ +// $Id: Gmsh.tab.cpp,v 1.135 2002-02-13 09:20:41 stainier Exp $ #include <stdarg.h> #ifndef _NOPLUGIN @@ -4222,7 +4222,7 @@ case 162: case 163: #line 1077 "Gmsh.y" { - ColorTable *ct = Get_ColorTable(0); + GmshColorTable *ct = Get_ColorTable(0); if(!ct) vyyerror("View[%d] does not exist", 0); else{ @@ -4243,7 +4243,7 @@ case 163: case 164: #line 1097 "Gmsh.y" { - ColorTable *ct = Get_ColorTable((int)yyvsp[-6].d); + GmshColorTable *ct = Get_ColorTable((int)yyvsp[-6].d); if(!ct) vyyerror("View[%d] does not exist", (int)yyvsp[-6].d); else{ @@ -6101,7 +6101,7 @@ case 376: #line 2641 "Gmsh.y" { yyval.l = List_Create(256,10,sizeof(unsigned int)) ; - ColorTable *ct = Get_ColorTable((int)yyvsp[-3].d); + GmshColorTable *ct = Get_ColorTable((int)yyvsp[-3].d); if(!ct) vyyerror("View[%d] does not exist", (int)yyvsp[-3].d); else{ diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 0b86c3eb9438ffce1a2f5aaf2bacf460e770f13d..66f23360fc30d0bdb5f21f0be0d8b1359b2dadc5 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,6 +1,6 @@ %{ -// $Id: Gmsh.y,v 1.115 2001-12-03 08:41:44 geuzaine Exp $ +// $Id: Gmsh.y,v 1.116 2002-02-13 09:20:41 stainier Exp $ #include <stdarg.h> #ifndef _NOPLUGIN @@ -1075,7 +1075,7 @@ Affectation : | tSTRING '.' tColorTable tAFFECT ListOfColor tEND { - ColorTable *ct = Get_ColorTable(0); + GmshColorTable *ct = Get_ColorTable(0); if(!ct) vyyerror("View[%d] does not exist", 0); else{ @@ -1095,7 +1095,7 @@ Affectation : | tSTRING '[' FExpr ']' '.' tColorTable tAFFECT ListOfColor tEND { - ColorTable *ct = Get_ColorTable((int)$3); + GmshColorTable *ct = Get_ColorTable((int)$3); if(!ct) vyyerror("View[%d] does not exist", (int)$3); else{ @@ -2640,7 +2640,7 @@ ListOfColor : | tSTRING '[' FExpr ']' '.' tColorTable { $$ = List_Create(256,10,sizeof(unsigned int)) ; - ColorTable *ct = Get_ColorTable((int)$3); + GmshColorTable *ct = Get_ColorTable((int)$3); if(!ct) vyyerror("View[%d] does not exist", (int)$3); else{