From: <hez...@us...> - 2009-08-18 18:48:31
|
Revision: 10288 http://plplot.svn.sourceforge.net/plplot/?rev=10288&view=rev Author: hezekiahcarty Date: 2009-08-18 18:48:18 +0000 (Tue, 18 Aug 2009) Log Message: ----------- Add plbtime, plconfigtime, plctime to OCaml, update ex29.ml to use them This commit also includes some general cleanup to bring the OCaml binding infrastructure up-to-date with the current PLplot state. Modified Paths: -------------- trunk/bindings/ocaml/plplot_h trunk/bindings/ocaml/plplot_h.inc trunk/bindings/ocaml/touchup.ml trunk/examples/ocaml/x29.ml Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2009-08-18 18:18:11 UTC (rev 10287) +++ trunk/bindings/ocaml/plplot_h 2009-08-18 18:48:18 UTC (rev 10288) @@ -18,21 +18,11 @@ void c_pladv(PLINT page); -/* void -c_plarrows(PLFLT *u, PLFLT *v, PLFLT *x, PLFLT *y, PLINT n, - PLFLT scale, PLFLT dx, PLFLT dy) ; +c_plarc(PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, + PLBOOL fill); void -c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, - void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), - PLPointer pltr_data); -*/ - - void -c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill); - - void c_plaxes(PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub); @@ -40,6 +30,9 @@ c_plbin(PLINT nbin, PLFLT *x, PLFLT *y, plplot_bin_style opt); void +c_plbtime(PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime); + + void c_plbop(void); void @@ -55,10 +48,6 @@ c_plcalc_world(PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window); void -c_plarc(PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, - PLBOOL fill); - - void c_plclear(void); void @@ -67,6 +56,9 @@ void c_plcol1(PLFLT col1); + void +c_plconfigtime(PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec); + /* void c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, @@ -86,6 +78,9 @@ void c_plcpstrm(PLINT iplsr, PLBOOL flags); + void +c_plctime(PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime); + /* void pldid2pc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax); @@ -223,9 +218,6 @@ PLINT nbin, plplot_hist_style opt); void -c_plhls(PLFLT h, PLFLT l, PLFLT s); - - void c_plhlsrgb(PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b); void @@ -322,6 +314,9 @@ c_plptex3(PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, const char *text); + PLFLT +c_plrandd(void); + void c_plreplot(void); @@ -395,6 +390,9 @@ c_plsdiplz(PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax); void +c_plseed(unsigned int s); + + void c_plsesc(char esc); void @@ -455,6 +453,10 @@ void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); + + void +c_plslabelfunc(void (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer), + PLPointer label_data); */ void @@ -519,9 +521,10 @@ /* void c_plimagefr(PLFLT **idata, PLINT nx, PLINT ny, - PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, - PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax, - PLFLT valuemin, PLFLT valuemax); + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, + void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), + PLPointer pltr_data); */ void @@ -544,6 +547,9 @@ */ void +c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill); + + void c_plsvpa(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax); void @@ -570,7 +576,14 @@ void c_plvasp(PLFLT aspect); +/* void +c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, + void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), + PLPointer pltr_data); +*/ + + void c_plvpas(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect); void @@ -593,12 +606,6 @@ void c_plxormod(PLBOOL mode, PLBOOL *status); - void -c_plseed(unsigned int s); - - PLFLT -c_plrandd(void); - /* void plgFileDevs(const char ***p_menustr, const char ***p_devname, int *p_ndev); @@ -666,7 +673,6 @@ void plSetUsage(const char *program_string, const char *usage_string); - */ int Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2009-08-18 18:18:11 UTC (rev 10287) +++ trunk/bindings/ocaml/plplot_h.inc 2009-08-18 18:48:18 UTC (rev 10288) @@ -1,18 +1,20 @@ [mlname(pl_setcontlabelformat)] void c_pl_setcontlabelformat(int lexp, int sigdig); [mlname(pl_setcontlabelparam)] void c_pl_setcontlabelparam ( double offset, double size, double spacing, int active ); [mlname(pladv)] void c_pladv ( int page ); -[mlname(plsvect)] void c_plsvect ( [in, size_is(npts)] double * arrowx, [in, size_is(npts)] double * arrowy, int npts, boolean fill ); +[mlname(plarc)] void c_plarc ( double x, double y, double a, double b, double angle1, double angle2, boolean fill ); [mlname(plaxes)] void c_plaxes ( double x0, double y0, [string] const char * xopt, double xtick, int nxsub, [string] const char * yopt, double ytick, int nysub ); [mlname(plbin)] void c_plbin ( int nbin, [in, size_is(nbin)] double * x, [in, size_is(nbin)] double * y, plplot_bin_style opt ); +[mlname(plbtime)] void c_plbtime ( [out] int * year, [out] int * month, [out] int * day, [out] int * hour, [out] int * min, [out] double * sec, double ctime ); [mlname(plbop)] void c_plbop ( void ); [mlname(plbox)] void c_plbox ( [string] const char * xopt, double xtick, int nxsub, [string] const char * yopt, double ytick, int nysub ); [mlname(plbox3)] void c_plbox3 ( [string] const char * xopt, [string] const char * xlabel, double xtick, int nsubx, [string] const char * yopt, [string] const char * ylabel, double ytick, int nsuby, [string] const char * zopt, [string] const char * zlabel, double ztick, int nsubz ); [mlname(plcalc_world)] void c_plcalc_world ( double rx, double ry, [out] double * wx, [out] double * wy, [out] int * window ); -[mlname(plarc)] void c_plarc ( double x, double y, double a, double b, double angle1, double angle2, boolean fill ); [mlname(plclear)] void c_plclear ( void ); [mlname(plcol0)] void c_plcol0 ( int icol0 ); [mlname(plcol1)] void c_plcol1 ( double col1 ); +[mlname(plconfigtime)] void c_plconfigtime ( double scale, double offset1, double offset2, int ccontrol, boolean ifbtime_offset, int year, int month, int day, int hour, int min, double sec ); [mlname(plcpstrm)] void c_plcpstrm ( int iplsr, boolean flags ); +[mlname(plctime)] void c_plctime ( int year, int month, int day, int hour, int min, double sec, [out] double * ctime ); [mlname(plend)] void c_plend ( void ); [mlname(plend1)] void c_plend1 ( void ); [mlname(plenv)] void c_plenv ( double xmin, double xmax, double ymin, double ymax, int just, int axis ); @@ -52,7 +54,6 @@ [mlname(plgyax)] void c_plgyax ( [out] int * p_digmax, [out] int * p_digits ); [mlname(plgzax)] void c_plgzax ( [out] int * p_digmax, [out] int * p_digits ); [mlname(plhist)] void c_plhist ( int n, [in, size_is(n), size_is(n)] double * data, double datmin, double datmax, int nbin, plplot_hist_style opt ); -[mlname(plhls)] void c_plhls ( double h, double l, double s ); [mlname(plhlsrgb)] void c_plhlsrgb ( double h, double l, double s, [out] double * p_r, [out] double * p_g, [out] double * p_b ); [mlname(plinit)] void c_plinit ( void ); [mlname(pljoin)] void c_pljoin ( double x1, double y1, double x2, double y2 ); @@ -75,6 +76,7 @@ [mlname(plpsty)] void c_plpsty ( int patt ); [mlname(plptex)] void c_plptex ( double x, double y, double dx, double dy, double just, [string] const char * text ); [mlname(plptex3)] void c_plptex3 ( double wx, double wy, double wz, double dx, double dy, double dz, double sx, double sy, double sz, double just, [string] const char * text ); +[mlname(plrandd)] double c_plrandd ( void ); [mlname(plreplot)] void c_plreplot ( void ); [mlname(plrgbhls)] void c_plrgbhls ( double r, double g, double b, [out] double * p_h, [out] double * p_l, [out] double * p_s ); [mlname(plschr)] void c_plschr ( double def, double scale ); @@ -98,6 +100,7 @@ [mlname(plsdiori)] void c_plsdiori ( double rot ); [mlname(plsdiplt)] void c_plsdiplt ( double xmin, double ymin, double xmax, double ymax ); [mlname(plsdiplz)] void c_plsdiplz ( double xmin, double ymin, double xmax, double ymax ); +[mlname(plseed)] void c_plseed ( [int64] unsigned int s ); [mlname(plsesc)] void c_plsesc ( char esc ); [mlname(plsfam)] void c_plsfam ( int fam, int num, int bmax ); [mlname(plsfci)] void c_plsfci ( long long fci ); @@ -120,6 +123,7 @@ [mlname(plimage)] void c_plimage ( [in, size_is(nx, ny)] double ** idata, int nx, int ny, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double Dxmin, double Dxmax, double Dymin, double Dymax ); [mlname(plstyl)] void c_plstyl ( int nms, [size_is(nms)] int * mark, [size_is(nms)] int * space ); [mlname(plsurf3d)] void c_plsurf3d ( [size_is(nx), in] double * x, [size_is(ny), in] double * y, [size_is(nx, ny), in] double ** z, int nx, int ny, plplot3d_style opt, [size_is(nlevel), in] double * clevel, int nlevel ); +[mlname(plsvect)] void c_plsvect ( [in, size_is(npts)] double * arrowx, [in, size_is(npts)] double * arrowy, int npts, boolean fill ); [mlname(plsvpa)] void c_plsvpa ( double xmin, double xmax, double ymin, double ymax ); [mlname(plsxax)] void c_plsxax ( int digmax, int digits ); void plsxwin ( int window_id ); @@ -136,7 +140,5 @@ [mlname(plwid)] void c_plwid ( int width ); [mlname(plwind)] void c_plwind ( double xmin, double xmax, double ymin, double ymax ); [mlname(plxormod)] void c_plxormod ( boolean mode, [out] boolean * status ); -[mlname(plseed)] void c_plseed ( [int64] unsigned int s ); -[mlname(plrandd)] double c_plrandd ( void ); [mlname(plsetopt)] int c_plsetopt ( [string] const char * opt, [string] const char * optarg ); void plMinMax2dGrid ( [size_is(nx, ny)] double ** f, int nx, int ny, [out] double * fmax, [out] double * fmin ); Modified: trunk/bindings/ocaml/touchup.ml =================================================================== --- trunk/bindings/ocaml/touchup.ml 2009-08-18 18:18:11 UTC (rev 10287) +++ trunk/bindings/ocaml/touchup.ml 2009-08-18 18:48:18 UTC (rev 10288) @@ -77,6 +77,11 @@ parameter_attrs = Some ["inc", ["in"; "size_is(nlin)"]; "del", ["in"; "size_is(nlin)"]]; }; + { + function_name = "c_plctime"; + function_attrs = None; + parameter_attrs = Some ["ctime", ["out"]]; + }; (* For now, this will be wrapped by hand... { function_name = "c_plgriddata"; @@ -313,6 +318,12 @@ List.mem p_name ["wx"; "wy"; "window"], true, ["out"]; + (* Time conversion *) + function_name = "c_plbtime", + pmatch "\\*" p_type, + true, + true, + ["out"]; ] in Modified: trunk/examples/ocaml/x29.ml =================================================================== --- trunk/examples/ocaml/x29.ml 2009-08-18 18:18:11 UTC (rev 10287) +++ trunk/examples/ocaml/x29.ml 2009-08-18 18:48:18 UTC (rev 10288) @@ -24,6 +24,7 @@ *) open Plplot +open Printf let pi = atan 1.0 *. 4.0 @@ -183,6 +184,148 @@ plline x y; () +let plot4 () = + (* TAI-UTC (seconds) as a function of time. + Use Besselian epochs as the continuous time interval just to prove + this does not introduce any issues. *) + + (* Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch + * B = 1900. + (JD -2415020.31352)/365.242198781 + * ==> (as calculated with aid of "bc -l" command) + * B = (MJD + 678940.364163900)/365.242198781 + * ==> + * MJD = B*365.24219878 - 678940.364163900 *) + let scale = 365.242198781 in + let offset1 = -678940.0 in + let offset2 = -0.3641639 in + plconfigtime scale offset1 offset2 0x0 false 0 0 0 0 0 0.0; + + let xmin = ref 0.0 in + let xmax = ref 0.0 in + let npts = ref 0 in + let ymin = ref 0.0 in + let ymax = ref 0.0 in + let time_format = ref "" in + let if_TAI_time_format = ref false in + let title_suffix = ref "" in + let xtitle = ref "" in + let xlabel_step = ref 0.0 in + + for kind = 0 to 6 do + let () = + match kind with + | 0 -> + xmin := plctime 1950 0 2 0 0 0.0; + xmax := plctime 2020 0 2 0 0 0.0; + npts := 70 * 12 + 1; + ymin := 0.0; + ymax := 36.0; + time_format := "%Y%"; + if_TAI_time_format := true; + title_suffix := "from 1950 to 2020"; + xtitle := "Year"; + xlabel_step := 10.0; + | 1 + | 2 -> + xmin := plctime 1961 7 1 0 0 (1.64757 -. 0.20); + xmax := plctime 1961 7 1 0 0 (1.64757 +. 0.20); + npts := 1001; + ymin := 1.625; + ymax := 1.725; + time_format := "%S%2%"; + title_suffix := "near 1961-08-01 (TAI)"; + xlabel_step := 0.05 /. (scale *. 86400.0); + if kind = 1 then ( + if_TAI_time_format := true; + xtitle := "Seconds (TAI)"; + ) + else ( + if_TAI_time_format := false; + xtitle := "Seconds (TAI) labelled with corresponding UTC"; + ) + | 3 + | 4 -> + xmin := plctime 1963 10 1 0 0 (2.6972788 -. 0.20); + xmax := plctime 1963 10 1 0 0 (2.6972788 +. 0.20); + npts := 1001; + ymin := 2.55; + ymax := 2.75; + time_format := "%S%2%"; + title_suffix := "near 1963-11-01 (TAI)"; + xlabel_step := 0.05 /. (scale *. 86400.0); + if kind = 3 then ( + if_TAI_time_format := true; + xtitle := "Seconds (TAI)"; + ) + else ( + if_TAI_time_format := false; + xtitle := "Seconds (TAI) labelled with corresponding UTC"; + ) + | 5 + | 6 -> + xmin := plctime 2009 0 1 0 0 (34.0 -. 5.0); + xmax := plctime 2009 0 1 0 0 (34.0 +. 5.0); + npts := 1001; + ymin := 32.5; + ymax := 34.5; + time_format := "%S%2%"; + title_suffix := "near 2009-01-01 (TAI)"; + xlabel_step := 1.0 /. (scale *. 86400.0); + if kind = 5 then ( + if_TAI_time_format := true; + xtitle := "Seconds (TAI)"; + ) + else ( + if_TAI_time_format := false; + xtitle := "Seconds (TAI) labelled with corresponding UTC"; + ) + | _ -> failwith "Bad plot kind" + in + + let x = Array.make 1001 0.0 in + let y = Array.make 1001 0.0 in + + for i = 0 to !npts - 1 do + x.(i) <- + !xmin +. float_of_int i *. (!xmax -. !xmin) /. (float_of_int (!npts - 1)); + plconfigtime scale offset1 offset2 0x0 false 0 0 0 0 0 0.0; + let tai = x.(i) in + (* The "full" calls to plbtime are commented out to avoid OCaml + compilation warnings. *) + (* + let tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec = + plbtime tai + in + *) + ignore (plbtime tai); + plconfigtime scale offset1 offset2 0x2 false 0 0 0 0 0 0.0; + let utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec = + plbtime tai + in + plconfigtime scale offset1 offset2 0x0 false 0 0 0 0 0 0.0; + let utc = plctime utc_year utc_month utc_day utc_hour utc_min utc_sec in + y.(i) <- (tai -. utc) *. scale *. 86400.0; + done; + + pladv 0; + plvsta (); + plwind !xmin !xmax !ymin !ymax; + plcol0 1; + plconfigtime scale offset1 offset2 + (if !if_TAI_time_format then 0x0 else 0x2) + false 0 0 0 0 0 0.0; + pltimefmt !time_format; + plbox "bcnstd" !xlabel_step 0 "bcnstv" 0.0 0; + plcol0 3; + let title = sprintf "#frPLplot Example 29 - TAI-UTC %s" !title_suffix in + pllab !xtitle "TAI-UTC (sec)" title; + + plcol0 4; + + plline (Array.sub x 0 !npts) (Array.sub y 0 !npts); + done; + () + (*--------------------------------------------------------------------------*\ * Draws several plots which demonstrate the use of date / time formats for * the axis labels. @@ -207,6 +350,8 @@ plot3 (); + plot4 (); + (* Don't forget to call plend() to finish off! *) plend(); () This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-08-18 21:50:31
|
Revision: 10289 http://plplot.svn.sourceforge.net/plplot/?rev=10289&view=rev Author: andrewross Date: 2009-08-18 21:50:23 +0000 (Tue, 18 Aug 2009) Log Message: ----------- Update tcl bindings to include plarc, plbtime, plctime and plconfigtime. Update example 3 consistent with C version. Modified Paths: -------------- trunk/bindings/tcl/plapi.tpl trunk/examples/tcl/x03.tcl Modified: trunk/bindings/tcl/plapi.tpl =================================================================== --- trunk/bindings/tcl/plapi.tpl 2009-08-18 18:48:18 UTC (rev 10288) +++ trunk/bindings/tcl/plapi.tpl 2009-08-18 21:50:23 UTC (rev 10289) @@ -36,6 +36,17 @@ pltclcmd pladv void page PLINT Def: 0 +# Plot an arc + +pltclcmd plarc void +x PLFLT +y PLFLT +a PLFLT +b PLFLT +angle1 PLFLT +angle2 PLFLT +fill PLINT + # This functions similarly to plbox() except that the origin of the axes # is placed at the user-specified point (x0, y0). @@ -87,6 +98,17 @@ ztick PLFLT nsubz PLINT +# Calculate broken-down time from continuous time for current stream. + +pltclcmd plbtime void +year PLINT& +month PLINT& +day PLINT& +hour PLINT& +min PLINT& +sec PLFLT& +ctime PLFLT + # Calculate world coordinates and subpage from relative device coordinates. pltclcmd plcalc_world void @@ -110,12 +132,39 @@ pltclcmd plcol1 void col1 PLFLT +# Configure transformation between continuous and broken-down time (and +# vice versa) for current stream. + +pltclcmd plconfigtime void +scale PLFLT +offset1 PLFLT +offset2 PLFLT +ccontrol PLINT +ifbtime_offset PLINT +year PLINT +month PLINT +day PLINT +hour PLINT +min PLINT +sec PLFLT + # Copies state parameters from the reference stream to the current stream. pltclcmd plcpstrm void iplsr PLINT flags PLINT +# Calculate continuous time from broken-down time for current stream. + +pltclcmd plctime void +year PLINT +month PLINT +day PLINT +hour PLINT +min PLINT +sec PLFLT +ctime PLFLT& + # Converts input values from relative device coordinates to relative plot # coordinates. Modified: trunk/examples/tcl/x03.tcl =================================================================== --- trunk/examples/tcl/x03.tcl 2009-08-18 18:48:18 UTC (rev 10288) +++ trunk/examples/tcl/x03.tcl 2009-08-18 21:50:23 UTC (rev 10289) @@ -21,13 +21,7 @@ matrix yj f $nj1 for {set i 1} {$i <= $ni} {incr i} { - for {set j 0} {$j < $nj1} {incr j} { - set r [expr $i * $dr] - set theta [expr $j * $dtheta] - xj $j = [expr $r * cos($theta)] - yj $j = [expr $r * sin($theta)] - } - $w cmd plline $nj1 xj yj + $w cmd plarc 0.0 0.0 [expr 0.1 * $i]] [expr 0.1 * $i] 0.0 360.0 0 } # Draw radial spokes for polar grid and write labels for angle This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-08-19 10:30:42
|
Revision: 10295 http://plplot.svn.sourceforge.net/plplot/?rev=10295&view=rev Author: jbauck Date: 2009-08-19 10:30:33 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Update Ada bindings and Examples 3 to use plarc. Modified Paths: -------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake trunk/examples/ada/x03a.adb.cmake trunk/examples/ada/xthick03a.adb.cmake Modified: trunk/bindings/ada/plplot.adb.cmake =================================================================== --- trunk/bindings/ada/plplot.adb.cmake 2009-08-19 08:16:21 UTC (rev 10294) +++ trunk/bindings/ada/plplot.adb.cmake 2009-08-19 10:30:33 UTC (rev 10295) @@ -1084,6 +1084,24 @@ end Advance_To_Subpage; + -- Plot an arc. + -- plarc + procedure Draw_Arc + (x, y, a, b, angle1, angle2 : Long_Float; + fill : Boolean) is + + fill_arc : PLBOOL; + + begin + if fill then + fill_arc := PLtrue; + else + fill_arc := PLfalse; + end if; + plarc(x, y, a, b, angle1, angle2, fill_arc); + end Draw_Arc; + + -- Draw a 2D vector plot. -- plvect procedure Vector_Plot Modified: trunk/bindings/ada/plplot.ads.cmake =================================================================== --- trunk/bindings/ada/plplot.ads.cmake 2009-08-19 08:16:21 UTC (rev 10294) +++ trunk/bindings/ada/plplot.ads.cmake 2009-08-19 10:30:33 UTC (rev 10295) @@ -628,6 +628,13 @@ procedure Advance_To_Subpage(Page : Natural); + -- Plot an arc. + -- plarc + procedure Draw_Arc + (x, y, a, b, angle1, angle2 : Long_Float; + fill : Boolean); + + -- Draw a 2D vector plot. -- plvect procedure Vector_Plot @@ -636,7 +643,8 @@ Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; Transformation_Data_Pointer : PLpointer); - -- Set the style for the arrow used by plvect to plot vectors. + + -- Set the style for the arrow used by plvect to plot vectors. -- plsvect procedure Set_Arrow_Style_For_Vector_Plots (X_Vertices, Y_Vertices : Real_Vector; Modified: trunk/bindings/ada/plplot_thin.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_thin.ads.cmake 2009-08-19 08:16:21 UTC (rev 10294) +++ trunk/bindings/ada/plplot_thin.ads.cmake 2009-08-19 10:30:33 UTC (rev 10295) @@ -461,6 +461,12 @@ pragma Import(C, pladv, "c_pladv"); + -- Plot an arc. + procedure + plarc(x : PLFLT; y : PLFLT; a : PLFLT; b : PLFLT; angle1 : PLFLT; angle2 : PLFLT; fill : PLBOOL); + pragma Import(C, plarc, "c_plarc"); + + -- simple arrow plotter. procedure Modified: trunk/bindings/ada/plplot_traditional.adb.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.adb.cmake 2009-08-19 08:16:21 UTC (rev 10294) +++ trunk/bindings/ada/plplot_traditional.adb.cmake 2009-08-19 10:30:33 UTC (rev 10295) @@ -1082,6 +1082,23 @@ end pladv; + -- Plot an arc. + procedure plarc + (x, y, a, b, angle1, angle2 : Long_Float; + fill : Boolean) is + + fill_arc : PLBOOL; + + begin + if fill then + fill_arc := PLtrue; + else + fill_arc := PLfalse; + end if; + PLplot_Thin.plarc(x, y, a, b, angle1, angle2, fill_arc); + end plarc; + + -- Draw a 2D vector plot. procedure plvect (u, v : Real_Matrix; Modified: trunk/bindings/ada/plplot_traditional.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.ads.cmake 2009-08-19 08:16:21 UTC (rev 10294) +++ trunk/bindings/ada/plplot_traditional.ads.cmake 2009-08-19 10:30:33 UTC (rev 10295) @@ -624,6 +624,12 @@ procedure pladv(Page : Natural); + -- Plot an arc. + procedure plarc + (x, y, a, b, angle1, angle2 : Long_Float; + fill : Boolean); + + -- Draw a 2D vector plot. procedure plvect (u, v : Real_Matrix; @@ -631,6 +637,7 @@ Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; Transformation_Data_Pointer : PLpointer); + -- Set the style for the arrow used by plvect to plot vectors. procedure plsvect (X_Vertices, Y_Vertices : Real_Vector; Modified: trunk/examples/ada/x03a.adb.cmake =================================================================== --- trunk/examples/ada/x03a.adb.cmake 2009-08-19 08:16:21 UTC (rev 10294) +++ trunk/examples/ada/x03a.adb.cmake 2009-08-19 10:30:33 UTC (rev 10295) @@ -62,14 +62,10 @@ -- Set up viewport and window, but do not draw box. plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); - for i in 1..10 loop - for j in x'range loop - x(j) := 0.1 * Long_Float(i) * x0(j); - y(j) := 0.1 * Long_Float(i) * y0(j); - end loop; -- Draw circles for polar grid. - plline(x, y); + for i in 1 .. 10 loop + plarc(0.0, 0.0, 0.1 * Long_Float(i), 0.1 * Long_Float(i), 0.0, 360.0, False); end loop; plcol0(2); Modified: trunk/examples/ada/xthick03a.adb.cmake =================================================================== --- trunk/examples/ada/xthick03a.adb.cmake 2009-08-19 08:16:21 UTC (rev 10294) +++ trunk/examples/ada/xthick03a.adb.cmake 2009-08-19 10:30:33 UTC (rev 10295) @@ -62,14 +62,10 @@ -- Set up viewport and window, but do not draw box. Set_Environment(-1.3, 1.3, -1.3, 1.3, Justified, No_Box); - for i in 1..10 loop - for j in x'range loop - x(j) := 0.1 * Long_Float(i) * x0(j); - y(j) := 0.1 * Long_Float(i) * y0(j); - end loop; - -- Draw circles for polar grid. - Draw_Curve(x, y); + -- Draw circles for polar grid. + for i in 1 .. 10 loop + Draw_Arc(0.0, 0.0, 0.1 * Long_Float(i), 0.1 * Long_Float(i), 0.0, 360.0, False); end loop; Set_Pen_Color(2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2009-08-19 17:36:09
|
Revision: 10298 http://plplot.svn.sourceforge.net/plplot/?rev=10298&view=rev Author: hezekiahcarty Date: 2009-08-19 17:35:55 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Allow compilation-time setting of the default color map(s) to use A user can now compile PLplot with a custom default color palette. Color maps are now always loaded from palette files, even for the default colors. Modified Paths: -------------- trunk/cmake/modules/plplot.cmake trunk/config.h.cmake trunk/src/plcore.c trunk/src/plctrl.c Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2009-08-19 12:04:06 UTC (rev 10297) +++ trunk/cmake/modules/plplot.cmake 2009-08-19 17:35:55 UTC (rev 10298) @@ -22,6 +22,15 @@ # libraries are all shared by default option(BUILD_SHARED_LIBS "Build shared libraries" ON) +# Color maps (discrete and continuous) to use by default +if(NOT DEFAULT_CMAP0_FILE) + set(DEFAULT_CMAP0_FILE "cmap0_default.pal") +endif(NOT DEFAULT_CMAP0_FILE) + +if(NOT DEFAULT_CMAP1_FILE) + set(DEFAULT_CMAP1_FILE "cmap1_default.pal") +endif(NOT DEFAULT_CMAP1_FILE) + # Need these modules to do subsequent checks. include(CheckIncludeFiles) include(CheckFunctionExists) Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2009-08-19 12:04:06 UTC (rev 10297) +++ trunk/config.h.cmake 2009-08-19 17:35:55 UTC (rev 10298) @@ -21,6 +21,12 @@ /* Location of dynamically loaded drivers */ #define DRV_DIR "${DRV_DIR}" +/* Name of the default cmap0 palette to use */ +#define PL_DEFAULT_CMAP0_FILE "${DEFAULT_CMAP0_FILE}" + +/* Name of the default cmap1 palette to use */ +#define PL_DEFAULT_CMAP1_FILE "${DEFAULT_CMAP1_FILE}" + /* Define if there is support for dynamically loaded drivers */ #cmakedefine ENABLE_DYNDRIVERS Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-08-19 12:04:06 UTC (rev 10297) +++ trunk/src/plcore.c 2009-08-19 17:35:55 UTC (rev 10298) @@ -2137,10 +2137,10 @@ plsc->initialized = 1; if (plsc->cmap0 == NULL) - plscmap0n(0); + plspal0(""); if (plsc->cmap1 == NULL) - plscmap1n(0); + plspal1(""); } plsc->psdoc = NULL; Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-08-19 12:04:06 UTC (rev 10297) +++ trunk/src/plctrl.c 2009-08-19 17:35:55 UTC (rev 10298) @@ -883,11 +883,6 @@ * plcmap0_def() * * Initializes specified color map 0 color entry to its default. - * - * Initial RGB values for color map 0 taken from X11R6 - * (XFree86-3.3.6) X-windows - * rgb.txt file, and may not accurately represent the described colors on - * all systems. \*--------------------------------------------------------------------------*/ #define color_def(i, r, g, b, a, n) \ @@ -898,44 +893,9 @@ { int i; - color_def(0, 0, 0, 0, 1.0, "black" ); /* black */ - color_def(1, 255, 0, 0, 1.0, "red"); /* red */ - color_def(2, 255, 255, 0, 1.0, "yellow" ); /* yellow */ - color_def(3, 0, 255, 0, 1.0, "green" ); /* green */ - color_def(4, 127, 255, 212, 1.0, "aquamarine" ); /* aquamarine */ - color_def(5, 255, 192, 203, 1.0, "pink" ); /* pink */ - color_def(6, 245, 222, 179, 1.0, "wheat" ); /* wheat */ - color_def(7, 190, 190, 190, 1.0, "grey" ); /* grey */ - color_def(8, 165, 42, 42, 1.0, "brown" ); /* brown */ - color_def(9, 0, 0, 255, 1.0, "blue" ); /* blue */ - color_def(10, 138, 43, 226, 1.0, "BlueViolet" ); /* Blue Violet */ - color_def(11, 0, 255, 255, 1.0, "cyan" ); /* cyan */ - color_def(12, 64, 224, 208, 1.0, "turquoise" ); /* turquoise */ - color_def(13, 255, 0, 255, 1.0, "magenta" ); /* magenta */ - color_def(14, 250, 128, 114, 1.0, "salmon" ); /* salmon */ - color_def(15, 255, 255, 255, 1.0, "white" ); /* white */ - -/* color_def(0, 255, 255, 255, "white" ); /\* white *\/ */ -/* color_def(1, 0, 0, 0, "black" ); /\* black *\/ */ -/* color_def(2, 0, 0, 255, "blue" ); /\* blue *\/ */ -/* color_def(3, 255, 0, 0, "red"); /\* red *\/ */ -/* color_def(4, 165, 42, 42, "brown" ); /\* brown *\/ */ -/* color_def(5, 250, 128, 114, "salmon" ); /\* salmon *\/ */ -/* color_def(6, 255, 192, 203, "pink" ); /\* pink *\/ */ -/* color_def(7, 127, 255, 212, "aquamarine" ); /\* aquamarine *\/ */ -/* color_def(8, 245, 222, 179, "wheat" ); /\* wheat *\/ */ -/* color_def(9, 64, 224, 208, "turquoise" ); /\* turquoise *\/ */ -/* color_def(10, 190, 190, 190, "grey" ); /\* grey *\/ */ -/* color_def(11, 0, 255, 255, "cyan" ); /\* cyan *\/ */ -/* color_def(12, 0, 255, 0, "green" ); /\* green *\/ */ -/* color_def(13, 255, 255, 0, "yellow" ); /\* yellow *\/ */ -/* color_def(14, 255, 0, 255, "magenta" ); /\* magenta *\/ */ -/* color_def(15, 138, 43, 226, "BlueViolet" ); /\* Blue Violet *\/ */ - -/* Any others are just arbitrarily set */ - - for (i = 16; i <= imax; i++) - color_def(i, 255, 0, 0, 1.0, "red"); /* red */ + /* Initialize all colors to black. */ + for (i = imin; i <= imax; i++) + color_def(i, 255, 0, 0, 1.0, "black"); } /*--------------------------------------------------------------------------*\ @@ -966,7 +926,7 @@ i[5] = 1; /* right boundary */ /* For center control points, pick black or white, whichever is closer to bg */ -/* Be carefult to pick just short of top or bottom else hue info is lost */ +/* Be careful to pick just short of top or bottom else hue info is lost */ if (plsc->cmap0 != NULL) vertex = ((PLFLT) plsc->cmap0[0].r + @@ -1227,9 +1187,9 @@ char msgbuf[1024]; if(strlen(filename) == 0) { - fp = plLibOpen("cmap0_default.pal"); + fp = plLibOpen(PL_DEFAULT_CMAP0_FILE); if (fp == NULL) { - snprintf(msgbuf,1024,"Unable to open cmap0 file %s\n","cmap0_default.pal"); + snprintf(msgbuf,1024,"Unable to open cmap0 file %s\n",PL_DEFAULT_CMAP0_FILE); plwarn(msgbuf); return; } @@ -1316,9 +1276,9 @@ err = 0; format_version = 0; if(strlen(filename) == 0) { - fp = plLibOpen("cmap1_default.pal"); + fp = plLibOpen(PL_DEFAULT_CMAP1_FILE); if (fp == NULL) { - snprintf(msgbuf,1024,"Unable to open cmap1 .pal file %s\n","cmap1_default.pal"); + snprintf(msgbuf,1024,"Unable to open cmap1 .pal file %s\n",PL_DEFAULT_CMAP1_FILE); plwarn(msgbuf); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-08-19 17:54:43
|
Revision: 10299 http://plplot.svn.sourceforge.net/plplot/?rev=10299&view=rev Author: smekal Date: 2009-08-19 17:54:27 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Added pl.ctime(), pl.btime() and pl.configtime() to Lua bindings. Updated Lua example 29. All Lua examples are now up to date again. Modified Paths: -------------- trunk/bindings/lua/plplotluac.i trunk/examples/lua/x29.lua Modified: trunk/bindings/lua/plplotluac.i =================================================================== --- trunk/bindings/lua/plplotluac.i 2009-08-19 17:35:55 UTC (rev 10298) +++ trunk/bindings/lua/plplotluac.i 2009-08-19 17:54:27 UTC (rev 10299) @@ -999,12 +999,15 @@ %rename(bop) plbop; %rename(box) plbox; %rename(box3) plbox3; +%rename(btime) plbtime; %rename(calc_world) plcalc_world; %rename(clear) plclear; %rename(col0) plcol0; %rename(col1) plcol1; +%rename(configtime) plconfigtime; %rename(cont) plcont; %rename(cpstrm) plcpstrm; +%rename(ctime) plctime; %rename(plend) plend; %rename(plend1) plend1; %rename(env) plenv; Modified: trunk/examples/lua/x29.lua =================================================================== --- trunk/examples/lua/x29.lua 2009-08-19 17:35:55 UTC (rev 10298) +++ trunk/examples/lua/x29.lua 2009-08-19 17:54:27 UTC (rev 10299) @@ -174,6 +174,123 @@ end +function plot4() + -- TAI-UTC (seconds) as a function of time. + -- Use Besselian epochs as the continuous time interval just to prove + -- this does not introduce any issues. + + x = {} + y = {} + + -- Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch + -- B = 1900. + (JD -2415020.31352)/365.242198781 + -- ==> (as calculated with aid of "bc -l" command) + -- B = (MJD + 678940.364163900)/365.242198781 + -- ==> + -- MJD = B*365.24219878 - 678940.364163900 + scale = 365.242198781 + offset1 = -678940 + offset2 = -0.3641639 + pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0.) + + for kind = 0, 6 do + if kind == 0 then + xmin = pl.ctime(1950, 0, 2, 0, 0, 0) + xmax = pl.ctime(2020, 0, 2, 0, 0, 0) + npts = 70*12 + 1 + ymin = 0 + ymax = 36 + time_format = "%Y%" + if_TAI_time_format = 1 + title_suffix = "from 1950 to 2020" + xtitle = "Year" + xlabel_step = 10 + end + if kind==1 or kind==2 then + xmin = pl.ctime(1961, 7, 1, 0, 0, 1.64757-0.20) + xmax = pl.ctime(1961, 7, 1, 0, 0, 1.64757+0.20) + npts = 1001 + ymin = 1.625 + ymax = 1.725 + time_format = "%S%2%" + title_suffix = "near 1961-08-01 (TAI)" + xlabel_step = 0.05/(scale*86400) + if kind==1 then + if_TAI_time_format = 1 + xtitle = "Seconds (TAI)" + else + if_TAI_time_format = 0 + xtitle = "Seconds (TAI) labelled with corresponding UTC" + end + end + if kind==3 or kind==4 then + xmin = pl.ctime(1963, 10, 1, 0, 0, 2.6972788-0.20) + xmax = pl.ctime(1963, 10, 1, 0, 0, 2.6972788+0.20) + npts = 1001 + ymin = 2.55 + ymax = 2.75 + time_format = "%S%2%" + title_suffix = "near 1963-11-01 (TAI)" + xlabel_step = 0.05/(scale*86400) + if kind==3 then + if_TAI_time_format = 1 + xtitle = "Seconds (TAI)" + else + if_TAI_time_format = 0 + xtitle = "Seconds (TAI) labelled with corresponding UTC" + end + end + if kind==5 or kind==6 then + xmin = pl.ctime(2009, 0, 1, 0, 0, 34-5) + xmax = pl.ctime(2009, 0, 1, 0, 0, 34+5) + npts = 1001 + ymin = 32.5 + ymax = 34.5 + time_format = "%S%2%" + title_suffix = "near 2009-01-01 (TAI)" + xlabel_step = 1/(scale*86400) + if kind==5 then + if_TAI_time_format = 1 + xtitle = "Seconds (TAI)" + else + if_TAI_time_format = 0 + xtitle = "Seconds (TAI) labelled with corresponding UTC" + end + end + + for i = 1, npts do + x[i] = xmin + (i-1)*(xmax-xmin)/(npts-1) + pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0) + tai = x[i] + tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec = pl.btime(tai) + pl.configtime(scale, offset1, offset2, 2, 0, 0, 0, 0, 0, 0, 0) + utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec = pl.btime(tai) + pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0.) + utc = pl.ctime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec) + y[i]=(tai-utc)*scale*86400. + end + + pl.adv(0) + pl.vsta() + pl.wind(xmin, xmax, ymin, ymax) + pl.col0(1) + if if_TAI_time_format ~= 0 then + pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0) + else + pl.configtime(scale, offset1, offset2, 2, 0, 0, 0, 0, 0, 0, 0) + end + pl.timefmt(time_format) + pl.box("bcnstd", xlabel_step, 0, "bcnstv", 0., 0) + pl.col0(3) + title = "@frPLplot Example 29 - TAI-UTC " .. title_suffix + pl.lab(xtitle, "TAI-UTC (sec)", title) + + pl.col0(4) + + pl.line(x, y) + end +end + ---------------------------------------------------------------------------- -- main -- @@ -204,5 +321,7 @@ plot3() +plot4() + -- Don't forget to call plend() to finish off! pl.plend() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2009-08-20 00:09:17
|
Revision: 10302 http://plplot.svn.sourceforge.net/plplot/?rev=10302&view=rev Author: hezekiahcarty Date: 2009-08-20 00:09:10 +0000 (Thu, 20 Aug 2009) Log Message: ----------- Add option to not interpolate cmap1 when loaded with plspal1 To get the same result as the initial implementation, use: plspal1(palette_file, true) For "segmented" cmap1: plspal1(palette_file, false) Modified Paths: -------------- trunk/examples/c/x16c.c trunk/include/plplot.h trunk/src/plargs.c trunk/src/plcore.c trunk/src/plctrl.c Modified: trunk/examples/c/x16c.c =================================================================== --- trunk/examples/c/x16c.c 2009-08-19 21:37:38 UTC (rev 10301) +++ trunk/examples/c/x16c.c 2009-08-20 00:09:10 UTC (rev 10302) @@ -126,7 +126,7 @@ /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_gray.pal"); + plspal1("cmap1_gray.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); /* Initialize plplot */ @@ -223,7 +223,7 @@ /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_blue_yellow.pal"); + plspal1("cmap1_blue_yellow.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -250,7 +250,7 @@ /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_blue_red.pal"); + plspal1("cmap1_blue_red.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -276,7 +276,7 @@ /* Load colour palettes*/ plspal0(""); - plspal1(""); + plspal1("", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -305,7 +305,7 @@ if(exclude) { /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_gray.pal"); + plspal1("cmap1_gray.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -330,7 +330,7 @@ /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_gray.pal"); + plspal1("cmap1_gray.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); Modified: trunk/include/plplot.h =================================================================== --- trunk/include/plplot.h 2009-08-19 21:37:38 UTC (rev 10301) +++ trunk/include/plplot.h 2009-08-20 00:09:10 UTC (rev 10302) @@ -1486,7 +1486,7 @@ /* Set the colors for color table 1 from a cmap1 file */ PLDLLIMPEXP void -c_plspal1(const char *filename); +c_plspal1(const char *filename, PLBOOL interpolate); /* Set the pause (on end-of-page) status */ Modified: trunk/src/plargs.c =================================================================== --- trunk/src/plargs.c 2009-08-19 21:37:38 UTC (rev 10301) +++ trunk/src/plargs.c 2009-08-20 00:09:10 UTC (rev 10302) @@ -2270,5 +2270,5 @@ static int opt_cmap1(const char *opt, const char *optarg, void *client_data) { - plspal1(optarg); + plspal1(optarg, TRUE); } Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-08-19 21:37:38 UTC (rev 10301) +++ trunk/src/plcore.c 2009-08-20 00:09:10 UTC (rev 10302) @@ -2140,7 +2140,7 @@ plspal0(""); if (plsc->cmap1 == NULL) - plspal1(""); + plspal1("", TRUE); } plsc->psdoc = NULL; Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-08-19 21:37:38 UTC (rev 10301) +++ trunk/src/plctrl.c 2009-08-20 00:09:10 UTC (rev 10302) @@ -1258,7 +1258,7 @@ \*--------------------------------------------------------------------------*/ void -c_plspal1(const char *filename) +c_plspal1(const char *filename, PLBOOL interpolate) { int i; int number_colors; @@ -1268,6 +1268,7 @@ int r_i, g_i, b_i, pos_i, rev_i; double r_d, g_d, b_d, a_d, pos_d; PLFLT *r, *g, *b, *a, *pos; + PLINT *ri, *gi, *bi; PLBOOL *rev; FILE *fp; char msgbuf[1024]; @@ -1316,6 +1317,9 @@ r = (PLFLT *)malloc(number_colors * sizeof(PLFLT)); g = (PLFLT *)malloc(number_colors * sizeof(PLFLT)); b = (PLFLT *)malloc(number_colors * sizeof(PLFLT)); + ri = (PLINT *)malloc(number_colors * sizeof(PLINT)); + gi = (PLINT *)malloc(number_colors * sizeof(PLINT)); + bi = (PLINT *)malloc(number_colors * sizeof(PLINT)); a = (PLFLT *)malloc(number_colors * sizeof(PLFLT)); pos = (PLFLT *)malloc(number_colors * sizeof(PLFLT)); rev = (PLBOOL *)malloc(number_colors * sizeof(PLBOOL)); @@ -1400,12 +1404,25 @@ pos[0] = 0.0; pos[number_colors-1] = 1.0; - c_plscmap1la(rgb, number_colors, pos, r, g, b, a, rev); + if (interpolate) { + c_plscmap1la(rgb, number_colors, pos, r, g, b, a, rev); + } + else { + for (i = 0; i < number_colors; i++) { + ri[i] = r[i] * 255.0; + gi[i] = g[i] * 255.0; + bi[i] = b[i] * 255.0; + } + c_plscmap1a(ri, gi, bi, a, number_colors); + } } free(r); free(g); free(b); + free(ri); + free(gi); + free(bi); free(a); free(pos); free(rev); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hez...@us...> - 2009-08-20 01:22:20
|
Revision: 10303 http://plplot.svn.sourceforge.net/plplot/?rev=10303&view=rev Author: hezekiahcarty Date: 2009-08-20 00:10:20 +0000 (Thu, 20 Aug 2009) Log Message: ----------- Update the OCaml bindings and example 16 for the plspal1 API change Modified Paths: -------------- trunk/bindings/ocaml/plplot_h trunk/bindings/ocaml/plplot_h.inc trunk/examples/ocaml/x16.ml Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2009-08-20 00:09:10 UTC (rev 10302) +++ trunk/bindings/ocaml/plplot_h 2009-08-20 00:10:20 UTC (rev 10303) @@ -481,7 +481,7 @@ c_plspal0(const char *filename); void -c_plspal1(const char *filename); +c_plspal1(const char *filename, PLBOOL interpolate); void c_plspause(PLBOOL pause); Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2009-08-20 00:09:10 UTC (rev 10302) +++ trunk/bindings/ocaml/plplot_h.inc 2009-08-20 00:10:20 UTC (rev 10303) @@ -111,7 +111,7 @@ [mlname(plsori)] void c_plsori ( int ori ); [mlname(plspage)] void c_plspage ( double xp, double yp, int xleng, int yleng, int xoff, int yoff ); [mlname(plspal0)] void c_plspal0 ( [string] const char * filename ); -[mlname(plspal1)] void c_plspal1 ( [string] const char * filename ); +[mlname(plspal1)] void c_plspal1 ( [string] const char * filename, boolean interpolate ); [mlname(plspause)] void c_plspause ( boolean pause ); [mlname(plsstrm)] void c_plsstrm ( int strm ); [mlname(plssub)] void c_plssub ( int nx, int ny ); Modified: trunk/examples/ocaml/x16.ml =================================================================== --- trunk/examples/ocaml/x16.ml 2009-08-20 00:09:10 UTC (rev 10302) +++ trunk/examples/ocaml/x16.ml 2009-08-20 00:10:20 UTC (rev 10303) @@ -60,7 +60,7 @@ (* Load color palettes *) plspal0 "cmap0_black_on_white.pal"; - plspal1 "cmap1_gray.pal"; + plspal1 "cmap1_gray.pal" true; (* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display *) plscmap0n 3; @@ -142,7 +142,7 @@ (* Load color palettes *) plspal0 "cmap0_black_on_white.pal"; - plspal1 "cmap1_blue_yellow.pal"; + plspal1 "cmap1_blue_yellow.pal" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; @@ -162,7 +162,7 @@ (* Load color palettes *) plspal0 "cmap0_black_on_white.pal"; - plspal1 "cmap1_blue_red.pal"; + plspal1 "cmap1_blue_red.pal" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; @@ -184,7 +184,7 @@ (* Load color palettes *) plspal0 ""; - plspal1 ""; + plspal1 "" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; @@ -223,7 +223,7 @@ (* Load colour palettes*) plspal0 "cmap0_black_on_white.pal"; - plspal1 "cmap1_gray.pal"; + plspal1 "cmap1_gray.pal" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-08-20 12:53:15
|
Revision: 10306 http://plplot.svn.sourceforge.net/plplot/?rev=10306&view=rev Author: andrewross Date: 2009-08-20 12:14:17 +0000 (Thu, 20 Aug 2009) Log Message: ----------- ANR for Alban Rochel - fixes for qt driver to support - command line arguments for the qtext driver - flushing (as used in example 17) Modified Paths: -------------- trunk/bindings/qt_gui/plqt.cpp trunk/drivers/qt.cpp trunk/examples/c++/qt_PlotWindow.cpp trunk/examples/c++/qt_PlotWindow.h trunk/examples/c++/qt_example.cpp trunk/include/qt.h Modified: trunk/bindings/qt_gui/plqt.cpp =================================================================== --- trunk/bindings/qt_gui/plqt.cpp 2009-08-20 12:01:56 UTC (rev 10305) +++ trunk/bindings/qt_gui/plqt.cpp 2009-08-20 12:14:17 UTC (rev 10306) @@ -35,6 +35,7 @@ // Global variables for Qt driver. PLDLLIMPEXP_QT_DATA(int) vectorize = 0; +PLDLLIMPEXP_QT_DATA(int) lines_aa = 1; PLDLLIMPEXP_QT_DATA(MasterHandler) handler; // Master Device Handler for multiple streams @@ -240,7 +241,7 @@ drawTextInPicture(&p, currentString); currentString.clear(); old_fontScale=currentFontScale; - if( yOffset>-0.000000000001 ) // I've already encountered precision issues here, so changed 0 into -epsilon + if( yOffset>0.000000000001 ) // I've already encountered precision issues here, so changed 0 into epsilon { currentFontScale *= 1.25; /* Subscript scaling parameter */ } @@ -416,7 +417,7 @@ QBrush b=m_painterP->brush(); b.setStyle(Qt::SolidPattern); m_painterP->setBrush(b); - m_painterP->setRenderHint(QPainter::Antialiasing, true); + m_painterP->setRenderHint(QPainter::Antialiasing, (bool)lines_aa); } QtRasterDevice::~QtRasterDevice() @@ -439,7 +440,7 @@ save(fileName, format, 85); m_painterP->begin(this); - m_painterP->setRenderHint(QPainter::Antialiasing, true); + m_painterP->setRenderHint(QPainter::Antialiasing, (bool)lines_aa); QBrush b=m_painterP->brush(); b.setStyle(Qt::SolidPattern); m_painterP->setBrush(b); @@ -566,6 +567,8 @@ pageNumber=0; resize(i_iWidth, i_iHeight); lastColour.r=-1; + setVisible(true); + QApplication::processEvents(); } QtPLWidget::~QtPLWidget() @@ -576,11 +579,16 @@ void QtPLWidget::clearWidget() { - clearBuffer(); + clear(); m_bAwaitingRedraw=true; update(); } +void QtPLWidget::flush() +{ + repaint(); +} + void QtPLWidget::clearBuffer() { lastColour.r=-1; @@ -745,6 +753,11 @@ el.Data.ColourStruct->G=g; el.Data.ColourStruct->B=b; el.Data.ColourStruct->A=alpha*255.; + + bgColour.r=r; + bgColour.g=g; + bgColour.b=b; + bgColour.alpha=alpha; m_listBuffer.append(el); } @@ -858,7 +871,7 @@ // Draw the margins and the background painter->fillRect(0, 0, width(), height(), QBrush(Qt::white)); painter->fillRect(0, 0, width(), height(), QBrush(Qt::gray, Qt::Dense4Pattern)); - + // Draw the plot doPlot(painter, x_fact, y_fact, x_offset, y_offset); painter->end(); @@ -892,7 +905,7 @@ p->setPen(SolidPen); bool hasPen=true; - p->setRenderHints(QPainter::Antialiasing, true); + p->setRenderHints(QPainter::Antialiasing, (bool)lines_aa); QBrush SolidBrush(Qt::SolidPattern); p->setBrush(SolidBrush); @@ -902,17 +915,28 @@ trans=trans.scale(x_fact, y_fact); p->setTransform(trans); - + if(m_listBuffer.empty()) { p->fillRect(0, 0, 1, 1, QBrush()); return; } + // unrolls the buffer and draws each element accordingly - for(QLinkedList<BufferElement>::const_iterator i=m_listBuffer.begin(); i!=m_listBuffer.end(); ++i) + for(QLinkedList<BufferElement>::const_iterator i=m_listBuffer.constBegin(); i!=m_listBuffer.constEnd(); ++i) { switch(i->Element) { + case SET_COLOUR: + SolidPen.setColor(QColor(i->Data.ColourStruct->R, i->Data.ColourStruct->G, i->Data.ColourStruct->B, i->Data.ColourStruct->A)); + if(hasPen) + { + p->setPen(SolidPen); + } + SolidBrush.setColor(QColor(i->Data.ColourStruct->R, i->Data.ColourStruct->G, i->Data.ColourStruct->B, i->Data.ColourStruct->A)); + p->setBrush(SolidBrush); + break; + case LINE: if(!hasPen) { @@ -939,7 +963,7 @@ hasPen=false; } p->drawRect(*(i->Data.Rect)); - p->setRenderHints(QPainter::Antialiasing, true); + p->setRenderHints(QPainter::Antialiasing, (bool)lines_aa); break; case POLYGON: @@ -950,7 +974,7 @@ hasPen=false; } p->drawConvexPolygon(*(i->Data.Polyline)); - p->setRenderHints(QPainter::Antialiasing, true); + p->setRenderHints(QPainter::Antialiasing, (bool)lines_aa); break; case TEXT: @@ -973,16 +997,6 @@ p->setPen(SolidPen); } break; - - case SET_COLOUR: - SolidPen.setColor(QColor(i->Data.ColourStruct->R, i->Data.ColourStruct->G, i->Data.ColourStruct->B, i->Data.ColourStruct->A)); - if(hasPen) - { - p->setPen(SolidPen); - } - SolidBrush.setColor(QColor(i->Data.ColourStruct->R, i->Data.ColourStruct->G, i->Data.ColourStruct->B, i->Data.ColourStruct->A)); - p->setBrush(SolidBrush); - break; case SET_BG_COLOUR: SolidBrush.setColor(QColor(i->Data.ColourStruct->R, i->Data.ColourStruct->G, i->Data.ColourStruct->B, i->Data.ColourStruct->A)); @@ -1014,6 +1028,13 @@ io_dYOffset=(h-io_dYFact*m_dHeight)/2.; } } + +void QtPLWidget::clear() +{ + clearBuffer(); + setBackgroundColor(bgColour.r, bgColour.g, bgColour.b, bgColour.alpha); +} + #endif #if defined(PLD_extqt) @@ -1141,6 +1162,12 @@ plsc->dev = (void*)widget; } +void plsetqtdev(QtExtWidget* widget, int argc, char** argv) +{ + plparseopts( &argc, (const char**)argv, PL_PARSE_FULL ); + plsc->dev = (void*)widget; +} + void plfreeqtdev() { delete ((QtExtWidget*)plsc->dev); Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2009-08-20 12:01:56 UTC (rev 10305) +++ trunk/drivers/qt.cpp 2009-08-20 12:14:17 UTC (rev 10306) @@ -35,6 +35,7 @@ #include <QMutexLocker> extern int vectorize; +extern int lines_aa; extern MasterHandler handler; // global variables initialised in init(), used in tidy() @@ -78,6 +79,7 @@ ; static DrvOpt qt_options[]={ {"text_vectorize", DRV_INT, &vectorize, "Vectorize fonts on output (0|1)"}, + {"lines_antialiasing", DRV_INT, &lines_aa, "Toggles antialiasing on lines (0|1)"}, {NULL, DRV_INT, NULL, NULL}}; bool initQtApp(bool isGUI) @@ -236,6 +238,7 @@ double dpi; vectorize=0; + lines_aa=1; plParseDrvOpts(qt_options); /* Stream setup */ @@ -587,6 +590,7 @@ void plD_init_svgqt(PLStream * pls) { vectorize=1; + lines_aa=1; plParseDrvOpts(qt_options); /* Stream setup */ @@ -810,6 +814,7 @@ void plD_init_epspdfqt(PLStream * pls) { vectorize=0; + lines_aa=1; plParseDrvOpts(qt_options); /* Stream setup */ @@ -1027,6 +1032,7 @@ void plD_init_qtwidget(PLStream * pls) { vectorize=0; + lines_aa=1; plParseDrvOpts(qt_options); PLINT w, h; @@ -1071,7 +1077,7 @@ pls->dev_flush=1; /* Driver does not have a clear capability so use (good) PLplot core * fallback for that instead. */ - pls->dev_clear=0; + pls->dev_clear=1; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode @@ -1119,24 +1125,32 @@ void plD_esc_qtwidget(PLStream * pls, PLINT op, void* ptr) { short *xa, *ya; + short xmin, xmax, ymin, ymax; PLINT i, j; QtPLWidget * widget=(QtPLWidget *) pls->dev; if(widget==NULL) return; switch(op) { + case PLESC_CLEAR: + widget->clear(); +// widget->clearBuffer(); +// widget->setBackgroundColor(pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a); + break; case PLESC_FILL: +// std::cout << "fill " <<pls->dev_npts<< std::endl; xa=new short[pls->dev_npts]; ya=new short[pls->dev_npts]; - + for (i = 0; i < pls->dev_npts; i++) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } + widget->setColor(pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a); widget->drawPolygon(xa, ya, pls->dev_npts); - + delete[] xa; delete[] ya; break; @@ -1147,6 +1161,13 @@ widget->setColor(pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a); widget->drawText(pls, (EscText *)ptr); break; + + case PLESC_FLUSH: +// std::cout << "flush" << std::endl; + widget->flush(); + break; + + default: break; } @@ -1213,8 +1234,8 @@ void plD_init_extqt(PLStream * pls) { vectorize=0; - plParseDrvOpts(qt_options); - + lines_aa=1; + if(pls->dev==NULL/* || pls->xlength <= 0 || pls->ylength <= 0*/) { printf("Error: use plsetqtdev to set up the Qt device before calling plinit()\n"); @@ -1234,7 +1255,7 @@ QPainter tempPainter(&temp); plP_setpxl(temp.logicalDpiX()/25.4/widget->downscale, temp.logicalDpiY()/25.4/widget->downscale); - + pls->color = 1; /* Is a color device */ pls->plbuf_write=0; pls->dev_fill0 = 1; /* Handle solid fills */ Modified: trunk/examples/c++/qt_PlotWindow.cpp =================================================================== --- trunk/examples/c++/qt_PlotWindow.cpp 2009-08-20 12:01:56 UTC (rev 10305) +++ trunk/examples/c++/qt_PlotWindow.cpp 2009-08-20 12:14:17 UTC (rev 10306) @@ -25,7 +25,7 @@ #include "qt_PlotWindow.h" -PlotWindow::PlotWindow(QWidget* parent): +PlotWindow::PlotWindow(int argc, char** argv, QWidget* parent): QMainWindow(parent) { setAttribute(Qt::WA_DeleteOnClose); @@ -41,7 +41,17 @@ // One window = One plot widget = one stream plmkstrm(&strm); plsdev ("extqt"); - plsetqtdev(plot); + + // Get all the application arguments as argc, argv + + if(argc==0 || argv==NULL) + { + plsetqtdev(plot); + } + else + { + plsetqtdev(plot, argc, argv); + } plinit(); resize(600, 600); @@ -79,7 +89,7 @@ } pladv(0); - plot->setBackgroundColor(50, 100, 200, 1.); + plot->clear(); plvpor(0.05, 0.95, 0.05, 0.45); plwind(0., 360., -1.2, 1.2); Modified: trunk/examples/c++/qt_PlotWindow.h =================================================================== --- trunk/examples/c++/qt_PlotWindow.h 2009-08-20 12:01:56 UTC (rev 10305) +++ trunk/examples/c++/qt_PlotWindow.h 2009-08-20 12:14:17 UTC (rev 10306) @@ -52,7 +52,7 @@ /// \param pageSize Print size /// \param orientation Print orientation /// \param parent Parent widget, if any. - PlotWindow(QWidget* parent=NULL); + PlotWindow(int argc=0, char** argv=NULL, QWidget* parent=NULL); ~PlotWindow(); Modified: trunk/examples/c++/qt_example.cpp =================================================================== --- trunk/examples/c++/qt_example.cpp 2009-08-20 12:01:56 UTC (rev 10305) +++ trunk/examples/c++/qt_example.cpp 2009-08-20 12:14:17 UTC (rev 10306) @@ -28,7 +28,7 @@ int main(int argc, char** argv) { QApplication a( argc, argv ); - PlotWindow* win=new PlotWindow; + PlotWindow* win=new PlotWindow(argc, argv); a.setActiveWindow( win ); win->setVisible(true); Modified: trunk/include/qt.h =================================================================== --- trunk/include/qt.h 2009-08-20 12:01:56 UTC (rev 10305) +++ trunk/include/qt.h 2009-08-20 12:14:17 UTC (rev 10306) @@ -303,6 +303,8 @@ void setBackgroundColor(int r, int g, int b, double alpha); void setWidth(PLINT r); void drawText(PLStream* pls, EscText* txt); + void flush(); + void clear(); protected: @@ -319,7 +321,7 @@ QLinkedList<BufferElement> m_listBuffer; // Buffer holding the draw instructions bool m_bAwaitingRedraw; int m_iOldSize; // Holds the size of the buffer. Modified => image has to be redrawn - + struct { int r; @@ -328,7 +330,14 @@ double alpha; } lastColour; - + struct + { + int r; + int g; + int b; + double alpha; + } bgColour; + protected slots: void mouseReleaseEvent ( QMouseEvent * event ); void keyPressEvent(QKeyEvent* event); @@ -370,6 +379,8 @@ PLDLLIMPEXP_QT void plsetqtdev(QtExtWidget* widget); // Registers the widget as plot device, as the widget has to be created in the Qt application GUI, prior to any plplot call. Must be called before plinit(). +PLDLLIMPEXP_QT void plsetqtdev(QtExtWidget* widget, int argc, char** argv); // Registers the widget as plot device, as the widget has to be created in the Qt application GUI, prior to any plplot call. Must be called before plinit(). + PLDLLIMPEXP_QT void plfreeqtdev(); // Deletes and unregisters the device. #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jb...@us...> - 2009-08-21 20:16:28
|
Revision: 10314 http://plplot.svn.sourceforge.net/plplot/?rev=10314&view=rev Author: jbauck Date: 2009-08-21 20:16:22 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Update Ada bindings and examples 16 for new color map API using plspal0 and plspal1. Modified Paths: -------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake trunk/examples/ada/x16a.adb.cmake trunk/examples/ada/xthick16a.adb.cmake Modified: trunk/bindings/ada/plplot.adb.cmake =================================================================== --- trunk/bindings/ada/plplot.adb.cmake 2009-08-21 14:14:02 UTC (rev 10313) +++ trunk/bindings/ada/plplot.adb.cmake 2009-08-21 20:16:22 UTC (rev 10314) @@ -2734,6 +2734,30 @@ end Set_Page_Parameters; + -- Set the colors for color table 0 from a cmap0 file. + -- plspal0 + procedure Set_Color_Map_0_From_File(Color_File_Name : String) is + begin + plspal0(To_C(Color_File_Name, True)); + end Set_Color_Map_0_From_File; + + + -- Set the colors for color table 1 from a cmap1 file. + -- plspal1 + procedure Set_Color_Map_1_From_File(Color_File_Name : String; Interpolate : Boolean) is + + PL_Interpolate : PLBOOL; + + begin + if Interpolate then + PL_Interpolate := PLtrue; + else + PL_Interpolate := PLfalse; + end if; + plspal1(To_C(Color_File_Name, True), PL_Interpolate); + end Set_Color_Map_1_From_File; + + -- Set the pause (on end-of-page) status -- plspause procedure Set_Pause(Pause : Boolean) is Modified: trunk/bindings/ada/plplot.ads.cmake =================================================================== --- trunk/bindings/ada/plplot.ads.cmake 2009-08-21 14:14:02 UTC (rev 10313) +++ trunk/bindings/ada/plplot.ads.cmake 2009-08-21 20:16:22 UTC (rev 10314) @@ -1628,6 +1628,16 @@ x_Offset, y_Offset : Integer); + -- Set the colors for color table 0 from a cmap0 file. + -- plspal0 + procedure Set_Color_Map_0_From_File(Color_File_Name : String); + + + -- Set the colors for color table 1 from a cmap1 file. + -- plspal1 + procedure Set_Color_Map_1_From_File(Color_File_Name : String; Interpolate : Boolean); + + -- Set the pause (on end-of-page) status -- plspause procedure Set_Pause(Pause : Boolean); Modified: trunk/bindings/ada/plplot_thin.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_thin.ads.cmake 2009-08-21 14:14:02 UTC (rev 10313) +++ trunk/bindings/ada/plplot_thin.ads.cmake 2009-08-21 20:16:22 UTC (rev 10314) @@ -1454,6 +1454,19 @@ pragma Import(C, plspage, "c_plspage"); + -- Set the colors for color table 0 from a cmap0 file. + + procedure + plspal0(filename : char_array); + pragma Import(C, plspal0, "c_plspal0"); + + + -- Set the colors for color table 1 from a cmap1 file. + procedure + plspal1(filename : char_array; interpolate : PLBOOL); + pragma Import(C, plspal1, "c_plspal1"); + + -- Set the pause (on end-of-page) status procedure Modified: trunk/bindings/ada/plplot_traditional.adb.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.adb.cmake 2009-08-21 14:14:02 UTC (rev 10313) +++ trunk/bindings/ada/plplot_traditional.adb.cmake 2009-08-21 20:16:22 UTC (rev 10314) @@ -2605,6 +2605,28 @@ end plspage; + -- Set the colors for color table 0 from a cmap0 file. + procedure plspal0(Color_File_Name : String) is + begin + PLplot_Thin.plspal0(To_C(Color_File_Name, True)); + end plspal0; + + + -- Set the colors for color table 1 from a cmap1 file. + procedure plspal1(Color_File_Name : String; Interpolate : Boolean) is + + PL_Interpolate : PLBOOL; + + begin + if Interpolate then + PL_Interpolate := PLtrue; + else + PL_Interpolate := PLfalse; + end if; + PLplot_Thin.plspal1(To_C(Color_File_Name, True), PL_Interpolate); + end plspal1; + + -- Set the pause (on end-of-page) status procedure plspause(Pause : Boolean) is Modified: trunk/bindings/ada/plplot_traditional.ads.cmake =================================================================== --- trunk/bindings/ada/plplot_traditional.ads.cmake 2009-08-21 14:14:02 UTC (rev 10313) +++ trunk/bindings/ada/plplot_traditional.ads.cmake 2009-08-21 20:16:22 UTC (rev 10314) @@ -1498,6 +1498,14 @@ x_Offset, y_Offset : Integer); + -- Set the colors for color table 0 from a cmap0 file. + procedure plspal0(Color_File_Name : String); + + + -- Set the colors for color table 1 from a cmap1 file. + procedure plspal1(Color_File_Name : String; Interpolate : Boolean); + + -- Set the pause (on end-of-page) status procedure plspause(Pause : Boolean); Modified: trunk/examples/ada/x16a.adb.cmake =================================================================== --- trunk/examples/ada/x16a.adb.cmake 2009-08-21 14:14:02 UTC (rev 10313) +++ trunk/examples/ada/x16a.adb.cmake 2009-08-21 20:16:22 UTC (rev 10314) @@ -104,9 +104,13 @@ -- Does several shade plots using different coordinate mappings. ---------------------------------------------------------------------------- - -- Parse and process command line arguments + -- Parse and process command line arguments. plparseopts(PL_PARSE_FULL); + -- Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_gray.pal", True); + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n(3); @@ -178,6 +182,14 @@ pllab("distance", "altitude", "Bogon density"); -- Plot using 1d coordinate transform + + -- Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_blue_yellow.pal", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + plscmap0n(3); + pladv(0); -- page 2 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); @@ -196,6 +208,14 @@ pllab("distance", "altitude", "Bogon density"); -- Plot using 2d coordinate transform + + -- Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_blue_red.pal", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + plscmap0n(3); + pladv(0); -- page 3 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); @@ -215,6 +235,14 @@ pllab("distance", "altitude", "Bogon density, with streamlines"); -- Plot using 2d coordinate transform + + -- Load colour palettes + plspal0(""); + plspal1("", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + plscmap0n(3); + pladv(0); -- page 4 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); @@ -241,6 +269,14 @@ -- the input parser which handling is not implemented in this Ada example. -- exclude := True; -- if exclude then +-- +-- -- Load colour palettes. +-- plspal0("cmap0_black_on_white.pal"); +-- plspal1("cmap1_gray.pal", 1); +-- +-- -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. +-- plscmap0n(3); +-- -- pladv(0); -- plvpor(0.1, 0.9, 0.1, 0.9); -- plwind(-1.0, 1.0, -1.0, 1.0); @@ -259,6 +295,14 @@ -- end if; -- Example with polar coordinates. + + -- Load colour palettes. + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_gray.pal", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + plscmap0n(3); + pladv(0); -- page 5 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); Modified: trunk/examples/ada/xthick16a.adb.cmake =================================================================== --- trunk/examples/ada/xthick16a.adb.cmake 2009-08-21 14:14:02 UTC (rev 10313) +++ trunk/examples/ada/xthick16a.adb.cmake 2009-08-21 20:16:22 UTC (rev 10314) @@ -107,6 +107,10 @@ -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); + -- Load colour palettes + Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); + Set_Color_Map_1_From_File("cmap1_gray.pal", True); + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display Set_Number_Of_Colors_Map_0(3); @@ -178,6 +182,14 @@ Write_Labels("distance", "altitude", "Bogon density"); -- Plot using 1d coordinate transform + + -- Load colour palettes + Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); + Set_Color_Map_1_From_File("cmap1_blue_yellow.pal", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + Set_Number_Of_Colors_Map_0(3); + Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); @@ -196,6 +208,14 @@ Write_Labels("distance", "altitude", "Bogon density"); -- Plot using 2d coordinate transform + + -- Load colour palettes + Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); + Set_Color_Map_1_From_File("cmap1_blue_red.pal", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + Set_Number_Of_Colors_Map_0(3); + Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); @@ -215,6 +235,14 @@ Write_Labels("distance", "altitude", "Bogon density, with streamlines"); -- Plot using 2d coordinate transform + + -- Load colour palettes + Set_Color_Map_0_From_File(""); + Set_Color_Map_1_From_File("", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + Set_Number_Of_Colors_Map_0(3); + Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); @@ -241,6 +269,14 @@ -- the input parser which handling is not implemented in this Ada example. -- exclude := True; -- if exclude then +-- +-- -- Load colour palettes. +-- Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); +-- Set_Color_Map_1_From_File("cmap1_gray.pal", True); +-- +-- -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. +-- Set_Number_Of_Colors_Map_0(3); +-- -- Advance_To_Subpage(Next_Subpage); -- Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); -- Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); @@ -259,6 +295,14 @@ -- end if; -- Example with polar coordinates. + + -- Load colour palettes. + Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); + Set_Color_Map_1_From_File("cmap1_gray.pal", True); + + -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. + Set_Number_Of_Colors_Map_0(3); + Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-08-24 13:55:09
|
Revision: 10319 http://plplot.svn.sourceforge.net/plplot/?rev=10319&view=rev Author: smekal Date: 2009-08-24 13:54:56 +0000 (Mon, 24 Aug 2009) Log Message: ----------- HPDF_SHARED should only be defined for the Win32 build (by defining HPDF_DLL) - fixed this in pdf.cmake. Workaround to define stricmp() and strnicmp() for non Windows builds. Should maybe only defined for gcc compilers (also on Windows), needs to be checked. Fixed some warnings about wrong signedness of parameter - this must also be investigated soon. Font is now scaled correctly for sub- and superscript. Modified Paths: -------------- trunk/cmake/modules/pdf.cmake trunk/drivers/pdf.c Modified: trunk/cmake/modules/pdf.cmake =================================================================== --- trunk/cmake/modules/pdf.cmake 2009-08-24 02:38:41 UTC (rev 10318) +++ trunk/cmake/modules/pdf.cmake 2009-08-24 13:54:56 UTC (rev 10319) @@ -33,14 +33,7 @@ message(STATUS "Looking for haru pdf header and library - found") if(WIN32) set(pdf_COMPILE_FLAGS "-I${hpdf_INCLUDE_DIRS} -DHPDF_DLL") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # -DHPDF_SHARED really screws up a Linux build of the pdf device driver. - # I noticed the Linux build of libharu had no HPDF_ macros defined so - # don't set any here, and that seems to work. - set(pdf_COMPILE_FLAGS "-I${hpdf_INCLUDE_DIRS}") else(WIN32) - # Guess no HPDF_ macros should be defined for platforms other than - # Windows or Linux. set(pdf_COMPILE_FLAGS "-I${hpdf_INCLUDE_DIRS}") endif(WIN32) set(pdf_LINK_FLAGS "${hpdf_LIBRARIES}") Modified: trunk/drivers/pdf.c =================================================================== --- trunk/drivers/pdf.c 2009-08-24 02:38:41 UTC (rev 10318) +++ trunk/drivers/pdf.c 2009-08-24 13:54:56 UTC (rev 10319) @@ -48,6 +48,12 @@ #include "plunicode-type1.h" #include "plfci-type1.h" +/* Workaround for caseless string comparison */ +#ifndef WIN32 + #define stricmp strcasecmp + #define strnicmp strncasecmp +#endif + /* constants */ /* We define a virtual page and scale it down to the @@ -498,12 +504,12 @@ /*********************************************************************** - * PSDrawTextToCanvas( pdfdev* dev, char* type1_string, short drawText ) + * PSDrawTextToCanvas( pdfdev* dev, unsigned char* type1_string, short drawText ) * * This function determines the extend of the string and does * the actual drawing to the page if drawText is true. ***********************************************************************/ -void PSDrawTextToCanvas( pdfdev* dev, char* type1_string, short drawText ) +void PSDrawTextToCanvas( pdfdev* dev, unsigned char* type1_string, short drawText ) { HPDF_REAL th; @@ -513,13 +519,13 @@ HPDF_Page_SetTextRenderingMode( dev->page, HPDF_FILL ); HPDF_Page_SetRGBFill( dev->page, dev->textRed, dev->textGreen, dev->textBlue ); HPDF_Page_MoveTextPos( dev->page, dev->textWidth, dev->yOffset ); - HPDF_Page_ShowText( dev->page, type1_string ); + HPDF_Page_ShowText( dev->page, (char*)type1_string ); // TODO: this conversion must be wrong HPDF_Page_EndText( dev->page ); } /* determine text width and height */ - dev->textWidth += HPDF_Page_TextWidth( dev->page, type1_string ); - th = (HPDF_REAL)(HPDF_Font_GetCapHeight( dev->m_font )*dev->fontSize/1000.0); + dev->textWidth += HPDF_Page_TextWidth( dev->page, (char*)type1_string ); // TODO: this conversion must be wrong + th = (HPDF_REAL)(HPDF_Font_GetCapHeight( dev->m_font )*dev->fontSize*dev->fontScale/1000.0); dev->textHeight = dev->textHeight>(th+dev->yOffset) ? dev->textHeight : (th+dev->yOffset); /* clear string */ @@ -541,7 +547,7 @@ if( !(dev->m_font = HPDF_GetFont(dev->pdf, font, NULL)) ) plexit( "ERROR: Couldn't open font\n" ); - HPDF_Page_SetFontAndSize( dev->page, dev->m_font, dev->fontSize ); + HPDF_Page_SetFontAndSize( dev->page, dev->m_font, dev->fontSize*dev->fontScale ); if( !strcmp(font, "Symbol") ) { dev->nlookup = number_of_entries_in_unicode_to_symbol_table; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-08-24 21:29:59
|
Revision: 10323 http://plplot.svn.sourceforge.net/plplot/?rev=10323&view=rev Author: smekal Date: 2009-08-24 21:29:37 +0000 (Mon, 24 Aug 2009) Log Message: ----------- Fixed plspal1() function in D Bindings. Update example 16 (which didn't work under certain circumstances). Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/x16d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-08-24 14:49:03 UTC (rev 10322) +++ trunk/bindings/d/plplot.d 2009-08-24 21:29:37 UTC (rev 10323) @@ -451,9 +451,9 @@ } /* Set the colors for color table 1 from a cmap1 file */ -void plspal1(string filename) +void plspal1(string filename, PLBOOL interpolate) { - c_plspal1(toStringz(filename)); + c_plspal1(toStringz(filename), interpolate); } /* Set color map 0 colors by 8 bit RGB values */ @@ -1903,7 +1903,7 @@ void c_plspal0(char* filename); /* Set the colors for color table 1 from a cmap1 file */ -void c_plspal1(char *filename); +void c_plspal1(char *filename, PLBOOL interpolate); /* Set the pause (on end-of-page) status */ void c_plspause(PLBOOL pause); Modified: trunk/examples/d/x16d.d =================================================================== --- trunk/examples/d/x16d.d 2009-08-24 14:49:03 UTC (rev 10322) +++ trunk/examples/d/x16d.d 2009-08-24 21:29:37 UTC (rev 10323) @@ -106,12 +106,9 @@ //plMergeOpts(options, "x16c options", notes); plparseopts(args, PL_PARSE_FULL); - /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ - plscmap0n(3); - /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_gray.pal"); + plspal1("cmap1_gray.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -205,7 +202,7 @@ /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_blue_yellow.pal"); + plspal1("cmap1_blue_yellow.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -228,7 +225,7 @@ /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_blue_red.pal"); + plspal1("cmap1_blue_red.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -253,7 +250,7 @@ /* Load colour palettes*/ plspal0(""); - plspal1(""); + plspal1("", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -279,7 +276,7 @@ if(exclude) { /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_gray.pal"); + plspal1("cmap1_gray.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); @@ -303,7 +300,7 @@ /* Load colour palettes*/ plspal0("cmap0_black_on_white.pal"); - plspal1("cmap1_gray.pal"); + plspal1("cmap1_gray.pal", 1); /* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display */ plscmap0n(3); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-08-25 09:24:53
|
Revision: 10324 http://plplot.svn.sourceforge.net/plplot/?rev=10324&view=rev Author: andrewross Date: 2009-08-25 09:24:43 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Temporary "fix" to increase precision of values returned to tcl by plplot. This prevents a crash on example 29, but still demonstrates rounding errors. Modified Paths: -------------- trunk/bindings/tcl/pltclgen.tcl trunk/examples/tcl/x29.tcl Modified: trunk/bindings/tcl/pltclgen.tcl =================================================================== --- trunk/bindings/tcl/pltclgen.tcl 2009-08-24 21:29:37 UTC (rev 10323) +++ trunk/bindings/tcl/pltclgen.tcl 2009-08-25 09:24:43 UTC (rev 10324) @@ -281,7 +281,7 @@ # precision standard (global var tcl_precision). "PLFLT&" { - puts $GENFILE " sprintf( buf, \"%f\", $argname($i) );" + puts $GENFILE " sprintf( buf, \"%.20g\", $argname($i) );" puts $GENFILE " if (argc > 1)" puts $GENFILE " Tcl_SetVar( interp, argv\[1+$i\], buf, 0 );" puts $GENFILE " else"; Modified: trunk/examples/tcl/x29.tcl =================================================================== --- trunk/examples/tcl/x29.tcl 2009-08-24 21:29:37 UTC (rev 10323) +++ trunk/examples/tcl/x29.tcl 2009-08-25 09:24:43 UTC (rev 10324) @@ -43,9 +43,7 @@ x29_plot3 $w - # Additional pages disabled for now - rounding errors - # are leading to a crash - # x29_plot4 $w + x29_plot4 $w } @@ -223,6 +221,8 @@ # ==> # MJD = B*365.24219878 - 678940.364163900 + set tcl_precision 17 + set scale 365.242198781 set offset1 -678940.0 set offset2 -0.3641639 @@ -230,7 +230,7 @@ matrix x f 1001 matrix y f 1001 - $w cmd plconfigtime $scale $offset1 $offset2 0x0 0 0 0 0 0 0 0. + $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. for {set kind 0} {$kind < 7} {incr kind} { if {$kind == 0} { @@ -297,11 +297,11 @@ for {set i 0} {$i<$npts} {incr i} { set tai [expr {$xmin + $i*($xmax-$xmin)/double($npts-1)}] x $i = $tai - $w cmd plconfigtime $scale $offset1 $offset2 0x0 0 0 0 0 0 0 0. + $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. $w cmd plbtime tai_year tai_month tai_day tai_hour tai_min tai_sec $tai - $w cmd plconfigtime $scale $offset1 $offset2 0x2 0 0 0 0 0 0 0. + $w cmd plconfigtime $scale $offset1 $offset2 2 0 0 0 0 0 0 0. $w cmd plbtime utc_year utc_month utc_day utc_hour utc_min utc_sec $tai - $w cmd plconfigtime $scale $offset1 $offset2 0x0 0 0 0 0 0 0 0. + $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. $w cmd plctime $utc_year $utc_month $utc_day $utc_hour $utc_min $utc_sec utc set yy [expr {($tai-$utc)*$scale*86400.}] y $i = $yy @@ -312,9 +312,9 @@ $w cmd plwind $xmin $xmax $ymin $ymax $w cmd plcol0 1 if {$if_TAI_time_format == 1} { - $w cmd plconfigtime $scale $offset1 $offset2 0x0 0 0 0 0 0 0 0. + $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. } else { - $w cmd plconfigtime $scale $offset1 $offset2 0x2 0 0 0 0 0 0 0. + $w cmd plconfigtime $scale $offset1 $offset2 2 0 0 0 0 0 0 0. } $w cmd pltimefmt $time_format $w cmd plbox "bcnstd" $xlabel_step 0 "bcnstv" 0. 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-08-25 10:06:08
|
Revision: 10325 http://plplot.svn.sourceforge.net/plplot/?rev=10325&view=rev Author: andrewross Date: 2009-08-25 10:06:00 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Minor changes for octave 3.2 which has stricter syntax checking. Thanks to Orion Poplawski for the patch. Modified Paths: -------------- trunk/bindings/octave/PLplot/closefig.m trunk/examples/octave/p4.m trunk/examples/octave/p5.m Modified: trunk/bindings/octave/PLplot/closefig.m =================================================================== --- trunk/bindings/octave/PLplot/closefig.m 2009-08-25 09:24:43 UTC (rev 10324) +++ trunk/bindings/octave/PLplot/closefig.m 2009-08-25 10:06:00 UTC (rev 10325) @@ -21,7 +21,7 @@ global __pl - if ( !(exist "__pl") || !struct_contains (__pl,"inited")) + if ( !(exist ("__pl")) || !struct_contains (__pl,"inited")) return; endif Modified: trunk/examples/octave/p4.m =================================================================== --- trunk/examples/octave/p4.m 2009-08-25 09:24:43 UTC (rev 10324) +++ trunk/examples/octave/p4.m 2009-08-25 10:06:00 UTC (rev 10325) @@ -21,7 +21,7 @@ x=0.01:0.1:10; y=exp(x); - og = grid "minor"; + og = grid ("minor"); title("Log-log example"); loglog(x,y,'y') grid (og); Modified: trunk/examples/octave/p5.m =================================================================== --- trunk/examples/octave/p5.m 2009-08-25 09:24:43 UTC (rev 10324) +++ trunk/examples/octave/p5.m 2009-08-25 10:06:00 UTC (rev 10325) @@ -21,7 +21,7 @@ x=-pi:0.01:pi; y=sin(x).+cos(3*x); - og = grid "on"; + og = grid ("on"); title("Polar example"); polar(x,y,'y') grid (og); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-08-26 00:43:07
|
Revision: 10342 http://plplot.svn.sourceforge.net/plplot/?rev=10342&view=rev Author: airwin Date: 2009-08-26 00:42:59 +0000 (Wed, 26 Aug 2009) Log Message: ----------- install(EXPORT export_plplot ... only needs to be executed once in whole build tree. Do that in src/CMakeLists.txt. Modified Paths: -------------- trunk/bindings/ada/CMakeLists.txt trunk/bindings/c++/CMakeLists.txt trunk/bindings/d/CMakeLists.txt trunk/bindings/f77/CMakeLists.txt trunk/bindings/f95/CMakeLists.txt trunk/bindings/gnome2/lib/CMakeLists.txt trunk/bindings/lua/CMakeLists.txt trunk/bindings/qt_gui/CMakeLists.txt trunk/bindings/tcl/CMakeLists.txt trunk/bindings/wxwidgets/CMakeLists.txt trunk/drivers/CMakeLists.txt trunk/src/CMakeLists.txt Modified: trunk/bindings/ada/CMakeLists.txt =================================================================== --- trunk/bindings/ada/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/ada/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -99,12 +99,7 @@ LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) - install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotada.cmake - ) - # Configure pkg-config *.pc file corresponding to libplplotada${LIB_TAG} if(PKG_CONFIG_EXECUTABLE) if(LIB_TAG) Modified: trunk/bindings/c++/CMakeLists.txt =================================================================== --- trunk/bindings/c++/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/c++/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -69,11 +69,6 @@ LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) - install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotcxx.cmake - ) - install(FILES ${plplotcxx${LIB_TAG}_INSTALLED_HEADERS} DESTINATION ${INCLUDE_DIR} Modified: trunk/bindings/d/CMakeLists.txt =================================================================== --- trunk/bindings/d/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/d/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -72,10 +72,6 @@ LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) - install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotd.cmake - ) # Configure pkg-config *.pc file corresponding to libplplotdmd${LIB_TAG} if(PKG_CONFIG_EXECUTABLE) Modified: trunk/bindings/f77/CMakeLists.txt =================================================================== --- trunk/bindings/f77/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/f77/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -190,11 +190,6 @@ ) endif(STATIC_OPTS) - install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotf77.cmake - ) - # Configure pkg-config *.pc file corresponding to libplplotf77${LIB_TAG} if(PKG_CONFIG_EXECUTABLE) if(LIB_TAG) Modified: trunk/bindings/f95/CMakeLists.txt =================================================================== --- trunk/bindings/f95/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/f95/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -185,11 +185,6 @@ ) endif(STATIC_OPTS) - install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotf95.cmake - ) - # For CMake-2.6.0 and above, the module files are created by # default during the library build in the bindings/f95 directory. install( Modified: trunk/bindings/gnome2/lib/CMakeLists.txt =================================================================== --- trunk/bindings/gnome2/lib/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/gnome2/lib/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -84,11 +84,6 @@ RUNTIME DESTINATION ${BIN_DIR} ) -install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotgnome2.cmake - ) - # Transform "${gcw_LINK_FLAGS}" to the # standard pkg-config form. pkg_config_link_flags( Modified: trunk/bindings/lua/CMakeLists.txt =================================================================== --- trunk/bindings/lua/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/lua/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -77,6 +77,4 @@ DESTINATION ${LUA_DIR} ) - install(EXPORT export_plplot DESTINATION ${DATA_DIR}/examples/cmake/modules) - endif(ENABLE_lua) Modified: trunk/bindings/qt_gui/CMakeLists.txt =================================================================== --- trunk/bindings/qt_gui/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/qt_gui/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -90,10 +90,6 @@ LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) - install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotqt.cmake - ) # Transform "${QT_LIBRARIES}" to the standard pkg-config form. pkg_config_link_flags( Modified: trunk/bindings/tcl/CMakeLists.txt =================================================================== --- trunk/bindings/tcl/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/tcl/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -237,11 +237,6 @@ RUNTIME DESTINATION ${BIN_DIR} ) -install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplottcltk.cmake - ) - set(plplottcltk${LIB_TAG}_INSTALLED_HEADERS pltcl.h ) Modified: trunk/bindings/wxwidgets/CMakeLists.txt =================================================================== --- trunk/bindings/wxwidgets/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/bindings/wxwidgets/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -89,11 +89,6 @@ RUNTIME DESTINATION ${BIN_DIR} ) - install(EXPORT export_plplot - DESTINATION ${DATA_DIR}/examples/cmake/modules - FILE export_plplotwxwidgets.cmake - ) - install(FILES ${plplotwxwidgets${LIB_TAG}_INSTALLED_HEADERS} DESTINATION ${INCLUDE_DIR} Modified: trunk/drivers/CMakeLists.txt =================================================================== --- trunk/drivers/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/drivers/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -196,8 +196,6 @@ EXPORT export_plplot DESTINATION ${DRV_DIR} ) - install(EXPORT export_plplot DESTINATION ${DATA_DIR}/examples/cmake/modules) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ROOT_NAME}.rc DESTINATION ${DRV_DIR} Modified: trunk/src/CMakeLists.txt =================================================================== --- trunk/src/CMakeLists.txt 2009-08-26 00:42:08 UTC (rev 10341) +++ trunk/src/CMakeLists.txt 2009-08-26 00:42:59 UTC (rev 10342) @@ -298,6 +298,10 @@ LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) + +# This exports information for every target in the whole build that +# has the EXPORT export_plplot signature (as above) for the +# install(TARGETS ... # command. install(EXPORT export_plplot DESTINATION ${DATA_DIR}/examples/cmake/modules) #message("libplplot${LIB_TAG}_LINK_FLAGS = ${libplplot${LIB_TAG}_LINK_FLAGS}") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-08-26 15:49:11
|
Revision: 10346 http://plplot.svn.sourceforge.net/plplot/?rev=10346&view=rev Author: airwin Date: 2009-08-26 15:48:56 +0000 (Wed, 26 Aug 2009) Log Message: ----------- AWI for Alban Rochel. Commit patch which does the following: + Better implementation of flushing, resulting in x17c -dev qtwidget running about as fast as x17c -dev xwin, a large improvement in qtwidget animation speed. + Fallback to well-implemented core version of PLESC_CLEAR since the qt version was not implemented correctly. + Improve qt_example to show how to deep-copy the command-line arguments passed to the software so that Qt does not filter out the "bg" commands. Modified Paths: -------------- trunk/bindings/qt_gui/plqt.cpp trunk/drivers/qt.cpp trunk/examples/c++/qt_PlotWindow.cpp trunk/examples/c++/qt_example.cpp trunk/include/qt.h Modified: trunk/bindings/qt_gui/plqt.cpp =================================================================== --- trunk/bindings/qt_gui/plqt.cpp 2009-08-26 15:22:14 UTC (rev 10345) +++ trunk/bindings/qt_gui/plqt.cpp 2009-08-26 15:48:56 UTC (rev 10346) @@ -563,12 +563,17 @@ m_dAspectRatio=m_dWidth/m_dHeight; m_pixPixmap=NULL; - m_iOldSize=0; +// m_iOldSize=0; pageNumber=0; resize(i_iWidth, i_iHeight); lastColour.r=-1; setVisible(true); QApplication::processEvents(); + redrawFromLastFlush=false; + redrawAll=true; + + NoPen=QPen(Qt::NoPen); + NoPen.setWidthF(0.); } QtPLWidget::~QtPLWidget() @@ -579,8 +584,10 @@ void QtPLWidget::clearWidget() { - clear(); - m_bAwaitingRedraw=true; + clearBuffer(); + setBackgroundColor(bgColour.r, bgColour.g, bgColour.b, bgColour.alpha); + redrawAll=true; +// m_bAwaitingRedraw=true; update(); } @@ -624,6 +631,8 @@ } m_listBuffer.clear(); + start_iterator=m_listBuffer.constBegin(); + redrawAll=true; } void QtPLWidget::drawLine(short x1, short y1, short x2, short y2) @@ -633,6 +642,7 @@ el.Data.Line=new QLineF(QPointF((PLFLT)x1*downscale, (PLFLT)(m_dHeight-y1*downscale)), QPointF((PLFLT)x2*downscale, (PLFLT)(m_dHeight-y2*downscale))); m_listBuffer.append(el); + redrawFromLastFlush=true; } void QtPLWidget::drawPolyline(short * x, short * y, PLINT npts) @@ -646,6 +656,7 @@ } m_listBuffer.append(el); + redrawFromLastFlush=true; } void QtPLWidget::drawPolygon(short * x, short * y, PLINT npts) @@ -721,6 +732,7 @@ } m_listBuffer.append(el); + redrawFromLastFlush=true; } void QtPLWidget::setColor(int r, int g, int b, double alpha) @@ -742,6 +754,8 @@ lastColour.b=b; lastColour.alpha=alpha; } + // No need to ask for a redraw at this point. The color only affects subsequent items +// redrawFromLastFlush=true; } void QtPLWidget::setBackgroundColor(int r, int g, int b, double alpha) @@ -758,8 +772,12 @@ bgColour.g=g; bgColour.b=b; bgColour.alpha=alpha; - + if(alpha>=0.999) + { + clearBuffer(); + } m_listBuffer.append(el); + redrawFromLastFlush=true; } void QtPLWidget::setWidth(PLINT w) @@ -768,6 +786,7 @@ el.Element=SET_WIDTH; el.Data.intParam=w; m_listBuffer.append(el); +// redrawFromLastFlush=true; } void QtPLWidget::drawText(PLStream* pls, EscText* txt) @@ -797,6 +816,7 @@ el.Data.TextStruct->chrht=pls->chrht; m_listBuffer.append(el); + redrawFromLastFlush=true; } void QtPLWidget::renderText(QPainter* p, struct TextStruct_* s, double x_fact, double x_offset, double y_fact, double y_offset) @@ -821,6 +841,14 @@ p->setClipping(false); } +void QtPLWidget::resetPensAndBrushes(QPainter* painter) +{ + SolidPen=QPen(); + hasPen=true; + painter->setPen(SolidPen); + SolidBrush=QBrush(Qt::SolidPattern); +} + void QtPLWidget::mouseReleaseEvent ( QMouseEvent * event ) { if(event->button()==Qt::RightButton) @@ -851,43 +879,65 @@ void QtPLWidget::resizeEvent( QResizeEvent * ) { - m_bAwaitingRedraw=true; +// m_bAwaitingRedraw=true; + redrawAll=true; delete m_pixPixmap; m_pixPixmap=NULL; } void QtPLWidget::paintEvent( QPaintEvent * ) { - double x_fact, y_fact, x_offset(0.), y_offset(0.); //Parameters to scale and center the plot on the widget + double x_fact, y_fact, x_offset(0.), y_offset(0.); //Parameters to scale and center the plot on the widget - getPlotParameters(x_fact, y_fact, x_offset, y_offset); - if(m_bAwaitingRedraw || m_pixPixmap==NULL || m_listBuffer.size()!=m_iOldSize) // If must regenerate image, draw it in the pixmap - { - delete m_pixPixmap; - m_pixPixmap=new QPixmap(width(), height()); - QPainter* painter=new QPainter; - painter->begin(m_pixPixmap); - - // Draw the margins and the background - painter->fillRect(0, 0, width(), height(), QBrush(Qt::white)); - painter->fillRect(0, 0, width(), height(), QBrush(Qt::gray, Qt::Dense4Pattern)); + getPlotParameters(x_fact, y_fact, x_offset, y_offset); - // Draw the plot - doPlot(painter, x_fact, y_fact, x_offset, y_offset); - painter->end(); - - m_bAwaitingRedraw=false; - m_iOldSize=m_listBuffer.size(); - - delete painter; - } - - // draw the current pixmap - m_painterP->begin(this); + if(redrawAll || m_pixPixmap==NULL) + { + if(m_pixPixmap!=NULL) + { + delete m_pixPixmap; + } + m_pixPixmap=new QPixmap(width(), height()); + QPainter* painter=new QPainter; + painter->begin(m_pixPixmap); - m_painterP->drawPixmap(0, 0, *m_pixPixmap); + // Draw the margins and the background + painter->fillRect(0, 0, width(), height(), QBrush(Qt::white)); + painter->fillRect(0, 0, width(), height(), QBrush(Qt::gray, Qt::Dense4Pattern)); - m_painterP->end(); + // Re-initialise pens etc. + resetPensAndBrushes(painter); + + start_iterator=m_listBuffer.constBegin(); + + // Draw the plot + doPlot(painter, x_fact, y_fact, x_offset, y_offset); + painter->end(); + +// m_iOldSize=m_listBuffer.size(); + + delete painter; + } + else + { + QPainter* painter=new QPainter; + painter->begin(m_pixPixmap); + if(hasPen) + painter->setPen(SolidPen); + else + painter->setPen(NoPen); + + // Draw the plot + doPlot(painter, x_fact, y_fact, x_offset, y_offset); + painter->end(); + } + + // draw the current pixmap + m_painterP->begin(this); + + m_painterP->drawPixmap(0, 0, *m_pixPixmap); + + m_painterP->end(); } void QtPLWidget::doPlot(QPainter* p, double x_fact, double y_fact, double x_offset, double y_offset) @@ -898,16 +948,16 @@ QVector<qreal> vect; QRectF rect; - QPen SolidPen; - - QPen NoPen(Qt::NoPen); - NoPen.setWidthF(0.); // Cosmetic pen - p->setPen(SolidPen); - bool hasPen=true; +// QPen SolidPen; +// +// QPen NoPen(Qt::NoPen); +// NoPen.setWidthF(0.); // Cosmetic pen +// p->setPen(SolidPen); +// bool hasPen=true; p->setRenderHints(QPainter::Antialiasing, (bool)lines_aa); - QBrush SolidBrush(Qt::SolidPattern); +// QBrush SolidBrush(Qt::SolidPattern); p->setBrush(SolidBrush); QTransform trans; @@ -923,7 +973,7 @@ } // unrolls the buffer and draws each element accordingly - for(QLinkedList<BufferElement>::const_iterator i=m_listBuffer.constBegin(); i!=m_listBuffer.constEnd(); ++i) + for(QLinkedList<BufferElement>::const_iterator i=start_iterator; i!=m_listBuffer.constEnd(); ++i) { switch(i->Element) { @@ -944,6 +994,7 @@ hasPen=true; } p->drawLine(*(i->Data.Line)); + break; case POLYLINE: @@ -1007,6 +1058,12 @@ break; } } + + start_iterator=m_listBuffer.constEnd(); + --start_iterator; + redrawFromLastFlush=false; + redrawAll=false; + } void QtPLWidget::getPlotParameters(double & io_dXFact, double & io_dYFact, double & io_dXOffset, double & io_dYOffset) @@ -1029,12 +1086,6 @@ } } -void QtPLWidget::clear() -{ - clearBuffer(); - setBackgroundColor(bgColour.r, bgColour.g, bgColour.b, bgColour.alpha); -} - #endif #if defined(PLD_extqt) Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2009-08-26 15:22:14 UTC (rev 10345) +++ trunk/drivers/qt.cpp 2009-08-26 15:48:56 UTC (rev 10346) @@ -1077,7 +1077,7 @@ pls->dev_flush=1; /* Driver does not have a clear capability so use (good) PLplot core * fallback for that instead. */ - pls->dev_clear=1; + pls->dev_clear=0; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode @@ -1132,38 +1132,29 @@ switch(op) { - case PLESC_CLEAR: - widget->clear(); -// widget->clearBuffer(); -// widget->setBackgroundColor(pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a); - break; case PLESC_FILL: -// std::cout << "fill " <<pls->dev_npts<< std::endl; - xa=new short[pls->dev_npts]; - ya=new short[pls->dev_npts]; + xa=new short[pls->dev_npts]; + ya=new short[pls->dev_npts]; - for (i = 0; i < pls->dev_npts; i++) - { - xa[i] = pls->dev_x[i]; - ya[i] = pls->dev_y[i]; - } + for (i = 0; i < pls->dev_npts; i++) + { + xa[i] = pls->dev_x[i]; + ya[i] = pls->dev_y[i]; + } - widget->setColor(pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a); - widget->drawPolygon(xa, ya, pls->dev_npts); + widget->setColor(pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a); + widget->drawPolygon(xa, ya, pls->dev_npts); - delete[] xa; - delete[] ya; + delete[] xa; + delete[] ya; break; case PLESC_HAS_TEXT: - /*$$ call the generic ProcessString function - ProcessString( pls, (EscText *)ptr ); */ - widget->setColor(pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a); - widget->drawText(pls, (EscText *)ptr); + widget->setColor(pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a); + widget->drawText(pls, (EscText *)ptr); break; case PLESC_FLUSH: -// std::cout << "flush" << std::endl; widget->flush(); break; Modified: trunk/examples/c++/qt_PlotWindow.cpp =================================================================== --- trunk/examples/c++/qt_PlotWindow.cpp 2009-08-26 15:22:14 UTC (rev 10345) +++ trunk/examples/c++/qt_PlotWindow.cpp 2009-08-26 15:48:56 UTC (rev 10346) @@ -89,7 +89,6 @@ } pladv(0); - plot->clear(); plvpor(0.05, 0.95, 0.05, 0.45); plwind(0., 360., -1.2, 1.2); Modified: trunk/examples/c++/qt_example.cpp =================================================================== --- trunk/examples/c++/qt_example.cpp 2009-08-26 15:22:14 UTC (rev 10345) +++ trunk/examples/c++/qt_example.cpp 2009-08-26 15:48:56 UTC (rev 10346) @@ -27,10 +27,32 @@ int main(int argc, char** argv) { + int res; + + // Deep copy of the arguments before QApplication alters them + int Argc=argc; + char** Argv; + + Argv=new char*[argc]; + for(int i=0; i<Argc; ++i) + { + int len=strlen(argv[i])+1; + Argv[i]=new char[len]; + strncpy(Argv[i], argv[i], len); + } + QApplication a( argc, argv ); - PlotWindow* win=new PlotWindow(argc, argv); + PlotWindow* win=new PlotWindow(Argc, Argv); a.setActiveWindow( win ); win->setVisible(true); - return a.exec(); + res=a.exec(); + + for(int i=0; i<Argc; ++i) + { + delete[] Argv[i]; + } + delete[] Argv; + + return res; } Modified: trunk/include/qt.h =================================================================== --- trunk/include/qt.h 2009-08-26 15:22:14 UTC (rev 10345) +++ trunk/include/qt.h 2009-08-26 15:48:56 UTC (rev 10346) @@ -304,7 +304,6 @@ void setWidth(PLINT r); void drawText(PLStream* pls, EscText* txt); void flush(); - void clear(); protected: @@ -314,13 +313,26 @@ void getPlotParameters(double & io_dXFact, double & io_dYFact, double & io_dXOffset, double & io_dYOffset); // gives the parameters to scale and center the plot on the page void doPlot(QPainter* p, double x_fact, double y_fact, double x_offset, double y_offset); // Actually draws the plot. Deported in a function for readability void renderText(QPainter* p, struct TextStruct_* s, double x_fact, double x_offset, double y_fact, double y_offset); - + + void resetPensAndBrushes(QPainter*); + double m_dAspectRatio; // Is kept constant during resizes QPixmap * m_pixPixmap; // stores the drawn image as long as it does not have to be regenerated QLinkedList<BufferElement> m_listBuffer; // Buffer holding the draw instructions - bool m_bAwaitingRedraw; - int m_iOldSize; // Holds the size of the buffer. Modified => image has to be redrawn +// bool m_bAwaitingRedraw; +// int m_iOldSize; // Holds the size of the buffer. Modified => image has to be redrawn + bool redrawFromLastFlush; + bool redrawAll; + + // Pens and brushes required to maintain the status between 2 flushes + QPen SolidPen; + QPen NoPen; + bool hasPen; + QBrush SolidBrush; + // end parameters + + QLinkedList<BufferElement>::const_iterator start_iterator; struct { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-08-27 16:39:03
|
Revision: 10352 http://plplot.svn.sourceforge.net/plplot/?rev=10352&view=rev Author: airwin Date: 2009-08-27 16:38:57 +0000 (Thu, 27 Aug 2009) Log Message: ----------- Remove unused variables as noted by gcc -Wall option. Thanks to Mark de Wever for this patch. Modified Paths: -------------- trunk/drivers/cairo.c trunk/examples/c/x03c.c trunk/examples/c/x32c.c trunk/examples/c++/x03.cc trunk/examples/c++/x16.cc trunk/src/plarc.c trunk/src/plargs.c trunk/src/plbuf.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/drivers/cairo.c 2009-08-27 16:38:57 UTC (rev 10352) @@ -598,13 +598,11 @@ void text_end_cairo(PLStream *pls, EscText *args) { int textXExtent, textYExtent; - char *textWithPangoMarkup; - PLFLT rotation, shear, stride, cos_rot, sin_rot, cos_shear, sin_shear, diorot_rad; + PLFLT rotation, shear, stride, cos_rot, sin_rot, cos_shear, sin_shear; cairo_matrix_t *cairoTransformMatrix; cairo_font_options_t *cairoFontOptions; PangoContext *context; PangoLayout *layout; - PangoFontDescription *fontDescription; PLCairo *aStream; aStream = (PLCairo *)pls->dev; @@ -686,7 +684,6 @@ void proc_str(PLStream *pls, EscText *args) { - int i; float fontSize; int textXExtent, textYExtent; char *textWithPangoMarkup; @@ -695,7 +692,6 @@ cairo_font_options_t *cairoFontOptions; PangoContext *context; PangoLayout *layout; - PangoFontDescription *fontDescription; PLCairo *aStream; aStream = (PLCairo *)pls->dev; @@ -897,7 +893,6 @@ void open_span_tag(char *pangoMarkupString, PLUNICODE fci, float fontSize, int upDown) { - int i; unsigned char fontFamily, fontStyle, fontWeight; char openTag[TAG_LEN]; @@ -1432,7 +1427,6 @@ void plD_init_xcairo(PLStream *pls) { char plotTitle[40]; - XGCValues values; PLCairo *aStream; /* Setup the PLStream and the font lookup table. */ Modified: trunk/examples/c/x03c.c =================================================================== --- trunk/examples/c/x03c.c 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/examples/c/x03c.c 2009-08-27 16:38:57 UTC (rev 10352) @@ -14,7 +14,7 @@ int main(int argc, const char *argv[]) { - int i, j; + int i; PLFLT dtr, theta, dx, dy, r, offset; char text[4]; static PLFLT x0[361], y0[361]; Modified: trunk/examples/c/x32c.c =================================================================== --- trunk/examples/c/x32c.c 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/examples/c/x32c.c 2009-08-27 16:38:57 UTC (rev 10352) @@ -61,12 +61,12 @@ /* outliers */ static PLFLT outx[] = { 3.5, 6.5 }; static PLFLT outy[] = { 0.89, 1.09 }; - +/* static PLFLT pos[] = {0.0, 0.25, 0.5, 0.75, 1.0}; static PLFLT red[] = {0.0, 0.25, 0.5, 1.0, 1.0}; static PLFLT green[] = {1.0, 0.5, 0.5, 0.5, 1.0}; static PLFLT blue[] = {1.0, 1.0, 0.5, 0.25, 0.0}; - +*/ /* Parse and process command line arguments */ (void) plparseopts(&argc, argv, PL_PARSE_FULL); Modified: trunk/examples/c++/x03.cc =================================================================== --- trunk/examples/c++/x03.cc 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/examples/c++/x03.cc 2009-08-27 16:38:57 UTC (rev 10352) @@ -47,7 +47,7 @@ x03::x03( int argc, const char ** argv ) { - int i, j; + int i; char text[4]; PLFLT dtr, theta, dx, dy, r, offset; Modified: trunk/examples/c++/x16.cc =================================================================== --- trunk/examples/c++/x16.cc 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/examples/c++/x16.cc 2009-08-27 16:38:57 UTC (rev 10352) @@ -48,10 +48,6 @@ static int ny; static int exclude; const static int PERIMETERPTS; - - // calculated constants and array that depends on them - PLFLT xspa; - PLFLT ypsa; public: static PLFLT tr[]; @@ -173,11 +169,6 @@ pls->Alloc2dGrid(&z,nx,ny); pls->Alloc2dGrid(&w,nx,ny); - // calculated constants and array that depends on them - PLFLT xspa = 2./(nx-1); - PLFLT yspa = 2./(ny-1); - - // Set up data array for (i = 0; i < nx; i++) { Modified: trunk/src/plarc.c =================================================================== --- trunk/src/plarc.c 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/src/plarc.c 2009-08-27 16:38:57 UTC (rev 10352) @@ -105,7 +105,6 @@ { PLINT xscl[2], yscl[2]; PLINT clpxmi, clpxma, clpymi, clpyma; - PLFLT orientation_offset, orientation; arc_struct *arc_info; /* TODO: For now, only unrotated plots use the driver-accelerated path. */ Modified: trunk/src/plargs.c =================================================================== --- trunk/src/plargs.c 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/src/plargs.c 2009-08-27 16:38:57 UTC (rev 10352) @@ -1606,7 +1606,7 @@ { const char *rgb; char *color_field, *alpha_field; - long bgcolor, r, g, b, length; + long bgcolor, r, g, b; PLFLT a; /* Strip off leading "#" (TK-ism) if present. */ Modified: trunk/src/plbuf.c =================================================================== --- trunk/src/plbuf.c 2009-08-27 03:41:19 UTC (rev 10351) +++ trunk/src/plbuf.c 2009-08-27 16:38:57 UTC (rev 10352) @@ -850,7 +850,6 @@ PLUNICODE(fci); EscText text; PLFLT xform[4]; - PLUNICODE* unicode; text.xform = xform; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2009-09-01 08:01:22
|
Revision: 10361 http://plplot.svn.sourceforge.net/plplot/?rev=10361&view=rev Author: smekal Date: 2009-09-01 08:01:12 +0000 (Tue, 01 Sep 2009) Log Message: ----------- These changes fix the grey plot/window-bug for the qt driver on Mac OS X (and Windows). Modified Paths: -------------- trunk/bindings/qt_gui/plqt.cpp trunk/drivers/qt.cpp Modified: trunk/bindings/qt_gui/plqt.cpp =================================================================== --- trunk/bindings/qt_gui/plqt.cpp 2009-09-01 06:47:01 UTC (rev 10360) +++ trunk/bindings/qt_gui/plqt.cpp 2009-09-01 08:01:12 UTC (rev 10361) @@ -594,6 +594,7 @@ void QtPLWidget::flush() { repaint(); + QApplication::processEvents(); } void QtPLWidget::clearBuffer() Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2009-09-01 06:47:01 UTC (rev 10360) +++ trunk/drivers/qt.cpp 2009-09-01 08:01:12 UTC (rev 10361) @@ -1092,6 +1092,7 @@ { QtPLWidget* widget=((QtPLWidget*)pls->dev); int currentPage=widget->pageNumber; + widget->flush(); while(currentPage==widget->pageNumber && handler.isMasterDevice(widget) && ! pls->nopause) { qApp->processEvents(QEventLoop::WaitForMoreEvents); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-09-04 23:31:00
|
Revision: 10369 http://plplot.svn.sourceforge.net/plplot/?rev=10369&view=rev Author: airwin Date: 2009-09-04 23:30:52 +0000 (Fri, 04 Sep 2009) Log Message: ----------- Partial fix (set LC_NUMERIC to "C" but no restoration of locale afterwards) for the palette file reading locale issues. Modified Paths: -------------- trunk/drivers/qt.cpp trunk/include/plplotP.h trunk/src/plcore.c trunk/src/plctrl.c Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2009-09-04 19:39:51 UTC (rev 10368) +++ trunk/drivers/qt.cpp 2009-09-04 23:30:52 UTC (rev 10369) @@ -96,7 +96,13 @@ snprintf(argv[0], 10, "qt_driver"); argv[1][0]='\0'; new QApplication(argc, argv, isGUI); - setlocale(LC_NUMERIC, "C"); + /* Restore default LC_NUMERIC locale since Qt4 fiddles with it + on some platforms. + if(!(setlocale(LC_NUMERIC, plplot_default_lc_numeric_locale))) { + char msgbuf[1024]; + snprintf(msgbuf,1024,"cmap0_palette_read: LC_NUMERIC could not be restored to the default \"%s\" locale.\n", plplot_default_lc_numeric_locale); + plexit(msgbuf); + }*/ res=true; } return res; Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2009-09-04 19:39:51 UTC (rev 10368) +++ trunk/include/plplotP.h 2009-09-04 23:30:52 UTC (rev 10369) @@ -120,6 +120,8 @@ #include <unistd.h> #endif +#include <locale.h> + /* (AM) Define M_PI if the platform does not include it (MSVC for instance) */ #if !defined(M_PI) @@ -424,7 +426,14 @@ /* Greek character translation array (defined in plcore.c) */ extern const char plP_greek_mnemonic[]; +/* plinit calls setlocale to establish this pointer to a character string + that stores the LC_NUMERIC locale set by any library or application before + it calls plinit. This character string is used to restore the LC_NUMERIC + locale to the original one after anything (such as colour palette file + reading) within PLplot that temporarily changes the locale. + extern PLDLLIMPEXP_DATA(char *) plplot_default_lc_numeric_locale; */ + /*--------------------------------------------------------------------------*\ * Function Prototypes * Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-09-04 19:39:51 UTC (rev 10368) +++ trunk/src/plcore.c 2009-09-04 23:30:52 UTC (rev 10369) @@ -128,6 +128,9 @@ */ const char plP_greek_mnemonic[] = "ABGDEZYHIKLMNCOPRSTUFXQWabgdezyhiklmncoprstufxqw"; +/* Must define this pointer once. Corresponding declaration is in plplotP.h + char * plplot_default_lc_numeric_locale; */ + void plP_init(void) { @@ -1801,7 +1804,15 @@ PLFLT def_arrow_y[6] = {0.0, 0.0, 0.2, 0.0, -0.2, 0.0}; PLFLT lx, ly, xpmm_loc, ypmm_loc, aspect_old, aspect_new; PLINT mk = 0, sp = 0, inc = 0, del = 2000; + /* Save current LC_NUMERIC locale string pointer in + plplot_default_lc_numeric_locale for purposes of restoring the + current LC_NUMERIC locale after the PLplot library temporarily + fiddles with it. + if(!(plplot_default_lc_numeric_locale = setlocale(LC_NUMERIC, NULL))) { + plexit("plinit: LC_NUMERIC has no default name of locale"); + } */ + pllib_init(); if (plsc->level != 0) Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-09-04 19:39:51 UTC (rev 10368) +++ trunk/src/plctrl.c 2009-09-04 23:30:52 UTC (rev 10369) @@ -1207,6 +1207,9 @@ char msgbuf[1024]; FILE *fp; + if(!(setlocale(LC_NUMERIC, "C"))) { + plexit("cmap0_palette_read: LC_NUMERIC locale could not be set for \"C\""); + } if(strlen(filename) == 0) { fp = plLibOpen(PL_DEFAULT_CMAP0_FILE); if (fp == NULL) { @@ -1303,6 +1306,12 @@ *(*a+i) = 1.0; } } + + /* Restore default LC_NUMERIC locale since we fiddled with it above. + if(!(setlocale(LC_NUMERIC, plplot_default_lc_numeric_locale))) { + snprintf(msgbuf,1024,"cmap0_palette_read: LC_NUMERIC could not be restored to the default \"%s\" locale.\n", *plplot_default_lc_numeric_locale); + plexit(msgbuf); + } */ } /*--------------------------------------------------------------------------*\ @@ -1373,6 +1382,9 @@ FILE *fp; char msgbuf[1024]; + if(!(setlocale(LC_NUMERIC, "C"))) { + plexit("plspal1: LC_NUMERIC locale could not be set for \"C\""); + } rgb = TRUE; err = 0; format_version = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-09-04 23:45:43
|
Revision: 10370 http://plplot.svn.sourceforge.net/plplot/?rev=10370&view=rev Author: airwin Date: 2009-09-04 23:45:36 +0000 (Fri, 04 Sep 2009) Log Message: ----------- For the release comment out all references to locale because this is too untested cross-platform. Modified Paths: -------------- trunk/include/plplotP.h trunk/src/plctrl.c Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2009-09-04 23:30:52 UTC (rev 10369) +++ trunk/include/plplotP.h 2009-09-04 23:45:36 UTC (rev 10370) @@ -120,7 +120,7 @@ #include <unistd.h> #endif -#include <locale.h> +/*#include <locale.h> */ /* (AM) Define M_PI if the platform does not include it (MSVC for instance) */ Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-09-04 23:30:52 UTC (rev 10369) +++ trunk/src/plctrl.c 2009-09-04 23:45:36 UTC (rev 10370) @@ -1207,9 +1207,9 @@ char msgbuf[1024]; FILE *fp; - if(!(setlocale(LC_NUMERIC, "C"))) { + /* if(!(setlocale(LC_NUMERIC, "C"))) { plexit("cmap0_palette_read: LC_NUMERIC locale could not be set for \"C\""); - } + } */ if(strlen(filename) == 0) { fp = plLibOpen(PL_DEFAULT_CMAP0_FILE); if (fp == NULL) { @@ -1382,9 +1382,9 @@ FILE *fp; char msgbuf[1024]; - if(!(setlocale(LC_NUMERIC, "C"))) { + /* if(!(setlocale(LC_NUMERIC, "C"))) { plexit("plspal1: LC_NUMERIC locale could not be set for \"C\""); - } + }*/ rgb = TRUE; err = 0; format_version = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hba...@us...> - 2009-09-06 20:26:07
|
Revision: 10375 http://plplot.svn.sourceforge.net/plplot/?rev=10375&view=rev Author: hbabcock Date: 2009-09-06 20:25:54 +0000 (Sun, 06 Sep 2009) Log Message: ----------- Updated for 5.10.0 release. Modified Paths: -------------- trunk/OLD-README.release trunk/README.release Modified: trunk/OLD-README.release =================================================================== --- trunk/OLD-README.release 2009-09-06 19:02:06 UTC (rev 10374) +++ trunk/OLD-README.release 2009-09-06 20:25:54 UTC (rev 10375) @@ -1,3 +1,703 @@ +PLplot Release 5.9.5 +~~~~~~~~~~~~~~~~~~~~ +This is a development release of PLplot. It represents the ongoing efforts +of the community to improve the PLplot plotting package. Development +releases in the 5.9.x series will be available every few months. The next +stable release will be 5.10.0. + + If you encounter a problem that is not already documented in the +PROBLEMS file, then please send bug reports to PLplot developers via the +mailing lists at http://sourceforge.net/mail/?group_id=2915 . + + Please see the license under which this software is distributed +(LGPL), and the disclaimer of all warranties, given in the COPYING.LIB +file. + + +Official Notices for Users. + +I. As of release 5.9.1 we have removed our previously deprecated +autotools-based build system. Instead, use the CMake-based build system +following the directions in the INSTALL file. + +II. As of release 5.9.1 we no longer support Octave-2.1.73 which has a +variety of run-time issues in our tests of the Octave examples on different +platforms. In contrast our tests show we get good run-time results with all +our Octave examples for Octave-3.0.1. Also, that is the recommended stable +version of Octave at http://www.gnu.org/software/octave/download.html so +that is the only version of Octave we support at this time. + +III. As of release 5.9.1 we have decided for consistency sake to change the +PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and +plsc->vpwyma and the results returned by plgvpw to reflect the exact window +limit values input by users using plwind. Previously to this change, the +stream variables and the values returned by plgvpw reflected the internal +slightly expanded range of window limits used by PLplot so that the user's +specified limits would be on the graph. Two users noted this slight +difference, and we agree with them it should not be there. Note that +internally, PLplot still uses the expanded ranges so most users results will +be identical. However, you may notice some small changes to your plot +results if you use these stream variables directly (only possible in C/C++) +or use plgvpw. + +IV. As of release 5.9.2 we have set HAVE_PTHREAD to ON by default for all +platforms other than Darwin. Darwin will follow later once it appears the +Apple version of X supports it. + +V. As of release 5.9.3 our build system requires CMake version 2.6.0 or +higher. + +VI. As of release 5.9.3 we have deprecated the gcw device driver and the +related gnome2 and pygcw bindings since these are essentially unmaintained. +For example, the gcw device and associated bindings still depends on the +plfreetype approach for accessing unicode fonts which has known issues +(inconsistent text offsets, inconvenient font setting capabilities, and +incorrect rendering of CTL languages). To avoid these issues we advise +using the xcairo device and the externally supplied XDrawable or Cairo +context associated with the xcairo device and the extcairo device (see +examples/c/README.cairo) instead. If you still absolutely must use -dev gcw +or the related gnome2 or pygcw bindings despite the known problems, then +they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or +ENABLE_pygcw to ON. + +VII. As of release 5.9.3 we have deprecated the gd device driver which +implements the png, jpeg, and gif devices. This device driver is +essentially unmaintained. For example, it still depends on the plfreetype +approach for accessing unicode fonts which has known issues (inconsistent +text offsets, inconvenient font setting capabilities, and incorrect +rendering of CTL languages). To avoid these issues for PNG format, we +advise using the pngcairo or pngqt devices. To avoid these issues for the +JPEG format, we advise using the jpgqt device. PNG is normally considered a +better raster format than GIF, but if you absolutely require GIF format, we +advise using the pngcairo or pngqt devices and then downgrading the results +to the GIF format using the ImageMagick "convert" application. For those +platforms where libgd (the dependency of the gd device driver) is accessible +while the required dependencies of the cairo and/or qt devices are not +accessible, you can still use these deprecated devices by setting PLD_png, +PLD_jpeg, or PLD_gif to ON. + +VIII. As of release 5.9.3 we have reenabled the tk, itk, and itcl components +of PLplot by default that were disabled by default as of release 5.9.1 due +to segfaults. The cause of the segfaults was a bug (now fixed) in how +pthread support was implemented for the Tk-related components of PLplot. + +IX. As of release 5.9.4 we have deprecated the pbm device driver (containing +the pbm device) because glibc detects a catastrophic double free. + +X. As of release 5.9.5 we have removed pyqt3 access to PLplot and +replaced it by pyqt4 access to PLplot (see details below). + +XI. As of release 5.9.5 the only method of specifying a non-default compiler +(and associated compiler options) that we support is the environment +variable approach, e.g., + +export CC='gcc -g -fvisibility=hidden' +export CXX='g++ -g -fvisibility=hidden' +export FC='gfortran -g -fvisibility=hidden' + +All other CMake methods of specifying a non-default compiler and associated +compiler options will not be supported until CMake bug 9220 is fixed, see +discussion below of the soft-landing reimplementation for details. + +XII. As of release 5.9.5 we have retired the hpgl driver (containing the +hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp +device), the ljii driver (containing the ljii and ljiip devices), and the +tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, +tek4010f, versaterm, vlt, and xterm devices). Retirement means we have +removed the build options which would allow these devices to build and +install. Recent tests have shown a number of run-time issues (hpgl, +impress, and ljii) or build-time issues (tek) with these devices, and as far +as we know there is no more user interest in them. Therefore, we have +decided to retire these devices rather than fix them. + +INDEX + +1. Changes relative to PLplot 5.9.4 (the previous development release) + +1.1 PyQt changes +1.2 Color Palettes +1.3 Reimplementation of a "soft landing" when a bad/missing compiler is +detected + +1.1 PyQt changes + +Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot +(some of the functions in plplot_widgetmodule.c in bindings/python) and a +proof-of-concept example (prova.py and qplplot.py in examples/python), but +this code did not gain any developer interest and was therefore not +understood or maintained. Recently one of our core developers has +implemented a sip-generated pyqt4 interface to PLplot (controlled by +plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a +python extension module, and a good-looking pyqt4 example (pyqt4_example.py +in examples/python) that works well. Since this pyqt4 approach is +maintained by a PLplot developer it appears to have a good future, and we +have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot +interface and example completely. + +1.2 Color Palettes + +Support has been added to PLplot for user defined color palette files. +These files can be loaded at the command line using the -cmap0 or +-cmap1 commands, or via the API using the plspal0 and plspal1 commands. +The commands cmap0 / plspal0 are used to load cmap0 type files which +specify the colors in PLplots color table 0. The commands cmap1 / +plspal1 are used to load cmap1 type files which specify PLplots color +table 1. Examples of both types of files can be found in either the +plplot-source/data directory or the PLplot installed directory +(typically /usr/local/share/plplotx.y.z/ on linux). + +1.3 Reimplementation of a "soft landing" when a bad/missing compiler is +detected. + +The PLplot core library is written in C so our CMake-based build system will +error out if it doesn't detect a working C compiler. However all other +compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are +optional. If a working compiler is not available, we give a "soft landing" +(give a warning message, disable the optional component, and keep going). +The old implementation of the soft landing was not applied consistently (C++ +was unnecessarily mandatory before) and also caused problems for ccmake (a +CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end +to the cmake application) which incorrectly dropped languages as a result +even when there was a working compiler. + +We now have completely reimplemented the soft landing logic. The result +works well for cmake, ccmake, and cmake-gui. The one limitation of this new +method that we are aware of is it only recognizes either the default +compiler chosen by the generator or else a compiler specified by the +environment variable approach (see Official Notice XII above). Once CMake +bug 9220 has been fixed (so that the OPTIONAL signature of the +enable_language command actually works without erroring out), then our +soft-landing approach (which is a workaround for bug 9220) will be replaced +by the OPTIONAL signature of enable_language, and all CMake methods of +specifying compilers and compiler options will automatically be recognized +as a result. + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed +2.2 Build system bug fixes +2.3 Build system improvements +2.4 Implement build-system infrastructure for installed Ada bindings and +examples +2.5 Code cleanup +2.6 Date / time labels for axes +2.7 Alpha value support +2.8 New PLplot functions +2.9 External libLASi library improvements affecting our psttf device +2.10 Improvements to the cairo driver family. +2.11 wxWidgets driver improvements +2.12 pdf driver improvements +2.13 svg driver improvements +2.14 Ada language support +2.15 OCaml language support +2.16 Perl/PDL language support +2.17 Update to various language bindings +2.18 Update to various examples +2.19 Extension of our test framework +2.20 Rename test subdirectory to plplot_test +2.21 Website support files updated +2.22 Internal changes to function visibility +2.23 Dynamic driver support in Windows +2.24 Documentation updates +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm +2.26 get-drv-info now changed to test-drv-info +2.27 Text clipping now enabled by default for the cairo devices +2.28 A powerful qt device driver has been implemented +2.29 The PLplot API is now accessible from Qt GUI applications +2.30 NaN / Inf support for some PLplot functions +2.31 Various bug fixes +2.32 Cairo driver improvements +2.33 PyQt changes +2.34 Color Palettes +2.35 Reimplementation of a "soft landing" when a bad/missing compiler is +detected. + + +2. Changes relative to PLplot 5.8.0 (the previous stable release) + +2.1 All autotools-related files have now been removed + +CMake (with the exception of a special build script for the DJGPP platform) +is now the only supported build system. It has been tested on Linux / Unix, +Mac OS-X and Windows platforms. + +2.2 Build system bug fixes + +Various fixes include the following: + +Ctest will now work correctly when the build tree path includes symlinks. + +Dependencies for swig generated files fixed so they are not rebuilt every +time make is called. + +Various dependency fixes to ensure that parallel builds (using make -j) +work under unix. + +2.3 Build system improvements + +We now transform link flag results delivered to the CMake environment by +pkg-config into the preferred CMake form of library information. The +practical effect of this improvement is that external libraries in +non-standard locations now have their rpath options set correctly for our +build system both for the build tree and the install tree so you don't have +to fiddle with LD_LIBRARY_PATH, etc. + +2.4 Implement build-system infrastructure for installed Ada bindings and +examples + +Install source files, library information files, and the plplotada library +associated with the Ada bindings. Configure and install the pkg-config file +for the plplotada library. Install the Ada examples and a configured Makefile +to build them in the install tree. + +2.5 Code cleanup + +The PLplot source code has been cleaned up to make consistent use of +(const char *) and (char *) throughout. Some API functions have changed +to use const char * instead of char * to make it clear that the strings +are not modified by the function. The C and C++ examples have been updated +consistent with this. These changes fix a large number of warnings +with gcc-4.2. Note: this should not require programs using PLplot to be +recompiled as it is not a binary API change. + +There has also been some cleanup of include files in the C++ examples +so the code will compile with the forthcoming gcc-4.3. + +2.6 Date / time labels for axes + +PLplot now allows date / time labels to be used on axes. A new option +('d') is available for the xopt and yopt arguments to plbox which +indicates that the axis should be interpreted as a date / time. Similarly +there is a new range of options for plenv to select date / time labels. +The time format is seconds since the epoch (usually 1 Jan 1970). This +format is commonly used on most systems. The C gmtime routine can be +used to calculate this for a given date and time. The format for the +labels is controlled using a new pltimefmt function, which takes a +format string. All formatting is done using the C strftime function. +See documentation for available options on your platform. Example 29 +demonstrates the new capabilities. + +N.B. Our reliance on C library POSIX time routines to (1) convert from +broken-down time to time-epoch, (2) to convert from time-epoch to +broken-down time, and (3) to format results with strftime have proved +problematic for non-C languages which have time routines of variable +quality. Also, it is not clear that even the POSIX time routines are +available on Windows. So we have plans afoot to implement high-quality +versions of (1), (2), and (3) with additional functions to get/set the epoch +in the PLplot core library itself. These routines should work on all C +platforms and should also be uniformly accessible for all our language +bindings. + +WARNING..... Therefore, assuming these plans are implemented, the present +part of our date/time PLplot API that uses POSIX time routines will be +changed. + +2.7 Alpha value support + +PLplot core has been modified to support a transparency or alpha value +channel for each color in color map 0 and 1. In addition a number of new +functions were added the PLplot API so that the user can both set and query +alpha values for color in the two color maps. These functions have the same +name as their non-alpha value equivalents, but with a an "a" added to the +end. Example 30 demonstrates some different ways to use these functions +and the effects of alpha values, at least for those drivers that support alpha +values. This change should have no effect on the device drivers that do not +currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and +aquaterm drivers support alpha values. There are some limitations with the gd +driver due to transparency support in the underlying libgd library. + +2.8 New PLplot functions + +An enhanced version of plimage, plimagefr has been added. This allows images +to be plotted using coordinate transformation, and also for the dynamic range +of the plotted values to be altered. Example 20 has been modified to +demonstrate this new functionality. + +To ensure consistent results in example 21 between different platforms and +language bindings PLplot now includes a small random number generator within +the library. plrandd will return a PLFLT random number in the range 0.0-1.0. +plseed will allow the random number generator to be seeded. + +2.9 External libLASi library improvements affecting our psttf device + +Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been +released at http://sourceforge.net/svn/?group_id=187113 . We recommend +using this latest version of libLASi for building PLplot and the psttf +device since this version of libLASi is more robust against glyph +information returned by pango/cairo/fontconfig that on rare occasions is not +suitable for use by libLASi. + +2.10 Improvements to the cairo driver family. + +Jonathan Woithe improved the xcairo driver so that it can optionally be +used with an external user supplied X Drawable. This enables a nice +separation of graphing (PLplot) and window management (Gtk, etc..). Doug +Hunt fixed the bugs that broke the memcairo driver and it is now fully +functional. Additionally, a new extcairo driver was added that will plot +into a user supplied cairo context. + +2.11 wxWidgets driver improvements + +Complete reorganization of the driver code. A new backend was added, based +on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 +and later. This backend produces antialized output similar to the +AGG backend but has no dependency on the AGG library. The basic wxDC +backend and the wxGraphicsContext backend process the text output +on their own, which results in much nicer plots than with the standard +Hershey fonts and is much faster than using the freetype library. New +options were introduced in the wxWidgets driver: + - backend: Choose backend: (0) standard, (1) using AGG library, + (2) using wxGraphicsContext + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - text: Use own text routines (text=0|1) + - freetype: Use FreeType library (freetype=0|1) +The option "text" changed its meaning, since it enabled the FreeType library +support, while now the option enables the driver's own text routines. + +Some other features were added: + * the wxWidgets driver now correctly clears the background (or parts of it) + * transparency support was added + * the "locate mode" (already availale in the xwin and tk driver) was + implemented, where graphics input events are processed and translated + to world coordinates + +2.12 pdf driver improvements + +The pdf driver (which is based on the haru library http://www.libharu.org) +processes the text output now on its own. So far only the Adobe Type1 +fonts are supported. TrueType font support will follow. Full unicode +support will follow after the haru library will support unicode strings. The +driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font +may be used only for symbols. Output can now be compressed, resulting in +much smaller file sizes. +Added new options: + - text: Use own text routines (text=0|1) + - compress: Compress pdf output (compress=0|1) + - hrshsym: Use Hershey symbol set (hrshsym=0|1) + - pagesize: Set page size (pagesize=A4|letter|A3|A5) + +2.13 svg driver improvements + +This device driver has had the following improvements: schema for generated +file now validates properly at http://validator.w3.org/ for the +automatically detected document type of SVG 1.1; -geometry option now works; +alpha channel transparency has been implemented; file familying for +multipage examples has been implemented; coordinate scaling has been +implemented so that full internal PLplot resolution is used; extraneous +whitespace and line endings that were being injected into text in error have +now been removed; and differential correction to string justification is now +applied. + +The result of these improvements is that our SVG device now gives the +best-looking results of all our devices. However, currently you must be +careful of which SVG viewer or editor you try because a number of them have +some bugs that need to be resolved. For example, there is a librsvg bug in +text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that +affects all svg use within GNOME as well as the ImageMagick "display" +application. However, at least the latest konqueror and firefox as well as +inkscape and scribus-ng (but not scribus!) give outstanding looking results +for files generated by our svg device driver. + +2.14 Ada language support + +We now have a complete Ada bindings implemented for PLplot. We also have a +complete set of our standard examples implemented in Ada which give results +that are identical with corresponding results for the C standard examples. +This is an excellent test of a large subset of the Ada bindings. We now +enable Ada by default for our users and request widespread testing of this +new feature. + +2.15 OCaml language support + +Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml +bindings implemented for PLplot. We also have a complete set of our standard +examples implemented in OCaml which give results that are identical with +corresponding results for the C standard examples. This is an excellent test +of a large subset of the OCaml bindings. We now enable OCaml by default for +our users and request widespread testing of this new feature. + +2.16 Perl/PDL language support + +Thanks to Doug Hunt's efforts the external Perl/PDL module, +PDL::Graphics::PLplot version 0.46 available at +http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date +to give access to recently added PLplot API. The instructions for how to +install this module on top of an offical PDL release are given in +examples/perl/README.perldemos. Doug has also finished implementing a +complete set of standard examples in Perl/PDL which are part of PLplot and +which produce identical results to their C counterparts if the above updated +module has been installed. Our build system tests the version of +PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the +list of Perl/PDL examples that are run as part of our standard tests is +substantially reduced to avoid examples that use the new functionality. In +sum, if you use PDL::Graphics::PLplot version 0.46 or later the full +complement of PLplot commands is available to you from Perl/PDL, but +otherwise not. + +2.17 Updates to various language bindings + +A concerted effort has been made to bring all the language bindings up to +date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, +Perl/PDL, Python, and Tcl now all support the common PLplot API (with the +exception of the mapping functions which are not yet implemented for all +bindings due to technical issues.) This is a significant step forward for +those using languages other than C. + +2.18 Updates to various examples + +To help test the updates to the language bindings the examples have been +thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set +of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, +Python and Tcl are missing example 19 because of the issue with the mapping +functions. The examples have also been checked to ensure consistent results +between different language bindings. Currently there are still some minor +differences in the results for the tcl examples, probably due to rounding +errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for +proper support for NaNs. + +Also new is an option for the plplot_test.sh script to run the examples +using a debugging command. This is enabled using the --debug option. The +default it to use the valgrind memory checker. This has highlighted at +least one memory leaks in plplot which have been fixed. It is not part +of the standard ctest tests because it can be _very_ slow for a complete +set of language bindings and device drivers. + +2.19 Extension of our test framework + +The standard test suite for PLplot now carries out a comparison of the +stdout output (especially important for example 31 which tests most of our +set and get functions) and PostScript output for different languages as a +check. Thanks to the addition of example 31, the inclusion of examples 14 +and 17 in the test suite and other recent extensions of the other +examples we now have rigourous testing in place for almost the entirety +of our common API. This extensive testing framework has already helped +us track down a number of bugs, and it should make it much easier for us +to maintain high quality for our ongoing PLplot releases. + +2.20 Rename test subdirectory to plplot_test + +This change was necessary to quit clashing with the "make test" target which +now works for the first time ever (by executing ctest). + +2.21 Website support files updated + +Our new website content is generated with PHP and uses CSS (cascaded style +sheets) to implement a consistent style. This new approach demanded lots of +changes in the website support files that are used to generate and upload +our website and which are automatically included with the release. + +2.22 Internal changes to function visibility + +The internal definitions of functions in plplot have been significantly +tidied up to allow the use of the -fvisibility=hidden option with newer +versions of gcc. This prevents internal functions from being exported +to the user where possible. This extends the existing support for this +on windows. + +2.23 Dynamic driver support in Windows + +An interface based on the ltdl library function calls was established +which allows to open and close dynamic link libraries (DLL) during +run-time and call functions from these libraries. As a consequence +drivers can now be compiled into single DLLs separate from the core +plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now +ON by default for Windows if a shared plplot library is built. + +2.24 Documentation updates + +The docbook documentation has been updated to include many of the +C-specific functions (for example plAlloc2dGrid) which are not part +of the common API, but are used in the examples and may be helpful +for plplot users. + +2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm + +CGM format is a long-established (since 1987) open standard for vector +graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). +PLplot has long had a cgm device driver which depended on the (mostly) +public domain libcd library that was distributed in the mid 90's by National +Institute of Standards and Technology (NIST) and which is still available +from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience +to our -dev cgm users, we have brought that +source code in house under lib/nistcd and now build libnistcd routinely +as part of our ordinary builds. The only changes we have made to the +cd1.3 source code is visibility changes in cd.h and swapping the sense of +the return codes for the test executables so that 0 is returned on success +and 1 on failure. If you want to test libnistcd on your platform, +please run + +make test_nistcd + +in the top-level build tree. (That tests runs all the test executables +that are built as part of cd1.3 and compares the results that are generated +with the *.cgm files that are supplied as part of cd1.3.) + +Two applications that convert and/or display CGM results on Linux are +ralcgm (which is called by the ImageMagick convert and display applications) +and uniconvertor. + +Some additional work on -dev cgm is required to implement antialiasing and +non-Hershey fonts, but both those should be possible using libnistcd according +to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. + +2.26 get-drv-info now changed to test-drv-info + +To make cross-building much easier for PLplot we now configure the *.rc +files that are used to describe our various dynamic devices rather than +generating the required *.rc files with get-drv-info. We have changed the +name of get-drv-info to test-drv-info. That name is more appropriate +because that executable has always tested dynamic loading of the driver +plug-ins as well as generating the *.rc files from the information gleaned +from that dynamic loading. Now, we simply run test-drv-info as an option +(defaults to ON unless cross-building is enabled) and compare the resulting +*.rc file with the one configured by cmake to be sure the dynamic device +has been built correctly. + +2.27 Text clipping now enabled by default for the cairo devices + +When correct text clipping was first implemented for cairo devices, it was +discovered that the libcairo library of that era (2007-08) did that clipping +quite inefficiently so text clipping was disabled by default. Recent tests +of text clipping for the cairo devices using libcairo 1.6.4 (released in +2008-04) shows text clipping is quite efficient now. Therefore, it is now +enabled by default. If you notice a significant slowdown for some libcairo +version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for +your cairo device plots (and accept the improperly clipped text results that +might occur with that option). Better yet, use libcairo 1.6.4 or later. + +2.28 A powerful qt device driver has been implemented + +Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt +device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, +jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an +elementary interactive device where, for now, the possible interactions +consist of resizing the window and right clicking with the mouse (or hitting +<return> to be consistent with other PLplot interactive devices) to control +paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, +pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified +in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable +pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, +svgqt are file devices whose overall sizes are specified in points (1/72 of +an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG +formatted files. The qt device driver is based on the powerful facilities +of Qt4 so all qt devices implement variable opacity (alpha channel) effects +(see example 30). The qt devices also use system unicode fonts, and deal +with CTL (complex text layout) languages automatically without any +intervention required by the user. (To show this, try qt device results +from examples 23 [mathematical symbols] and 24 [CTL languages].) + +Our exhaustive Linux testing of the qt devices (which consisted of detailed +comparisons for all our standard examples between qt device results and the +corresponding cairo device results) indicates this device driver is mature, +but testing on other platforms is requested to confirm that maturity. Qt-4.5 +(the version we used for most of our tests) has some essential SVG +functionality so we recommend that version (downloadable from +http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for +svgqt. One of our developers found that pdfqt was orders of magnitude +slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a +64 bit box. That problem was completely cured by moving to the downloadable +Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on +other platforms. One of our developers also found that all first pages of +examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. +From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we +assume this black first page for qtwidget problem also exists for Qt-4.4.3, +but we haven't tested that combination. + +In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, +but if you run into any difficulty with it please switch to Qt-4.5.x (once +Qt-4.5.x is installed all you have to do is to put the 4.5.x version of +qmake in your path, and cmake does the rest). If the problem persists for +Qt-4.5, then it is worth reporting a qt bug. + +2.29 The PLplot API is now accessible from Qt GUI applications + +This important new feature has been implemented by Alban Rochel of the QSAS +team as a spin-off of the qt device driver project using the extqt device +(which constitutes the tenth qt device). See examples/c++/README.qt_example +for a brief description of a simple Qt example which accesses the PLplot API +and which is built in the installed examples tree using the pkg-config +approach. Our build system has been enhanced to configure the necessary +plplotd-qt.pc file. + +2.30 NaN / Inf support for some PLplot functions + +Some PLplot now correctly handle Nan or Inf values in the data to be plotted. +Line plotting (plline etc) and image plotting (plimage, plimagefr) will +now ignore NaN / Inf values. Currently some of the contour plotting / 3-d +routines do not handle NaN / Inf values. This functionality will +depend on whether the language binding used supports NaN / Inf values. + +2.31 Various bug fixes + +Various bugs in the 5.9.3 release have been fixed including: + +- Include missing file needed for the aqt driver on Mac OS X +- Missing library version number for nistcd +- Fixes for the qt examples with dynamic drivers disabled +- Fixes to several tcl examples so they work with plserver +- Fix pkg-config files to work correctly with Debug / Release build types set +- Make fortran command line argument parsing work with shared libraries on Windows + +2.32 Cairo driver improvements + +Improvements to the cairo driver to give better results for bitmap +formats when used with anti-aliasing file viewers. + +2.33 PyQt changes + +Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot +(some of the functions in plplot_widgetmodule.c in bindings/python) and a +proof-of-concept example (prova.py and qplplot.py in examples/python), but +this code did not gain any developer interest and was therefore not +understood or maintained. Recently one of our core developers has +implemented a sip-generated pyqt4 interface to PLplot (controlled by +plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a +python extension module, and a good-looking pyqt4 example (pyqt4_example.py +in examples/python) that works well. Since this pyqt4 approach is +maintained by a PLplot developer it appears to have a good future, and we +have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot +interface and example completely. + +2.34 Color Palettes + +Support has been added to PLplot for user defined color palette files. +These files can be loaded at the command line using the -cmap0 or +-cmap1 commands, or via the API using the plspal0 and plspal1 commands. +The commands cmap0 / plspal0 are used to load cmap0 type files which +specify the colors in PLplots color table 0. The commands cmap1 / +plspal1 are used to load cmap1 type files which specify PLplots color +table 1. Examples of both types of files can be found in either the +plplot-source/data directory or the PLplot installed directory +(typically /usr/local/share/plplotx.y.z/ on linux). + +2.35 Reimplementation of a "soft landing" when a bad/missing compiler is +detected. + +The PLplot core library is written in C so our CMake-based build system will +error out if it doesn't detect a working C compiler. However all other +compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are +optional. If a working compiler is not available, we give a "soft landing" +(give a warning message, disable the optional component, and keep going). +The old implementation of the soft landing was not applied consistently (C++ +was unnecessarily mandatory before) and also caused problems for ccmake (a +CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end +to the cmake application) which incorrectly dropped languages as a result +even when there was a working compiler. + +We now have completely reimplemented the soft landing logic. The result +works well for cmake, ccmake, and cmake-gui. The one limitation of this new +method that we are aware of is it only recognizes either the default +compiler chosen by the generator or else a compiler specified by the +environment variable approach (see Official Notice XII above). Once CMake +bug 9220 has been fixed (so that the OPTIONAL signature of the +enable_language command actually works without erroring out), then our +soft-landing approach (which is a workaround for bug 9220) will be replaced +by the OPTIONAL signature of enable_language, and all CMake methods of +specifying compilers and compiler options will automatically be recognized +as a result. + + + PLplot Release 5.9.4 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts Modified: trunk/README.release =================================================================== --- trunk/README.release 2009-09-06 19:02:06 UTC (rev 10374) +++ trunk/README.release 2009-09-06 20:25:54 UTC (rev 10375) @@ -1,9 +1,9 @@ -PLplot Release 5.9.5 +PLplot Release 5.10.0 ~~~~~~~~~~~~~~~~~~~~ -This is a development release of PLplot. It represents the ongoing efforts +This is a stable release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development -releases in the 5.9.x series will be available every few months. The next -stable release will be 5.10.0. +releases in the 5.11.x series will be available every few months. The next +stable release will be 5.12.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the @@ -110,68 +110,12 @@ as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. + INDEX -1. Changes relative to PLplot 5.9.4 (the previous development release) +1. Changes relative to PLplot 5.9.5 (the previous development release) -1.1 PyQt changes -1.2 Color Palettes -1.3 Reimplementation of a "soft landing" when a bad/missing compiler is -detected -1.1 PyQt changes - -Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot -(some of the functions in plplot_widgetmodule.c in bindings/python) and a -proof-of-concept example (prova.py and qplplot.py in examples/python), but -this code did not gain any developer interest and was therefore not -understood or maintained. Recently one of our core developers has -implemented a sip-generated pyqt4 interface to PLplot (controlled by -plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a -python extension module, and a good-looking pyqt4 example (pyqt4_example.py -in examples/python) that works well. Since this pyqt4 approach is -maintained by a PLplot developer it appears to have a good future, and we -have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot -interface and example completely. - -1.2 Color Palettes - -Support has been added to PLplot for user defined color palette files. -These files can be loaded at the command line using the -cmap0 or --cmap1 commands, or via the API using the plspal0 and plspal1 commands. -The commands cmap0 / plspal0 are used to load cmap0 type files which -specify the colors in PLplots color table 0. The commands cmap1 / -plspal1 are used to load cmap1 type files which specify PLplots color -table 1. Examples of both types of files can be found in either the -plplot-source/data directory or the PLplot installed directory -(typically /usr/local/share/plplotx.y.z/ on linux). - -1.3 Reimplementation of a "soft landing" when a bad/missing compiler is -detected. - -The PLplot core library is written in C so our CMake-based build system will -error out if it doesn't detect a working C compiler. However all other -compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are -optional. If a working compiler is not available, we give a "soft landing" -(give a warning message, disable the optional component, and keep going). -The old implementation of the soft landing was not applied consistently (C++ -was unnecessarily mandatory before) and also caused problems for ccmake (a -CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end -to the cmake application) which incorrectly dropped languages as a result -even when there was a working compiler. - -We now have completely reimplemented the soft landing logic. The result -works well for cmake, ccmake, and cmake-gui. The one limitation of this new -method that we are aware of is it only recognizes either the default -compiler chosen by the generator or else a compiler specified by the -environment variable approach (see Official Notice XII above). Once CMake -bug 9220 has been fixed (so that the OPTIONAL signature of the -enable_language command actually works without erroring out), then our -soft-landing approach (which is a workaround for bug 9220) will be replaced -by the OPTIONAL signature of enable_language, and all CMake methods of -specifying compilers and compiler options will automatically be recognized -as a result. - 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-09-06 23:52:44
|
Revision: 10378 http://plplot.svn.sourceforge.net/plplot/?rev=10378&view=rev Author: airwin Date: 2009-09-06 23:52:38 +0000 (Sun, 06 Sep 2009) Log Message: ----------- Implement a pair of functions, plsave_set_locale and plrestore_locale that provide infrastructure to protect the parts of PLplot that absolutely require the LC_NUMERIC "C" locale without forcing that locale for all parts of PLplot. Use these functions to protect colour palette reading. Modified Paths: -------------- trunk/include/plplotP.h trunk/src/plcore.c trunk/src/plctrl.c Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2009-09-06 21:04:55 UTC (rev 10377) +++ trunk/include/plplotP.h 2009-09-06 23:52:38 UTC (rev 10378) @@ -120,7 +120,7 @@ #include <unistd.h> #endif -/*#include <locale.h> */ +#include <locale.h> /* (AM) Define M_PI if the platform does not include it (MSVC for instance) */ @@ -426,14 +426,6 @@ /* Greek character translation array (defined in plcore.c) */ extern const char plP_greek_mnemonic[]; -/* plinit calls setlocale to establish this pointer to a character string - that stores the LC_NUMERIC locale set by any library or application before - it calls plinit. This character string is used to restore the LC_NUMERIC - locale to the original one after anything (such as colour palette file - reading) within PLplot that temporarily changes the locale. - extern PLDLLIMPEXP_DATA(char *) plplot_default_lc_numeric_locale; */ - - /*--------------------------------------------------------------------------*\ * Function Prototypes * @@ -574,6 +566,20 @@ plP_text(PLINT base, PLFLT just, PLFLT *xform, PLINT x, PLINT y, PLINT refx, PLINT refy, const char *string); + /* Used to save locale string to be used for later restore of locale. */ +extern PLDLLIMPEXP_DATA(char *)plsaved_lc_numeric_locale; + + /* For LC_NUMERIC save current locale string, then set "C" locale to protect + parts of PLplot which absolutely demand the LC_NUMERIC "C" locale. */ + +PLDLLIMPEXP void +plsave_set_locale(void); + + /* Restore LC_NUMERIC locale that was determined by plsave_set_locale. */ + +PLDLLIMPEXP void +plrestore_locale(void); + /* where should structure definitions that must be seen by drivers and core source files, be? */ /* structure to be used by plcore.c and anydriver.c, related to plP_text() */ Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-09-06 21:04:55 UTC (rev 10377) +++ trunk/src/plcore.c 2009-09-06 23:52:38 UTC (rev 10378) @@ -128,9 +128,6 @@ */ const char plP_greek_mnemonic[] = "ABGDEZYHIKLMNCOPRSTUFXQWabgdezyhiklmncoprstufxqw"; -/* Must define this pointer once. Corresponding declaration is in plplotP.h - char * plplot_default_lc_numeric_locale; */ - void plP_init(void) { @@ -1804,15 +1801,7 @@ PLFLT def_arrow_y[6] = {0.0, 0.0, 0.2, 0.0, -0.2, 0.0}; PLFLT lx, ly, xpmm_loc, ypmm_loc, aspect_old, aspect_new; PLINT mk = 0, sp = 0, inc = 0, del = 2000; - /* Save current LC_NUMERIC locale string pointer in - plplot_default_lc_numeric_locale for purposes of restoring the - current LC_NUMERIC locale after the PLplot library temporarily - fiddles with it. - if(!(plplot_default_lc_numeric_locale = setlocale(LC_NUMERIC, NULL))) { - plexit("plinit: LC_NUMERIC has no default name of locale"); - } */ - pllib_init(); if (plsc->level != 0) Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-09-06 21:04:55 UTC (rev 10377) +++ trunk/src/plctrl.c 2009-09-06 23:52:38 UTC (rev 10378) @@ -51,6 +51,10 @@ #include <errno.h> #endif +/* extern declaration in plplotP.h, but defined here once for all of + libplplot. */ +char * plsaved_lc_numeric_locale; + /* Random number generator (Mersenne Twister) */ #include "mt19937ar.h" @@ -1207,9 +1211,8 @@ char msgbuf[1024]; FILE *fp; - /* if(!(setlocale(LC_NUMERIC, "C"))) { - plexit("cmap0_palette_read: LC_NUMERIC locale could not be set for \"C\""); - } */ + plsave_set_locale(); + if(strlen(filename) == 0) { fp = plLibOpen(PL_DEFAULT_CMAP0_FILE); if (fp == NULL) { @@ -1307,11 +1310,7 @@ } } - /* Restore default LC_NUMERIC locale since we fiddled with it above. - if(!(setlocale(LC_NUMERIC, plplot_default_lc_numeric_locale))) { - snprintf(msgbuf,1024,"cmap0_palette_read: LC_NUMERIC could not be restored to the default \"%s\" locale.\n", *plplot_default_lc_numeric_locale); - plexit(msgbuf); - } */ + plrestore_locale(); } /*--------------------------------------------------------------------------*\ @@ -1382,9 +1381,8 @@ FILE *fp; char msgbuf[1024]; - /* if(!(setlocale(LC_NUMERIC, "C"))) { - plexit("plspal1: LC_NUMERIC locale could not be set for \"C\""); - }*/ + plsave_set_locale(); + rgb = TRUE; err = 0; format_version = 0; @@ -1393,14 +1391,14 @@ if (fp == NULL) { snprintf(msgbuf,1024,"Unable to open cmap1 .pal file %s\n",PL_DEFAULT_CMAP1_FILE); plwarn(msgbuf); - return; + goto finish; } } else { fp = plLibOpen(filename); if (fp == NULL) { snprintf(msgbuf,1024,"Unable to open cmap1 .pal file %s\n",filename); plwarn(msgbuf); - return; + goto finish; } } /* Check for new file format */ @@ -1423,7 +1421,7 @@ snprintf(msgbuf,1024,"Unrecognized cmap1 format (wrong number of colors) %s\n", color_info); plwarn(msgbuf); fclose(fp); - return; + goto finish; } r = (PLFLT *)malloc(number_colors * sizeof(PLFLT)); @@ -1551,6 +1549,8 @@ free(a); free(pos); free(rev); + +finish: plrestore_locale(); } /*--------------------------------------------------------------------------*\ @@ -1936,7 +1936,7 @@ free_mem(fs); return NULL; - done: +done: pldebug("plLibOpenPdfstr", "Found file %s\n", fs); free_mem(fs); return (file); @@ -2552,3 +2552,59 @@ { return (PLFLT)(genrand_real1()); } + +/*--------------------------------------------------------------------------*\ + * plsave_set_locale() + * + * For LC_NUMERIC save current locale string in the global + * pointer, plsaved_lc_numeric_locale, then set "C" locale. + * n.b. plsave_set_locale and plrestore_locale should always be used as + * a pair to surround PLplot code that absolutely requires the + * LC_NUMERIC "C" locale to be in effect. It is one of plrestore_locale's + * responsibilities to free the memory allocated here for the locale + * string. +\*--------------------------------------------------------------------------*/ + +void +plsave_set_locale(void) { + char * setlocale_ptr; + char msgbuf[1024]; + + if(!(plsaved_lc_numeric_locale = (char *) malloc(100*sizeof(char)))) { + plexit("plsave_set_locale: out of memory"); + } + + /*save original LC_NUMERIC locale for restore below. */ + if(!(setlocale_ptr = setlocale(LC_NUMERIC, NULL))) { + snprintf(msgbuf,1024,"plsave_set_locale: LC_NUMERIC locale could not be determined for NULL locale.\n"); + plexit(msgbuf); + } + strncpy(plsaved_lc_numeric_locale, setlocale_ptr, 100); + plsaved_lc_numeric_locale[99] = '\0'; + pldebug("plsave_set_locale", "LC_NUMERIC locale to be restored is \"%s\"\n", plsaved_lc_numeric_locale); + if(!(setlocale(LC_NUMERIC, "C"))) { + plexit("plsave_set_locale: LC_NUMERIC locale could not be set to \"C\""); + } +} + +/*--------------------------------------------------------------------------*\ + * plrestore_locale() + * + * For LC_NUMERIC restore the locale string that was determined by + * plsave_set_locale with a pointer to that string stored in the global + * variable plsaved_lc_numeric_locale and free the memory for that string. +\*--------------------------------------------------------------------------*/ + +void +plrestore_locale(void) { + char msgbuf[1024]; + + pldebug("plrestore_locale", "LC_NUMERIC locale to be restored is \"%s\"\n", plsaved_lc_numeric_locale); + + if(!(setlocale(LC_NUMERIC, plsaved_lc_numeric_locale))) { + snprintf(msgbuf,1024,"plrestore_locale: LC_NUMERIC could not be restored to the default \"%s\" locale.\n", plsaved_lc_numeric_locale); + plexit(msgbuf); + } + free(plsaved_lc_numeric_locale); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-09-08 02:46:05
|
Revision: 10382 http://plplot.svn.sourceforge.net/plplot/?rev=10382&view=rev Author: airwin Date: 2009-09-08 02:45:49 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Make plsave_set_locale() and plrestore_locale reentrant (no more dependence on global variable). This means this pair of routines must be called from the same routine, but in practice that fine grain use of these routines is required in any case, and the reentrancy is required in any case by some of the device driver pldebug calls which recursively call the device driver. Modified Paths: -------------- trunk/include/plplotP.h trunk/src/plctrl.c Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2009-09-08 02:37:58 UTC (rev 10381) +++ trunk/include/plplotP.h 2009-09-08 02:45:49 UTC (rev 10382) @@ -566,19 +566,16 @@ plP_text(PLINT base, PLFLT just, PLFLT *xform, PLINT x, PLINT y, PLINT refx, PLINT refy, const char *string); - /* Used to save locale string to be used for later restore of locale. */ -extern PLDLLIMPEXP_DATA(char *)plsaved_lc_numeric_locale; - - /* For LC_NUMERIC save current locale string, then set "C" locale to protect + /* Save LC_NUMERIC locale string, then set "C" locale to protect parts of PLplot which absolutely demand the LC_NUMERIC "C" locale. */ -PLDLLIMPEXP void +PLDLLIMPEXP char * plsave_set_locale(void); /* Restore LC_NUMERIC locale that was determined by plsave_set_locale. */ PLDLLIMPEXP void -plrestore_locale(void); +plrestore_locale(char * save_lc_numeric_locale); /* where should structure definitions that must be seen by drivers and core source files, be? */ Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-09-08 02:37:58 UTC (rev 10381) +++ trunk/src/plctrl.c 2009-09-08 02:45:49 UTC (rev 10382) @@ -51,10 +51,6 @@ #include <errno.h> #endif -/* extern declaration in plplotP.h, but defined here once for all of - libplplot. */ -char * plsaved_lc_numeric_locale; - /* Random number generator (Mersenne Twister) */ #include "mt19937ar.h" @@ -1210,9 +1206,8 @@ char color_info[30]; char msgbuf[1024]; FILE *fp; + char * save_locale = plsave_set_locale(); - plsave_set_locale(); - if(strlen(filename) == 0) { fp = plLibOpen(PL_DEFAULT_CMAP0_FILE); if (fp == NULL) { @@ -1310,7 +1305,7 @@ } } - plrestore_locale(); + plrestore_locale(save_locale); } /*--------------------------------------------------------------------------*\ @@ -1380,9 +1375,8 @@ PLBOOL *rev; FILE *fp; char msgbuf[1024]; + char * save_locale = plsave_set_locale(); - plsave_set_locale(); - rgb = TRUE; err = 0; format_version = 0; @@ -1550,7 +1544,7 @@ free(pos); free(rev); -finish: plrestore_locale(); +finish: plrestore_locale(save_locale); } /*--------------------------------------------------------------------------*\ @@ -2556,8 +2550,8 @@ /*--------------------------------------------------------------------------*\ * plsave_set_locale() * - * For LC_NUMERIC save current locale string in the global - * pointer, plsaved_lc_numeric_locale, then set "C" locale. + * Save LC_NUMERIC locale in a string. The pointer to that string is + * returned. Then set LC_NUMERIC to "C" locale. * n.b. plsave_set_locale and plrestore_locale should always be used as * a pair to surround PLplot code that absolutely requires the * LC_NUMERIC "C" locale to be in effect. It is one of plrestore_locale's @@ -2565,46 +2559,60 @@ * string. \*--------------------------------------------------------------------------*/ -void +char * plsave_set_locale(void) { char * setlocale_ptr; - char msgbuf[1024]; + char * saved_lc_numeric_locale; - if(!(plsaved_lc_numeric_locale = (char *) malloc(100*sizeof(char)))) { + if(!(saved_lc_numeric_locale = (char *) malloc(100*sizeof(char)))) { plexit("plsave_set_locale: out of memory"); } /*save original LC_NUMERIC locale for restore below. */ if(!(setlocale_ptr = setlocale(LC_NUMERIC, NULL))) { - snprintf(msgbuf,1024,"plsave_set_locale: LC_NUMERIC locale could not be determined for NULL locale.\n"); - plexit(msgbuf); + plexit("plsave_set_locale: LC_NUMERIC locale could not be determined for NULL locale.\n"); } - strncpy(plsaved_lc_numeric_locale, setlocale_ptr, 100); - plsaved_lc_numeric_locale[99] = '\0'; - pldebug("plsave_set_locale", "LC_NUMERIC locale to be restored is \"%s\"\n", plsaved_lc_numeric_locale); + strncpy(saved_lc_numeric_locale, setlocale_ptr, 100); + saved_lc_numeric_locale[99] = '\0'; + + /* Do not use pldebug since get overflowed stack (infinite recursion) + if device is interactive (i.e., pls->termin is set). */ + /* comment out fprintf (unless there is some emergency debugging to do) + because output is too voluminous. */ + /* +fprintf(stderr, "plsave_set_locale: saved LC_NUMERIC locale is \"%s\"\n", saved_lc_numeric_locale); + */ + if(!(setlocale(LC_NUMERIC, "C"))) { plexit("plsave_set_locale: LC_NUMERIC locale could not be set to \"C\""); } + return saved_lc_numeric_locale; } /*--------------------------------------------------------------------------*\ * plrestore_locale() * - * For LC_NUMERIC restore the locale string that was determined by - * plsave_set_locale with a pointer to that string stored in the global - * variable plsaved_lc_numeric_locale and free the memory for that string. + * Restore LC_NUMERIC locale string that was determined by + * plsave_set_locale with the pointer to that string as the argument. + * Also, free the memory for that string. \*--------------------------------------------------------------------------*/ void -plrestore_locale(void) { - char msgbuf[1024]; +plrestore_locale(char *saved_lc_numeric_locale) { - pldebug("plrestore_locale", "LC_NUMERIC locale to be restored is \"%s\"\n", plsaved_lc_numeric_locale); + /* Do not use pldebug since get overflowed stack (infinite recursion) + if device is interactive (i.e., pls->termin is set). */ + /* comment out fprintf (unless there is some emergency debugging to do) + because output is too voluminous. */ + /* + fprintf(stderr, "plrestore_locale: restored LC_NUMERIC locale is \"%s\"\n", saved_lc_numeric_locale); + */ - if(!(setlocale(LC_NUMERIC, plsaved_lc_numeric_locale))) { - snprintf(msgbuf,1024,"plrestore_locale: LC_NUMERIC could not be restored to the default \"%s\" locale.\n", plsaved_lc_numeric_locale); + if(!(setlocale(LC_NUMERIC, saved_lc_numeric_locale))) { + char msgbuf[1024]; + snprintf(msgbuf,1024,"plrestore_locale: LC_NUMERIC could not be restored to the default \"%s\" locale.\n", saved_lc_numeric_locale); plexit(msgbuf); } - free(plsaved_lc_numeric_locale); + free(saved_lc_numeric_locale); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-09-08 20:33:45
|
Revision: 10388 http://plplot.svn.sourceforge.net/plplot/?rev=10388&view=rev Author: airwin Date: 2009-09-08 20:33:37 +0000 (Tue, 08 Sep 2009) Log Message: ----------- Drop example 1 -locale option and replace it with a general -locale option. Document the locale interpretation changes in README.release. Modified Paths: -------------- trunk/README.release trunk/examples/c/x01c.c trunk/src/plargs.c Modified: trunk/README.release =================================================================== --- trunk/README.release 2009-09-08 18:08:19 UTC (rev 10387) +++ trunk/README.release 2009-09-08 20:33:37 UTC (rev 10388) @@ -110,11 +110,11 @@ as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. - INDEX 1. Changes relative to PLplot 5.9.5 (the previous development release) +1.1 Make PLplot aware of LC_NUMERIC locale 2. Changes relative to PLplot 5.8.0 (the previous stable release) @@ -128,7 +128,7 @@ 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device -2.10 Improvements to the cairo driver family. +2.10 Improvements to the cairo driver family 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements @@ -154,9 +154,74 @@ 2.33 PyQt changes 2.34 Color Palettes 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is -detected. +detected +2.36 Make PLplot aware of LC_NUMERIC locale +1. Changes relative to PLplot 5.9.5 (the previous development release) +1.1 Make PLplot aware of LC_NUMERIC locale + +For POSIX-compliant systems, locale is set globally so any external +applications or libraries that use the PLplot library or any external +libraries used by the PLplot library or PLplot device drivers could +potentially change the LC_NUMERIC locale used by PLplot to anything those +external applications and libraries choose. The principal consequence of +such choice is the decimal separator could be a comma (for some locales) +rather than the period assumed for the "C" locale. For previous versions of +PLplot a comma decimal separator would have lead to a large number of +errors, but this issue is now addressed with a side benefit that our plots +now have the capability of displaying the comma (e.g., in axis labels) for +the decimal separator for those locales which require that. + +If you are not satisfied with the results for the default PLplot locale set +by external applications and libraries, then you can now choose the +LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line +option for PLplot (if you do not specify that option, a default locale is +chosen depending on applications and libraries external to PLplot (see +comments above), and (b) setting an environment variable (LC_ALL, +LC_NUMERIC, or LANG on Linux, for example) to some locale that has been +installed on your system. On Linux, to find what locales are installed, use +the "locale -a" option. The "C" locale is always installed, but usually +there is also a principal locale that works on a platform such as +en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build +and install any additional locale you desire. (For example, on Debian Linux +you do that by running "dpkg-reconfigure locales".) + +Normally, users will not use the -locale option since the period +decimal separator that you get for the normal LC_NUMERIC default "C" +locale used by external applications and libraries is fine for their needs. +However, if the resulting decimal separator is not what the user +wants, then they would do something like the following to (a) use a period +decimal separator for command-line input and plots: + +LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 + +or (b) use a comma decimal separator for command-line input and plots: + +LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 + +N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 +in the first case or -ori 0.5 in the second) the floating-point conversion +(using atof) is silently terminated at the wrong separator for the locale, +i.e., the fractional part of the number is silently dropped. This is +obviously not ideal, but on the other hand there are relatively few +floating-point command-line options for PLplot, and we also expect those who +use the -locale option to specifically ask for a given separator for plots +(e.g., axis labels) will then use it for command-line input of +floating-point values as well. + +Certain critical areas of the PLplot library (e.g., our colour palette file +reading routines and much of the code in our device drivers) absolutely +require a period for the decimal separator. We now protect those critical +areas by saving the normal PLplot LC_NUMERIC locale (established with the +above -locale option or by default by whatever is set by external +applications or libraries), setting the LC_NUMERIC "C" locale, executing the +critical code, then restoring back to the normal PLplot LC_NUMERIC locale. +Previous versions of PLplot did not have this protection of the critical +areas so were vulnerable to default LC_NUMERIC settings of external +applications that resulted in a comma decimal separator that did not work +correctly for the critical areas. + 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed @@ -271,7 +336,7 @@ information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. -2.10 Improvements to the cairo driver family. +2.10 Improvements to the cairo driver family Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice @@ -615,7 +680,7 @@ (typically /usr/local/share/plplotx.y.z/ on linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is -detected. +detected The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other @@ -639,3 +704,66 @@ by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. + +2.36 Make PLplot aware of LC_NUMERIC locale + +For POSIX-compliant systems, locale is set globally so any external +applications or libraries that use the PLplot library or any external +libraries used by the PLplot library or PLplot device drivers could +potentially change the LC_NUMERIC locale used by PLplot to anything those +external applications and libraries choose. The principal consequence of +such choice is the decimal separator could be a comma (for some locales) +rather than the period assumed for the "C" locale. For previous versions of +PLplot a comma decimal separator would have lead to a large number of +errors, but this issue is now addressed with a side benefit that our plots +now have the capability of displaying the comma (e.g., in axis labels) for +the decimal separator for those locales which require that. + +If you are not satisfied with the results for the default PLplot locale set +by external applications and libraries, then you can now choose the +LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line +option for PLplot (if you do not specify that option, a default locale is +chosen depending on applications and libraries external to PLplot (see +comments above), and (b) setting an environment variable (LC_ALL, +LC_NUMERIC, or LANG on Linux, for example) to some locale that has been +installed on your system. On Linux, to find what locales are installed, use +the "locale -a" option. The "C" locale is always installed, but usually +there is also a principal locale that works on a platform such as +en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build +and install any additional locale you desire. (For example, on Debian Linux +you do that by running "dpkg-reconfigure locales".) + +Normally, users will not use the -locale option since the period +decimal separator that you get for the normal LC_NUMERIC default "C" +locale used by external applications and libraries is fine for their needs. +However, if the resulting decimal separator is not what the user +wants, then they would do something like the following to (a) use a period +decimal separator for command-line input and plots: + +LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 + +or (b) use a comma decimal separator for command-line input and plots: + +LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 + +N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 +in the first case or -ori 0.5 in the second) the floating-point conversion +(using atof) is silently terminated at the wrong separator for the locale, +i.e., the fractional part of the number is silently dropped. This is +obviously not ideal, but on the other hand there are relatively few +floating-point command-line options for PLplot, and we also expect those who +use the -locale option to specifically ask for a given separator for plots +(e.g., axis labels) will then use it for command-line input of +floating-point values as well. + +Certain critical areas of the PLplot library (e.g., our colour palette file +reading routines and much of the code in our device drivers) absolutely +require a period for the decimal separator. We now protect those critical +areas by saving the normal PLplot LC_NUMERIC locale (established with the +above -locale option or by default by whatever is set by external +applications or libraries), setting the LC_NUMERIC "C" locale, executing the +critical code, then restoring back to the normal PLplot LC_NUMERIC locale. +Previous versions of PLplot did not have this protection of the critical +areas so were vulnerable to default LC_NUMERIC settings of external +applications that resulted in a comma decimal separator that did not work +correctly for the critical areas. Modified: trunk/examples/c/x01c.c =================================================================== --- trunk/examples/c/x01c.c 2009-09-08 18:08:19 UTC (rev 10387) +++ trunk/examples/c/x01c.c 2009-09-08 20:33:37 UTC (rev 10388) @@ -28,15 +28,13 @@ # include <unistd.h> #endif -#include <locale.h> - /* Variables and data arrays used by plot generators */ static PLFLT x[101], y[101]; static PLFLT xscale, yscale, xoff, yoff, xs[6], ys[6]; static PLGraphicsIn gin; -static int locate_mode, locale_mode; +static int locate_mode; static int test_xor; static int fontset = 1; static char *f_name = NULL; @@ -77,14 +75,6 @@ "-save filename", "Save plot in color postscript `file'" }, { - "locale", /* Turns on test of setting LC_NUMERIC locale */ - NULL, - NULL, - &locale_mode, - PL_OPT_BOOL, - "-locale", - "Turns on test of setting LC_NUMERIC locale" }, -{ NULL, /* option */ NULL, /* handler */ NULL, /* client data */ @@ -119,7 +109,6 @@ { PLINT digmax, cur_strm, new_strm; char ver[80]; - char * locale; /* plplot initialization */ @@ -128,14 +117,6 @@ plMergeOpts(options, "x01c options", notes); plparseopts(&argc, argv, PL_PARSE_FULL); - if(locale_mode) { - if(locale = setlocale(LC_NUMERIC, "")) { - printf("LC_NUMERIC locale set to \"%s\"\n", locale); - } else { - plwarn("LC_NUMERIC could not be set for locale of \"\". Using \"C\" locale instead.\n"); - setlocale(LC_NUMERIC, "C"); - } - } /* Get version number, just for kicks */ plgver(ver); Modified: trunk/src/plargs.c =================================================================== --- trunk/src/plargs.c 2009-09-08 18:08:19 UTC (rev 10387) +++ trunk/src/plargs.c 2009-09-08 20:33:37 UTC (rev 10388) @@ -152,6 +152,7 @@ static int opt_dev_compression (const char *, const char *, void *); static int opt_cmap0 (const char *, const char *, void *); static int opt_cmap1 (const char *, const char *, void *); +static int opt_locale (const char *, const char *, void *); /* Global variables */ @@ -576,6 +577,14 @@ "-cmap1 file name", "Initializes color table 1 from a cmap1.pal format file in one of standard PLplot paths."}, { + "locale", + opt_locale, + NULL, + NULL, + PL_OPT_FUNC, + "-locale", + "Use locale environment (e.g., LC_ALL, LC_NUMERIC, or LANG) to set LC_NUMERIC locale (which affects decimal point separator)."}, +{ "drvopt", /* Driver specific options */ opt_drvopt, NULL, @@ -2274,3 +2283,25 @@ plspal1(optarg, TRUE); return 0; } + +/*--------------------------------------------------------------------------*\ + * opt_locale() + * + * Make PLplot portable to all LC_NUMERIC locales. +\*--------------------------------------------------------------------------*/ + +static int +opt_locale(const char *opt, const char *optarg, void *client_data) +{ + char *locale; + if(locale = setlocale(LC_NUMERIC, "")) { + printf("LC_NUMERIC locale set to \"%s\"\n", locale); + } else { + plwarn("Could not use invalid environment (e.g., LC_ALL, LC_NUMERIC, or LANG) to set LC_NUMERIC locale. Falling back to LC_NUMERIC \"C\" locale instead.\n"); + if(!(locale = setlocale(LC_NUMERIC, "C"))) { + plexit("Your platform is seriously broken. Not even a \"C\" locale could be set."); + } + } + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-09-11 04:32:36
|
Revision: 10396 http://plplot.svn.sourceforge.net/plplot/?rev=10396&view=rev Author: airwin Date: 2009-09-11 04:32:14 +0000 (Fri, 11 Sep 2009) Log Message: ----------- Fix long-standing dependency issues for the ocaml bindings and examples. As far as I know, with this fix no ocaml-related builds are done when they shouldn't be, and we now have proper file dependencies (as demonstrated by touch) and target dependencies (as demonstrated by parallel builds) between builds of libplplot(d), the ocaml bindings, and the ocaml examples. Modified Paths: -------------- trunk/bindings/ocaml/CMakeLists.txt trunk/examples/ocaml/CMakeLists.txt Modified: trunk/bindings/ocaml/CMakeLists.txt =================================================================== --- trunk/bindings/ocaml/CMakeLists.txt 2009-09-10 14:19:35 UTC (rev 10395) +++ trunk/bindings/ocaml/CMakeLists.txt 2009-09-11 04:32:14 UTC (rev 10396) @@ -32,9 +32,6 @@ plplot.mli touchup.ml ) - set(GEN_SOURCE_LIST - ${CMAKE_CURRENT_BINARY_DIR}/myocamlbuild.ml - ) set(OCAML_INSTALL_FILES plplot.cma @@ -50,7 +47,7 @@ set(OCAML_FULL_INSTALL_FILES ${OCAML_FULL_INSTALL_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/${OCAML_FILE}) endforeach(OCAML_FILE ${OCAML_INSTALL_FILES}) - # Configure the META file +# Configure the META file # Configure pkg-config *.pc file corresponding to plplot.cma if(PKG_CONFIG_EXECUTABLE) if(LIB_TAG) @@ -97,7 +94,9 @@ # Configure the file controlling the ocamlbuild process configure_file(myocamlbuild.ml.cmake ${CMAKE_CURRENT_BINARY_DIR}/myocamlbuild.ml) - set(DEPENDS_LIST ${GEN_SOURCE_LIST}) + # Don't bother with dependency on configured myocamlbuild.ml since + # that file is created at initial cmake time. + set(DEPENDS_LIST) # Copy all source into the build tree since the whole project must be in # the same directory @@ -105,41 +104,69 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} COMMAND ${CMAKE_COMMAND} - -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} + -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ) - set(DEPENDS_LIST ${DEPENDS_LIST} ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE}) + list(APPEND DEPENDS_LIST ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE}) endforeach(SRC_FILE ${SOURCE_LIST}) # Note: ocamlbuild requires build-dir to be a relative path # Also the build-dir must not be the project root - hence the # new subdirectory - # Build bytecode version + + # N.B. "touch_nocreate" commands below are used to always update the + # date on the OUTPUT files since under certain circumstances (a + # rebuild with new plplot${LIB_TAG}) ${OCAMLBUILD} does not update + # the date itself which screws up file dependencies. + + # Build bytecode version. add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cma COMMAND ${OCAMLBUILD} -tag debug -classic-display -build-dir ${OCAML_BUILD_DIR} plplot.cma + COMMAND ${CMAKE_COMMAND} -E touch_nocreate + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cma DEPENDS ${DEPENDS_LIST} plplot${LIB_TAG} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) + add_custom_target( + plplot_ocaml_bytecode + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cma + ) - # Build native version. Use DEPENDS to serialize against plplot.cma - # since the two ocamlbuilds interfere with each other when in parallel - # build mode. + # Build native version. add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cmxa + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cmxa ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.a COMMAND ${OCAMLBUILD} -tag debug -classic-display -build-dir ${OCAML_BUILD_DIR} plplot.cmxa + COMMAND ${CMAKE_COMMAND} -E touch_nocreate + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cmxa + COMMAND ${CMAKE_COMMAND} -E touch_nocreate + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.a DEPENDS ${DEPENDS_LIST} plplot${LIB_TAG} - ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cma WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - add_custom_target( - plplot_ocaml ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cma ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cmxa ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.a + plplot_ocaml_native + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cmxa + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.a ) + # Serialize these two with a target dependency since the two builds + # interfere with each other if done in parallel. + add_dependencies(plplot_ocaml_native plplot_ocaml_bytecode) + + add_custom_target(plplot_ocaml ALL) + add_dependencies(plplot_ocaml plplot_ocaml_native) + + # Need to keep track of file dependencies since this is a custom target. + set_property(GLOBAL PROPERTY FILES_plplot_ocaml + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cma + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.cmxa + ${CMAKE_CURRENT_BINARY_DIR}/${OCAML_BUILD_DIR}/plplot.a + ) # Most files go in the plplot subdirectory install(FILES ${OCAML_FULL_INSTALL_FILES} ${CMAKE_CURRENT_BINARY_DIR}/META @@ -151,11 +178,12 @@ DESTINATION ${OCAML_INSTALL_DIR}/stublibs ) - # This does not work as the clean rule will not remove directories which - # are not empty + # Remove entire contents of ${OCAML_BUILD_DIR} when the clean target + # is run. This proved to work fine on cmake-2.6.4, but may not for + # earlier versions according to a remark made here before. set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${OCAML_BUILD_DIR} - ) + ) endif(ENABLE_ocaml) Modified: trunk/examples/ocaml/CMakeLists.txt =================================================================== --- trunk/examples/ocaml/CMakeLists.txt 2009-09-10 14:19:35 UTC (rev 10395) +++ trunk/examples/ocaml/CMakeLists.txt 2009-09-11 04:32:14 UTC (rev 10396) @@ -65,8 +65,7 @@ if(CORE_BUILD) set(ocaml_SRCS) foreach(STRING_INDEX ${ocaml_STRING_INDICES}) - set(SOURCE_FILE x${STRING_INDEX}.ml) - set(ocaml_SRCS ${ocaml_SRCS} ${SOURCE_FILE}) + list(APPEND ocaml_SRCS x${STRING_INDEX}.ml) endforeach(STRING_INDEX ${ocaml_STRING_INDICES}) configure_file( @@ -99,7 +98,9 @@ set(ccopt_OPTION "-L ${CMAKE_INSTALL_LIBDIR} -Wl,-rpath -Wl,${CMAKE_INSTALL_LIBDIR} ") endif(CORE_BUILD) + get_property(files_plplot_ocaml GLOBAL PROPERTY FILES_plplot_ocaml) set_property(GLOBAL PROPERTY TARGETS_examples_ocaml) + set_property(GLOBAL PROPERTY FILES_examples_ocaml) foreach(STRING_INDEX ${ocaml_STRING_INDICES}) set(EXECUTABLE_NAME x${STRING_INDEX}ocaml) set(SOURCE_FILE x${STRING_INDEX}.ml) @@ -121,7 +122,9 @@ plplot.cma -o ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} + ${files_plplot_ocaml} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM ) @@ -133,6 +136,7 @@ add_dependencies(target_${EXECUTABLE_NAME} plplot_ocaml) endif(CORE_BUILD) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_ocaml target_${EXECUTABLE_NAME}) + set_property(GLOBAL APPEND PROPERTY FILES_examples_ocaml ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME}) endforeach(STRING_INDEX ${ocaml_STRING_INDICES}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ocaml_EXTRA_CLEAN_FILES}") endif(BUILD_TEST) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-09-15 16:11:57
|
Revision: 10412 http://plplot.svn.sourceforge.net/plplot/?rev=10412&view=rev Author: airwin Date: 2009-09-15 16:11:51 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Remove all duplicates between config.h.cmake and include/plConfig.h.cmake. Document the different roles played by config.h.cmake and plConfig.h.cmake within those files. Modified Paths: -------------- trunk/config.h.cmake trunk/include/plConfig.h.cmake Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2009-09-15 14:41:21 UTC (rev 10411) +++ trunk/config.h.cmake 2009-09-15 16:11:51 UTC (rev 10412) @@ -1,17 +1,25 @@ -/* Generated from configure.ac by autoheader as of 2006-07-08 - * and converted to cmake form. cmake has no equivalent to - * autoheader yet so this file must be maintained manually from - * now on, i.e., if there is an addition of a configurable symbol, - * (all done from the top-level CMakeLists.txt file) - * it must be entered here as well in order for C/C++ programmes - * to have access to the configured symbol.*/ +/* Configured (by CMake) macros for PLplot that are required for the + core build but _not_ required for the build of the installed + examples (and presumably any user applications). Therefore, the + configured config.h should not be installed. In contrast, + include/plConfig.h.cmake (note, plConfig.h #includes config.h for + the core build because HAVE_CONFIG_H is #defined in that case) + contains configured macros that are required for the core build, + installed examples build, and build of user applications. + Therefore, in contrast to config.h, plConfig.h should be installed. + Maintenance issue: in makes no sense to configure duplicate macros + for both config.h and plConfig.h. Therefore, when adding a macro + decide which file to put it in depending on whether the result is + needed for the installed examples build or not. Furthermore, move + configured macros from one file to the other as needed depending on + that criterion, but do not copy them. + +*/ + /* Location of executables */ #define BIN_DIR "${BIN_DIR}" -/* isnan is in math.h but not cmath */ -#cmakedefine PL_BROKEN_ISNAN_CXX - /* Location of Build tree */ #define BUILD_DIR "${BUILD_DIR}" @@ -33,9 +41,6 @@ /* Define to 1 if you have the <cmath> header file. */ #cmakedefine HAVE_CMATH 1 -/* Define if you have c++ accessible stdint.h */ -#cmakedefine PL_HAVE_CXX_STDINT_H - /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H 1 @@ -67,28 +72,6 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #cmakedefine HAVE_INTTYPES_H 1 -/* Define if isinf is available */ -#cmakedefine PL_HAVE_ISINF - -/* Define if _isinf is available */ -#cmakedefine PL__HAVE_ISINF - -/* Define if isnan is available */ -#cmakedefine PL_HAVE_ISNAN - -/* Define if _isnan is available */ -#cmakedefine PL__HAVE_ISNAN - -/* Define if snprintf is available */ -#ifndef PL_HAVE_SNPRINTF -#cmakedefine PL_HAVE_SNPRINTF -#endif - -/* Define if _snprintf is available */ -#ifndef _PL_HAVE_SNPRINTF -#cmakedefine _PL_HAVE_SNPRINTF -#endif - /* Define if [incr], [Tcl] is available */ #cmakedefine HAVE_ITCL @@ -144,9 +127,6 @@ /* Define if Qhull is available */ #cmakedefine HAVE_QHULL -/* Define to 1 if you have the <stdint.h> header file. */ -#cmakedefine PL_HAVE_STDINT_H 1 - /* Define to 1 if you have the <stdlib.h> header file. */ #cmakedefine HAVE_STDLIB_H 1 @@ -170,12 +150,6 @@ /* Define to 1 if you have the <termios.h> header file. */ #cmakedefine HAVE_TERMIOS_H 1 -/* Define to 1 if you have the <unistd.h> header file. */ -#cmakedefine PL_HAVE_UNISTD_H 1 - -/* Define if usleep is available */ -#cmakedefine PL_HAVE_USLEEP - /* Define to 1 if you have the `vfork' function. */ #cmakedefine HAVE_VFORK 1 @@ -194,10 +168,6 @@ /* Portable definition for PTHREAD_MUTEX_RECURSIVE */ #define PLPLOT_MUTEX_RECURSIVE ${PLPLOT_MUTEX_RECURSIVE} -/* PLplot's PLFLT floating-point is "double" by default, undefine PL_DOUBLE if - single precision is required */ -#cmakedefine PL_DOUBLE - /* Directory containing fonts that are accessible from freetype */ #define PL_FREETYPE_FONT_DIR "${PL_FREETYPE_FONT_DIR}" @@ -303,9 +273,6 @@ /* Location of Tcl stuff */ #define TCL_DIR "${TCL_DIR}" -/* Define if C++ compiler accepts using namespace */ -#cmakedefine PL_USE_NAMESPACE - /* Version number of package */ #define VERSION "${VERSION}" Modified: trunk/include/plConfig.h.cmake =================================================================== --- trunk/include/plConfig.h.cmake 2009-09-15 14:41:21 UTC (rev 10411) +++ trunk/include/plConfig.h.cmake 2009-09-15 16:11:51 UTC (rev 10412) @@ -5,7 +5,7 @@ IFS, University of Texas at Austin 18-Jul-1994 - Copyright (C) 2004, 2006 Alan W. Irwin + Copyright (C) 2004, 2006, 2007, 2008, 2009 Alan W. Irwin Copyright (C) 2004 Rafael Laboissiere Copyright (C) 2004 Joao Cardoso @@ -25,13 +25,25 @@ along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ - Contains macro definitions that determine miscellaneous PLplot library - configuration defaults, such as macros for bin, font, lib, and tcl - install directories, and various system dependencies. On a Unix - system, typically the configure script builds plConfig.h from - plConfig.h.in. Elsewhere, it's best to hand-configure a plConfig.h - file and keep it with the system-specific files. +/* Configured (by CMake) macros for PLplot that are required for the + core build and the build of the installed + examples (and presumably any user applications). Therefore, the + configured plConfig.h should be installed. In contrast, + config.h.cmake (note, plConfig.h #includes config.h for + the core build because HAVE_CONFIG_H is #defined in that case) + contains configured macros that are only required for the core + build. Therefore, in contrast to plConfig.h, config.h should not + be installed. + + Maintenance issue: in makes no sense to configure duplicate macros + for both config.h and plConfig.h. Therefore, when adding a macro + decide which file to put it in depending on whether the result is + needed for the installed examples build or not. Furthermore, move + configured macros from one file to the other as needed depending on + that criterion, but do not copy them. + */ #ifndef __PLCONFIG_H__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |