From: <ai...@us...> - 2010-10-29 20:44:27
|
Revision: 11289 http://plplot.svn.sourceforge.net/plplot/?rev=11289&view=rev Author: airwin Date: 2010-10-29 20:44:17 +0000 (Fri, 29 Oct 2010) Log Message: ----------- Transform to new // style of commentary for fonts/*.c, utils/*.c, examples/c/*.[ch], and examples/tk/*.c. Modified Paths: -------------- trunk/examples/c/extXdrawable_demo.c trunk/examples/c/plcdemos.h trunk/examples/c/plplotcanvas_animation.c trunk/examples/c/plplotcanvas_demo.c trunk/examples/c/test_plend.c trunk/examples/c/tutor.c trunk/examples/c/x01c.c trunk/examples/c/x02c.c trunk/examples/c/x03c.c trunk/examples/c/x04c.c trunk/examples/c/x05c.c trunk/examples/c/x06c.c trunk/examples/c/x07c.c trunk/examples/c/x08c.c trunk/examples/c/x09c.c trunk/examples/c/x10c.c trunk/examples/c/x11c.c trunk/examples/c/x12c.c trunk/examples/c/x13c.c trunk/examples/c/x14c.c trunk/examples/c/x15c.c trunk/examples/c/x16c.c trunk/examples/c/x17c.c trunk/examples/c/x18c.c trunk/examples/c/x19c.c trunk/examples/c/x20c.c trunk/examples/c/x21c.c trunk/examples/c/x22c.c trunk/examples/c/x23c.c trunk/examples/c/x24c.c trunk/examples/c/x25c.c trunk/examples/c/x26c.c trunk/examples/c/x27c.c trunk/examples/c/x28c.c trunk/examples/c/x29c.c trunk/examples/c/x30c.c trunk/examples/c/x31c.c trunk/examples/c/x32c.c trunk/examples/tk/xtk01.c trunk/examples/tk/xtk02.c trunk/examples/tk/xtk04.c trunk/fonts/font01.c trunk/fonts/font02.c trunk/fonts/font03.c trunk/fonts/font04.c trunk/fonts/font05.c trunk/fonts/font06.c trunk/fonts/font07.c trunk/fonts/font08.c trunk/fonts/font09.c trunk/fonts/font10.c trunk/fonts/font11.c trunk/fonts/plhershey-unicode-gen.c trunk/fonts/stndfont.c trunk/fonts/xtndfont.c trunk/scripts/style_source.sh trunk/utils/plrender.c trunk/utils/pltcl.c trunk/utils/pltek.c trunk/utils/tektest.c trunk/utils/xform.c Modified: trunk/examples/c/extXdrawable_demo.c =================================================================== --- trunk/examples/c/extXdrawable_demo.c 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/extXdrawable_demo.c 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,38 +1,38 @@ -/* - * A simple GTK application demonstrating the use of the X Drawable - * functionality of plplot's xcairo driver. - * - * Copyright (C) 2008 Jonathan Woithe <jw...@ph...> - * - * This file is part of PLplot. - * - * PLplot is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Library Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * PLplot is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with PLplot; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ +// +// A simple GTK application demonstrating the use of the X Drawable +// functionality of plplot's xcairo driver. +// +// Copyright (C) 2008 Jonathan Woithe <jw...@ph...> +// +// This file is part of PLplot. +// +// PLplot is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Library Public License as published +// by the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// PLplot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with PLplot; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// -/* Set to 0 to draw direct to an X Window, 1 to draw via a pixmap */ +// Set to 0 to draw direct to an X Window, 1 to draw via a pixmap #define TO_PIXMAP 1 #include <stdio.h> #include <plplot.h> #include <gtk/gtk.h> -/* Needed for GDK_WINDOW_XID */ +// Needed for GDK_WINDOW_XID #include <gdk/gdkx.h> -/* Main menu structure */ +// Main menu structure static GtkItemFactoryEntry menu_items[] = { { "/_File", NULL, NULL, 0, "<Branch>" }, { "/File/_Quit", "<control>Q", gtk_main_quit, 0, NULL }, @@ -50,7 +50,7 @@ App app; -/* ======================================================================== */ +// ======================================================================== void setup_plot_drawable( App *app ) { @@ -68,11 +68,11 @@ plinit(); #if TO_PIXMAP == 1 - /* Here we set up to draw to a pixmap */ + // Here we set up to draw to a pixmap xinfo.display = GDK_PIXMAP_XDISPLAY( app->plotwindow_pixmap ); xinfo.drawable = GDK_PIXMAP_XID( app->plotwindow_pixmap ); #else - /* Alternatively, we can do direct to a visible X Window */ + // Alternatively, we can do direct to a visible X Window xinfo.display = GDK_WINDOW_XDISPLAY( app->plotwindow->window ); xinfo.drawable = GDK_WINDOW_XID( app->plotwindow->window ); #endif @@ -83,25 +83,25 @@ plline( 3, x, y ); plend(); } -/* ======================================================================== */ +// ======================================================================== static gint ev_plotwindow_conf( GtkWidget *widget, GdkEventConfigure *ev, gpointer *data ) { #if TO_PIXMAP == 1 - /* Allocate pixmap */ + // Allocate pixmap if ( app.plotwindow_pixmap ) gdk_pixmap_unref( app.plotwindow_pixmap ); app.plotwindow_pixmap = gdk_pixmap_new( widget->window, widget->allocation.width, widget->allocation.height, -1 ); - /* Clear the pixmap to a sensible background colour */ + // Clear the pixmap to a sensible background colour gdk_draw_rectangle( app.plotwindow_pixmap, widget->style->black_gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height ); - /* If drawing to a pixmap we can do a plot from the conf handler since - * the pixmap is now realised (the window widget isn't). - */ + // If drawing to a pixmap we can do a plot from the conf handler since + // the pixmap is now realised (the window widget isn't). + // setup_plot_drawable( &app ); #endif @@ -111,25 +111,25 @@ static gint ev_plotwindow_expose( GtkWidget *widget, GdkEventExpose *ev, gpointer *data ) { #if TO_PIXMAP == 1 - /* Dump the cached plot (created in the conf handler) to the window from - * the pixmap. We don't need to recreate the plot on each expose. - */ + // Dump the cached plot (created in the conf handler) to the window from + // the pixmap. We don't need to recreate the plot on each expose. + // gdk_draw_pixmap( widget->window, widget->style->fg_gc[GTK_WIDGET_STATE( widget )], app.plotwindow_pixmap, ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.width, ev->area.height ); #else - /* If drawing direct to an X Window, ensure GTK's double buffering - * is turned off for that window or else the plot will be overridden - * when the buffer is dumped to the screen. - */ + // If drawing direct to an X Window, ensure GTK's double buffering + // is turned off for that window or else the plot will be overridden + // when the buffer is dumped to the screen. + // setup_plot_drawable( &app ); #endif return ( TRUE ); } -/* ======================================================================== */ +// ======================================================================== void init_app( App *app ) { @@ -140,16 +140,16 @@ GtkWidget *vbox, *hbox; - /* Create the top-level root window */ + // Create the top-level root window app->rootwindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_signal_connect( GTK_OBJECT( app->rootwindow ), "delete_event", gtk_main_quit, NULL ); - /* A toplevel box to hold things */ + // A toplevel box to hold things vbox = gtk_vbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( app->rootwindow ), vbox ); - /* Construct the main menu structure */ + // Construct the main menu structure item_factory = gtk_item_factory_new( GTK_TYPE_MENU_BAR, "<main>", accel_group ); gtk_item_factory_create_items( item_factory, nitems, menu_items, NULL ); gtk_window_add_accel_group( GTK_WINDOW( app->rootwindow ), accel_group ); @@ -157,27 +157,27 @@ gtk_box_pack_start( GTK_BOX( vbox ), menubar, FALSE, FALSE, 0 ); gtk_widget_show( menubar ); - /* Fiddle with boxes to effect an indent from the edges of the root window */ + // Fiddle with boxes to effect an indent from the edges of the root window hbox = gtk_hbox_new( FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 10 ); vbox = gtk_vbox_new( FALSE, 10 ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 10 ); - /* Add an area to plot into */ + // Add an area to plot into app->plotwindow = gtk_drawing_area_new(); app->plotwindow_pixmap = NULL; #if TO_PIXMAP != 1 - /* Turn off double buffering if we are plotting direct to the plotwindow - * in setup_plot_drawable(). - */ + // Turn off double buffering if we are plotting direct to the plotwindow + // in setup_plot_drawable(). + // GTK_WIDGET_UNSET_FLAGS( app->plotwindow, GTK_DOUBLE_BUFFERED ); #endif - /* By experiment, 3x3 seems to be the smallest size plplot can cope with. - * Here we utilise the side effect that gtk_widget_set_size_request() - * effectively sets the minimum size of the widget. - */ + // By experiment, 3x3 seems to be the smallest size plplot can cope with. + // Here we utilise the side effect that gtk_widget_set_size_request() + // effectively sets the minimum size of the widget. + // gtk_widget_set_size_request( app->plotwindow, 3, 3 ); gtk_box_pack_start( GTK_BOX( vbox ), app->plotwindow, TRUE, TRUE, 0 ); @@ -191,7 +191,7 @@ gtk_widget_show_all( app->rootwindow ); } -/* ======================================================================== */ +// ======================================================================== int main( int argc, char *argv[] ) { @@ -200,4 +200,4 @@ gtk_main(); return 0; } -/* ======================================================================== */ +// ======================================================================== Modified: trunk/examples/c/plcdemos.h =================================================================== --- trunk/examples/c/plcdemos.h 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/plcdemos.h 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,8 +1,8 @@ -/* $Id$ - * - * Everything needed by the C demo programs. - * Created to avoid junking up plplot.h with this stuff. - */ +// $Id$ +// +// Everything needed by the C demo programs. +// Created to avoid junking up plplot.h with this stuff. +// #ifndef __PLCDEMOS_H__ #define __PLCDEMOS_H__ @@ -14,9 +14,9 @@ #include "plConfig.h" #include "plplot.h" -/* define PI if not defined by math.h */ +// define PI if not defined by math.h -/* Actually M_PI seems to be more widely used so we deprecate PI. */ +// Actually M_PI seems to be more widely used so we deprecate PI. #ifndef PI #define PI 3.1415926535897932384 #endif @@ -25,7 +25,7 @@ #define M_PI 3.1415926535897932384 #endif -/* various utility macros */ +// various utility macros #ifndef MAX #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) @@ -39,25 +39,25 @@ #define ROUND( a ) (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) ) #endif -/* Declarations for save string functions */ +// Declarations for save string functions #ifdef PL_HAVE_SNPRINTF -/* In case only _snprintf is declared (as for Visual C++ and - * Borland compiler toolset) we redefine the function names */ +// In case only _snprintf is declared (as for Visual C++ and +// Borland compiler toolset) we redefine the function names #ifdef _PL_HAVE_SNPRINTF #define snprintf _snprintf #define snscanf _snscanf - #endif /* _PL_HAVE_SNPRINTF */ -#else /* !PL_HAVE_SNPRINTF */ -/* declare dummy functions which just call the unsafe - * functions ignoring the size of the string */ + #endif // _PL_HAVE_SNPRINTF +#else // !PL_HAVE_SNPRINTF +// declare dummy functions which just call the unsafe +// functions ignoring the size of the string int plsnprintf( char *buffer, int n, const char *format, ... ); int plsnscanf( const char *buffer, int n, const char *format, ... ); #define snprintf plsnprintf #define snscanf plsnscanf -#endif /* PL_HAVE_SNPRINTF */ +#endif // PL_HAVE_SNPRINTF -/* Add in missing isnan definition if required */ +// Add in missing isnan definition if required #if defined ( PL__HAVE_ISNAN ) # define isnan _isnan # if defined ( _MSC_VER ) @@ -69,4 +69,4 @@ # define isnan( x ) ( ( x ) != ( x ) ) #endif -#endif /* __PLCDEMOS_H__ */ +#endif // __PLCDEMOS_H__ Modified: trunk/examples/c/plplotcanvas_animation.c =================================================================== --- trunk/examples/c/plplotcanvas_animation.c 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/plplotcanvas_animation.c 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,45 +1,45 @@ -/* - * animation.c - Demonstrates the use of the plplot canvas widget with gtk. - * - * Copyright (C) 2004, 2005 Thomas J. Duck - * All rights reserved. - * - * Thomas J. Duck <tom...@da...> - * Department of Physics and Atmospheric Science, - * Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 - * - * $Author$ - * $Revision$ - * $Date$ - * $Name$ - * - * - * NOTICE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * - * DESCRIPTION - * - * This program demonstrates the use of the plplot canvas widget with gtk. - * Two graphs are draw in a window. When the Execute button is pressed, - * two different waves progress through the graph in real time. Plotting - * to the two graphs is handled in two different threads. - * - */ +// +// animation.c - Demonstrates the use of the plplot canvas widget with gtk. +// +// Copyright (C) 2004, 2005 Thomas J. Duck +// All rights reserved. +// +// Thomas J. Duck <tom...@da...> +// Department of Physics and Atmospheric Science, +// Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 +// +// $Author$ +// $Revision$ +// $Date$ +// $Name$ +// +// +// NOTICE +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA +// +// +// DESCRIPTION +// +// This program demonstrates the use of the plplot canvas widget with gtk. +// Two graphs are draw in a window. When the Execute button is pressed, +// two different waves progress through the graph in real time. Plotting +// to the two graphs is handled in two different threads. +// +// #include <glib.h> #include <gtk/gtk.h> @@ -49,18 +49,18 @@ #include <math.h> -/* The number of time steps */ +// The number of time steps #define STEPS 300 -/* The number of points and period for the first wave */ +// The number of points and period for the first wave #define NPTS 100 #define PERIOD 30 -/* The width and height for each plot widget */ +// The width and height for each plot widget #define WIDTH 800 #define HEIGHT 300 -/* Run the plots in different threads */ +// Run the plots in different threads GThread* thread0 = NULL; GThread* thread1 = NULL; typedef struct @@ -69,76 +69,76 @@ char * title; } ThreadData; ThreadData data0, data1; -gint Nthreads = 0; /* Count the number of threads */ +gint Nthreads = 0; // Count the number of threads -/* Create two different canvases */ +// Create two different canvases PlplotCanvas *canvas0 = NULL; PlplotCanvas *canvas1 = NULL; -/* Create the x and y array */ +// Create the x and y array static PLFLT x[NPTS], y[NPTS]; -/* Lock on the gtkstate so that we don't try to plot after gtk_main_quit */ +// Lock on the gtkstate so that we don't try to plot after gtk_main_quit #define GTKSTATE_CONTINUE ( TRUE ) #define GTKSTATE_QUIT (FALSE) G_LOCK_DEFINE_STATIC( gtkstate ); static volatile int gtkstate = GTKSTATE_CONTINUE; -/* setup_plot - preparation for plotting an animation to a canvas */ +// setup_plot - preparation for plotting an animation to a canvas void setup_plot( PlplotCanvas *canvas, char* title ) { - /* Set up the viewport and window */ + // Set up the viewport and window plplot_canvas_vsta( canvas ); plplot_canvas_wind( canvas, x[0], x[NPTS - 1], -2., 2. ); - /* Set the pen width */ + // Set the pen width plplot_canvas_wid( canvas, 2 ); - /* The axes should be persistent, so that they don't have to be - * replotted every time (which would slow down the animation) - */ + // The axes should be persistent, so that they don't have to be + // replotted every time (which would slow down the animation) + // plplot_canvas_use_persistence( canvas, TRUE ); - /* Draw the axes */ + // Draw the axes plplot_canvas_col0( canvas, 15 ); plplot_canvas_box( canvas, "bcnst", 0., 0, "bcnstv", 0., 0 ); plplot_canvas_lab( canvas, "(x)", "(y)", title ); - /* Prepare for plotting */ + // Prepare for plotting plplot_canvas_col0( canvas, plplot_canvas_get_stream_number( canvas ) + 8 ); - /* The animated data should not be persistent */ + // The animated data should not be persistent plplot_canvas_use_persistence( canvas, FALSE ); } -/* plot - draws a plot on a canvas */ +// plot - draws a plot on a canvas void plot( PlplotCanvas *canvas, gdouble offset, char* title ) { int i; guint Nstream; gdouble xmin, xmax, ymin, ymax; - /* Get the stream number */ + // Get the stream number Nstream = plplot_canvas_get_stream_number( canvas ); - /* Generate the sinusoid */ + // Generate the sinusoid for ( i = 0; i < NPTS; i++ ) y[i] = sin( 2. * 3.14 * ( x[i] + offset * ( Nstream + 1 ) ) / PERIOD / (PLFLT) ( Nstream + 1 ) ); - /* Draw the line */ + // Draw the line plplot_canvas_line( canvas, NPTS, x, y ); - /* Advance the page to finalize the plot */ + // Advance the page to finalize the plot plplot_canvas_adv( canvas, 0 ); } -/* Delete event callback */ +// Delete event callback gint delete_event_local( GtkWidget *widget, GdkEvent *event, gpointer data ) { return FALSE; } -/* Destroy event calback */ +// Destroy event calback void destroy_local( GtkWidget *widget, gpointer data ) { G_LOCK( gtkstate ); @@ -154,15 +154,15 @@ Nthreads++; - /* Draw STEPS plots in succession */ + // Draw STEPS plots in succession for ( i = 0; i < STEPS; i++ ) { gdk_threads_enter(); - /* Lock the current gtk state */ + // Lock the current gtk state G_LOCK( gtkstate ); - /* Check to make sure gtk hasn't quit */ + // Check to make sure gtk hasn't quit if ( gtkstate == GTKSTATE_QUIT ) { G_UNLOCK( gtkstate ); @@ -170,10 +170,10 @@ g_thread_exit( NULL ); } - /* Draw the plot */ + // Draw the plot plot( data->canvas, i, data->title ); - /* Release the lock */ + // Release the lock G_UNLOCK( gtkstate ); gdk_threads_leave(); } @@ -182,16 +182,16 @@ g_thread_exit( NULL ); } -/* Start threads callback from execute button */ +// Start threads callback from execute button void start_threads( GtkWidget *widget, gpointer data ) { GError **gerror; - /* Ignore call if threads are currently active */ + // Ignore call if threads are currently active if ( Nthreads ) return; - /* Create the two plotting threads */ + // Create the two plotting threads data0.canvas = canvas0; data0.title = "A phase-progressing wave"; if ( ( thread0 = g_thread_create( (GThreadFunc) plot_thread, &data0, TRUE, gerror ) ) \ @@ -226,44 +226,44 @@ GtkBox * vbox; - /* Parse the options */ + // Parse the options plparseopts( &argc, (const char **) argv, PL_PARSE_FULL ); - /* Initialize */ + // Initialize g_thread_init( NULL ); gdk_threads_init(); gtk_init( &argc, &argv ); g_type_init(); - /* Initialize the x array */ + // Initialize the x array for ( i = 0; i < NPTS; i++ ) x[i] = (PLFLT) i; - /* Create the first canvas, set its size, draw some axes on it, and - * place it in a frame - */ + // Create the first canvas, set its size, draw some axes on it, and + // place it in a frame + // canvas0 = plplot_canvas_new( TRUE ); plplot_canvas_set_size( canvas0, WIDTH, HEIGHT ); plplot_canvas_adv( canvas0, 0 ); setup_plot( canvas0, "A phase-progressing wave" ); - plplot_canvas_adv( canvas0, 0 ); /* Advance the page to finalize the plot */ + plplot_canvas_adv( canvas0, 0 ); // Advance the page to finalize the plot canvas0frame = GTK_FRAME( gtk_frame_new( NULL ) ); gtk_frame_set_shadow_type( canvas0frame, GTK_SHADOW_ETCHED_OUT ); gtk_container_add( GTK_CONTAINER( canvas0frame ), GTK_WIDGET( canvas0 ) ); - /* Create the second canvas, set its size, draw some axes on it, and - * place it in a frame - */ + // Create the second canvas, set its size, draw some axes on it, and + // place it in a frame + // canvas1 = plplot_canvas_new( TRUE ); plplot_canvas_set_size( canvas1, WIDTH, HEIGHT ); plplot_canvas_adv( canvas1, 0 ); setup_plot( canvas1, "Another phase-progressing wave" ); - plplot_canvas_adv( canvas1, 0 ); /* Advance the page to finalize the plot */ + plplot_canvas_adv( canvas1, 0 ); // Advance the page to finalize the plot canvas1frame = GTK_FRAME( gtk_frame_new( NULL ) ); gtk_frame_set_shadow_type( canvas1frame, GTK_SHADOW_ETCHED_OUT ); gtk_container_add( GTK_CONTAINER( canvas1frame ), GTK_WIDGET( canvas1 ) ); - /* Create a button and put it in a box */ + // Create a button and put it in a box button = GTK_BUTTON( gtk_button_new_from_stock( GTK_STOCK_EXECUTE ) ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( start_threads ), NULL ); @@ -271,30 +271,30 @@ buttonbox = GTK_BOX( gtk_hbox_new( FALSE, 0 ) ); gtk_box_pack_start( buttonbox, GTK_WIDGET( button ), TRUE, FALSE, 0 ); - /* Create and fill the vbox with the widgets */ + // Create and fill the vbox with the widgets vbox = GTK_BOX( gtk_vbox_new( FALSE, 0 ) ); gtk_box_pack_start( vbox, GTK_WIDGET( canvas0frame ), TRUE, FALSE, 0 ); gtk_box_pack_start( vbox, GTK_WIDGET( canvas1frame ), TRUE, FALSE, 10 ); gtk_box_pack_start( vbox, GTK_WIDGET( buttonbox ), TRUE, FALSE, 0 ); - /* Create a new window */ + // Create a new window window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - /* Set the border width of the window */ + // Set the border width of the window gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); - /* Connect the signal handlers to the window decorations */ + // Connect the signal handlers to the window decorations g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event_local ), NULL ); g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy_local ), NULL ); - /* Put the vbox into the window */ + // Put the vbox into the window gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) ); - /* Display everything */ + // Display everything gtk_widget_show_all( window ); - /* Start the gtk main loop */ + // Start the gtk main loop gdk_threads_enter(); gtk_main(); gdk_threads_leave(); Modified: trunk/examples/c/plplotcanvas_demo.c =================================================================== --- trunk/examples/c/plplotcanvas_demo.c 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/plplotcanvas_demo.c 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,51 +1,51 @@ -/* - * demo.c - Demonstrates the simplest use of the plplot canvas widget with gtk. - * - * Copyright (C) 2004, 2005 Thomas J. Duck - * All rights reserved. - * - * Thomas J. Duck <tom...@da...> - * Department of Physics and Atmospheric Science, - * Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 - * - * $Author$ - * $Revision$ - * $Date$ - * $Name$ - * - * - * NOTICE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ +// +// demo.c - Demonstrates the simplest use of the plplot canvas widget with gtk. +// +// Copyright (C) 2004, 2005 Thomas J. Duck +// All rights reserved. +// +// Thomas J. Duck <tom...@da...> +// Department of Physics and Atmospheric Science, +// Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 +// +// $Author$ +// $Revision$ +// $Date$ +// $Name$ +// +// +// NOTICE +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA +// #include <plplotcanvas.h> #include <gtk/gtk.h> -/* The width and height of the plplot canvas widget */ -#define WIDTH 1000 /* 500 */ -#define HEIGHT 600 /* 300 */ +// The width and height of the plplot canvas widget +#define WIDTH 1000 // 500 +#define HEIGHT 600 // 300 -/* Delete event callback */ +// Delete event callback gint delete_event_local( GtkWidget *widget, GdkEvent *event, gpointer data ) { return FALSE; } -/* Destroy event calback */ +// Destroy event calback void destroy_local( GtkWidget *widget, gpointer data ) { gtk_main_quit(); @@ -57,53 +57,53 @@ PlplotCanvas* canvas; GtkWidget *window; - /* Parse the options */ + // Parse the options plparseopts( &argc, (const char **) argv, PL_PARSE_FULL ); - /* The data to plot */ + // The data to plot double x[11] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; double y[11] = { 0, 0.1, 0.4, 0.9, 1.6, 2.6, 3.6, 4.9, 6.4, 8.1, 10 }; - /* Initialize gtk and the glib type system */ + // Initialize gtk and the glib type system gtk_init( &argc, &argv ); g_type_init(); - /* Create the canvas and set its size; during the creation process, - * the gcw driver is loaded into plplot, and plinit() is invoked. - */ + // Create the canvas and set its size; during the creation process, + // the gcw driver is loaded into plplot, and plinit() is invoked. + // canvas = plplot_canvas_new( TRUE ); plplot_canvas_set_size( canvas, WIDTH, HEIGHT ); - /* Create a new window and stuff the canvas into it */ + // Create a new window and stuff the canvas into it window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( canvas ) ); - /* Connect the signal handlers to the window decorations */ + // Connect the signal handlers to the window decorations g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event_local ), NULL ); g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy_local ), NULL ); - /* Display everything */ + // Display everything gtk_widget_show_all( window ); - /* Draw on the canvas with Plplot */ - plplot_canvas_adv( canvas, 0 ); /* Advance to first page */ - plplot_canvas_col0( canvas, 15 ); /* Set color to black */ - plplot_canvas_wid( canvas, 2 ); /* Set the pen width */ - plplot_canvas_vsta( canvas ); /* Set the viewport */ - plplot_canvas_wind( canvas, 0., 10., 0., 10. ); /* Set the window */ - plplot_canvas_box( canvas, "bcnst", 0., 0, "bcnstv", 0., 0 ); /* Set the box */ - plplot_canvas_lab( canvas, "x-axis", "y-axis", "A Simple Plot" ); /* Draw some labels */ + // Draw on the canvas with Plplot + plplot_canvas_adv( canvas, 0 ); // Advance to first page + plplot_canvas_col0( canvas, 15 ); // Set color to black + plplot_canvas_wid( canvas, 2 ); // Set the pen width + plplot_canvas_vsta( canvas ); // Set the viewport + plplot_canvas_wind( canvas, 0., 10., 0., 10. ); // Set the window + plplot_canvas_box( canvas, "bcnst", 0., 0, "bcnstv", 0., 0 ); // Set the box + plplot_canvas_lab( canvas, "x-axis", "y-axis", "A Simple Plot" ); // Draw some labels - /* Draw the line */ - plplot_canvas_col0( canvas, 1 ); /* Set the pen color */ + // Draw the line + plplot_canvas_col0( canvas, 1 ); // Set the pen color plplot_canvas_line( canvas, 11, x, y ); - /* Advancing the page finalizes this plot */ + // Advancing the page finalizes this plot plplot_canvas_adv( canvas, 0 ); - /* Start the gtk main loop */ + // Start the gtk main loop gtk_main(); return 0; } Modified: trunk/examples/c/test_plend.c =================================================================== --- trunk/examples/c/test_plend.c 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/test_plend.c 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,24 +1,24 @@ -/* $Id$ - * - * plend and plend1 testing demo. - */ +// $Id$ +// +// plend and plend1 testing demo. +// #include "plcdemos.h" -/*--------------------------------------------------------------------------*\ - * main - * - * Demonstrates absolute positioning of graphs on a page. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// main +// +// Demonstrates absolute positioning of graphs on a page. +//-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { -/* Parse and process command line arguments */ +// Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); -/* Initialize plplot */ +// Initialize plplot plinit(); plenv( 0., 1., 0., 1., 1, 0 ); Modified: trunk/examples/c/tutor.c =================================================================== --- trunk/examples/c/tutor.c 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/tutor.c 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,75 +1,75 @@ -/* $Id$ - * - * Tony Richardson - * - * This program is intended to be used as a template for creating simple - * two-dimensional plotting programs which use the PLplot plotting - * library. The program was written with an emphasis on trying to clearly - * illustrate how to use the PLplot library functions. - * - * This program reads data for M lines with N points each from an input - * data file and plots them on the same graph using different symbols. It - * draws axes with labels and places a title at the top of the figure. A - * legend is drawn to the right of the figure. The input data file must - * have the following format: - * - * M N - * x[1] y[1][1] y[1][2] . . . y[1][M] - * x[2] y[2][1] y[2][2] . . . y[2][M] - * x[3] y[3][1] y[3][2] . . . y[3][M] - * . . . . . . . - * . . . . . . . - * . . . . . . . - * x[N] y[N][1] y[N][2] . . . y[N][M] - * - * (The first line contains the integer values M and N. The succeeding - * N lines contain the x-coordinate and the corresponding y-coordinates - * of each of the M lines.) - */ +// $Id$ +// +// Tony Richardson +// +// This program is intended to be used as a template for creating simple +// two-dimensional plotting programs which use the PLplot plotting +// library. The program was written with an emphasis on trying to clearly +// illustrate how to use the PLplot library functions. +// +// This program reads data for M lines with N points each from an input +// data file and plots them on the same graph using different symbols. It +// draws axes with labels and places a title at the top of the figure. A +// legend is drawn to the right of the figure. The input data file must +// have the following format: +// +// M N +// x[1] y[1][1] y[1][2] . . . y[1][M] +// x[2] y[2][1] y[2][2] . . . y[2][M] +// x[3] y[3][1] y[3][2] . . . y[3][M] +// . . . . . . . +// . . . . . . . +// . . . . . . . +// x[N] y[N][1] y[N][2] . . . y[N][M] +// +// (The first line contains the integer values M and N. The succeeding +// N lines contain the x-coordinate and the corresponding y-coordinates +// of each of the M lines.) +// #include "plcdemos.h" static int error( char *str ); -/* - * You can select a different set of symbols to use when plotting the - * lines by changing the value of OFFSET. - */ +// +// You can select a different set of symbols to use when plotting the +// lines by changing the value of OFFSET. +// #define OFFSET 2 int main( int argc, char *argv[] ) { -/* ============== Begin variable definition section. ============= */ +// ============== Begin variable definition section. ============= -/* - * i, j, and k are counting variables used in loops and such. M is the - * number of lines to be plotted and N is the number of sample points - * for each line. - */ +// +// i, j, and k are counting variables used in loops and such. M is the +// number of lines to be plotted and N is the number of sample points +// for each line. +// int i, j, k, M, N, leglen; -/* - * x is a pointer to an array containing the N x-coordinate values. y - * points to an array of M pointers each of which points to an array - * containing the N y-coordinate values for that line. - */ +// +// x is a pointer to an array containing the N x-coordinate values. y +// points to an array of M pointers each of which points to an array +// containing the N y-coordinate values for that line. +// PLFLT *x, **y; -/* Define storage for the min and max values of the data. */ +// Define storage for the min and max values of the data. PLFLT xmin, xmax, ymin, ymax, xdiff, ydiff; -/* Define storage for the filename and define the input file pointer. */ +// Define storage for the filename and define the input file pointer. char filename[80], string[80], tmpstr[80]; FILE *datafile; -/* Here are the character strings that appear in the plot legend. */ +// Here are the character strings that appear in the plot legend. static char *legend[] = { @@ -77,32 +77,32 @@ "Gnus", "Llamas", NULL - }; /* Make sure last element is NULL */ + }; // Make sure last element is NULL -/* ============== Read in data from input file. ============= */ +// ============== Read in data from input file. ============= -/* Parse and process command line arguments */ +// Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); -/* First prompt the user for the input data file name */ +// First prompt the user for the input data file name printf( "Enter input data file name. " ); scanf( "%s", filename ); -/* and open the file. */ +// and open the file. datafile = fopen( filename, "r" ); - if ( datafile == NULL ) /* error opening input file */ + if ( datafile == NULL ) // error opening input file error( "Error opening input file." ); -/* Read in values of M and N */ +// Read in values of M and N k = fscanf( datafile, "%d %d", &M, &N ); - if ( k != 2 ) /* something's wrong */ + if ( k != 2 ) // something's wrong error( "Error while reading data file." ); -/* Allocate memory for all the arrays. */ +// Allocate memory for all the arrays. x = (PLFLT *) malloc( N * sizeof ( PLFLT ) ); if ( x == NULL ) @@ -117,14 +117,14 @@ error( "Out of memory!" ); } -/* Now read in all the data. */ +// Now read in all the data. - for ( i = 0; i < N; i++ ) /* N points */ + for ( i = 0; i < N; i++ ) // N points { k = fscanf( datafile, "%f", &x[i] ); if ( k != 1 ) error( "Error while reading data file." ); - for ( j = 0; j < M; j++ ) /* M lines */ + for ( j = 0; j < M; j++ ) // M lines { k = fscanf( datafile, "%f", &y[j][i] ); if ( k != 1 ) @@ -132,43 +132,43 @@ } } -/* ============== Graph the data. ============= */ +// ============== Graph the data. ============= -/* Set graph to portrait orientation. (Default is landscape.) */ -/* (Portrait is usually desired for inclusion in TeX documents.) */ +// Set graph to portrait orientation. (Default is landscape.) +// (Portrait is usually desired for inclusion in TeX documents.) plsori( 1 ); -/* Initialize plplot */ +// Initialize plplot plinit(); -/* - * We must call pladv() to advance to the first (and only) subpage. - * You might want to use plenv() instead of the pladv(), plvpor(), - * plwind() sequence. - */ +// +// We must call pladv() to advance to the first (and only) subpage. +// You might want to use plenv() instead of the pladv(), plvpor(), +// plwind() sequence. +// pladv( 0 ); -/* - * Set up the viewport. This is the window into which the data is - * plotted. The size of the window can be set with a call to - * plvpor(), which sets the size in terms of normalized subpage - * coordinates. I want to plot the lines on the upper half of the - * page and I want to leave room to the right of the figure for - * labelling the lines. We must also leave room for the title and - * labels with plvpor(). Normally a call to plvsta() can be used - * instead. - */ +// +// Set up the viewport. This is the window into which the data is +// plotted. The size of the window can be set with a call to +// plvpor(), which sets the size in terms of normalized subpage +// coordinates. I want to plot the lines on the upper half of the +// page and I want to leave room to the right of the figure for +// labelling the lines. We must also leave room for the title and +// labels with plvpor(). Normally a call to plvsta() can be used +// instead. +// plvpor( 0.15, 0.70, 0.5, 0.9 ); -/* - * We now need to define the size of the window in user coordinates. - * To do this, we first need to determine the range of the data - * values. - */ +// +// We now need to define the size of the window in user coordinates. +// To do this, we first need to determine the range of the data +// values. +// xmin = xmax = x[0]; ymin = ymax = y[0][0]; @@ -187,34 +187,34 @@ } } -/* - * Now set the size of the window. Leave a small border around the - * data. - */ +// +// Now set the size of the window. Leave a small border around the +// data. +// xdiff = ( xmax - xmin ) / 20.; ydiff = ( ymax - ymin ) / 20.; plwind( xmin - xdiff, xmax + xdiff, ymin - ydiff, ymax + ydiff ); -/* - * Call plbox() to draw the axes (see the PLPLOT manual for - * information about the option strings.) - */ +// +// Call plbox() to draw the axes (see the PLPLOT manual for +// information about the option strings.) +// plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); -/* - * Label the axes and title the graph. The string "#gm" plots the - * Greek letter mu, all the Greek letters are available, see the - * PLplot manual. - */ +// +// Label the axes and title the graph. The string "#gm" plots the +// Greek letter mu, all the Greek letters are available, see the +// PLplot manual. +// pllab( "Time (weeks)", "Height (#gmparsecs)", "Specimen Growth Rate" ); -/* - * Plot the data. plpoin() draws a symbol at each point. plline() - * connects all the points. - */ +// +// Plot the data. plpoin() draws a symbol at each point. plline() +// connects all the points. +// for ( i = 0; i < M; i++ ) { @@ -222,11 +222,11 @@ plline( N, x, y[i] ); } -/* - * Draw legend to the right of the chart. Things get a little messy - * here. You may want to remove this section if you don't want a - * legend drawn. First find length of longest string. - */ +// +// Draw legend to the right of the chart. Things get a little messy +// here. You may want to remove this section if you don't want a +// legend drawn. First find length of longest string. +// leglen = 0; for ( i = 0; i < M; i++ ) @@ -238,11 +238,11 @@ leglen = j; } -/* - * Now build the string. The string consists of an element from the - * legend string array, padded with spaces, followed by one of the - * symbols used in plpoin above. - */ +// +// Now build the string. The string consists of an element from the +// legend string array, padded with spaces, followed by one of the +// symbols used in plpoin above. +// for ( i = 0; i < M; i++ ) { @@ -250,33 +250,33 @@ break; strcpy( string, legend[i] ); j = strlen( string ); - if ( j < leglen ) /* pad string with spaces */ + if ( j < leglen ) // pad string with spaces { for ( k = j; k < leglen; k++ ) string[k] = ' '; string[k] = '\0'; } - /* pad an extra space */ + // pad an extra space strcat( string, " " ); j = strlen( string ); - /* insert the ASCII value of the symbol plotted with plpoin() */ + // insert the ASCII value of the symbol plotted with plpoin() string[j] = i + OFFSET; string[j + 1] = '\0'; - /* plot the string */ + // plot the string plmtex( "rv", 1., 1. - (double) ( i + 1 ) / ( M + 1 ), 0., string ); } -/* Tell plplot we are done with this page. */ +// Tell plplot we are done with this page. - pladv( 0 ); /* advance page */ + pladv( 0 ); // advance page -/* Don't forget to call plend() to finish off! */ +// Don't forget to call plend() to finish off! plend(); exit( 0 ); Modified: trunk/examples/c/x01c.c =================================================================== --- trunk/examples/c/x01c.c 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/x01c.c 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,26 +1,26 @@ -/* $Id$ - * - * Simple line plot and multiple windows demo. - * - * Copyright (C) 2004 Rafael Laboissiere - * - * This file is part of PLplot. - * - * PLplot is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Library Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * PLplot is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with PLplot; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ +// $Id$ +// +// Simple line plot and multiple windows demo. +// +// Copyright (C) 2004 Rafael Laboissiere +// +// This file is part of PLplot. +// +// PLplot is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Library Public License as published +// by the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// PLplot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with PLplot; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// #include "plcdemos.h" #include "plevent.h" @@ -28,7 +28,7 @@ # include <unistd.h> #endif -/* Variables and data arrays used by plot generators */ +// Variables and data arrays used by plot generators static PLFLT x[101], y[101]; static PLFLT xscale, yscale, xoff, yoff, xs[6], ys[6]; @@ -39,11 +39,11 @@ static int fontset = 1; static char *f_name = NULL; -/* Options data structure definition. */ +// Options data structure definition. static PLOptionTable options[] = { { - "locate", /* Turns on test of API locate function */ + "locate", // Turns on test of API locate function NULL, NULL, &locate_mode, @@ -52,7 +52,7 @@ "Turns on test of API locate function" }, { - "xor", /* Turns on test of xor function */ + "xor", // Turns on test of xor function NULL, NULL, &test_xor, @@ -61,7 +61,7 @@ "Turns on test of XOR" }, { - "font", /* For switching between font set 1 & 2 */ + "font", // For switching between font set 1 & 2 NULL, NULL, &fontset, @@ -70,7 +70,7 @@ "Selects stroke font set (0 or 1, def:1)" }, { - "save", /* For saving in postscript */ + "save", // For saving in postscript NULL, NULL, &f_name, @@ -79,35 +79,35 @@ "Save plot in color postscript `file'" }, { - NULL, /* option */ - NULL, /* handler */ - NULL, /* client data */ - NULL, /* address of variable to set */ - 0, /* mode flag */ - NULL, /* short syntax */ + NULL, // option + NULL, // handler + NULL, // client data + NULL, // address of variable to set + 0, // mode flag + NULL, // short syntax NULL - } /* long syntax */ + } // long syntax }; const char *notes[] = { "Make sure you get it right!", NULL }; -/* Function prototypes */ +// Function prototypes void plot1( int ); void plot2( void ); void plot3( void ); -/*--------------------------------------------------------------------------*\ - * main - * - * Generates several simple line plots. Demonstrates: - * - subwindow capability - * - setting up the window, drawing plot, and labelling - * - changing the color - * - automatic axis rescaling to exponential notation - * - placing the axes in the middle of the box - * - gridded coordinate axes - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// main +// +// Generates several simple line plots. Demonstrates: +// - subwindow capability +// - setting up the window, drawing plot, and labelling +// - changing the color +// - automatic axis rescaling to exponential notation +// - placing the axes in the middle of the box +// - gridded coordinate axes +//-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) @@ -115,49 +115,49 @@ PLINT digmax, cur_strm, new_strm; char ver[80]; -/* plplot initialization */ +// plplot initialization -/* Parse and process command line arguments */ +// Parse and process command line arguments plMergeOpts( options, "x01c options", notes ); plparseopts( &argc, argv, PL_PARSE_FULL ); -/* Get version number, just for kicks */ +// Get version number, just for kicks plgver( ver ); fprintf( stdout, "PLplot library version: %s\n", ver ); -/* Initialize plplot */ -/* Divide page into 2x2 plots */ -/* Note: calling plstar replaces separate calls to plssub and plinit */ +// Initialize plplot +// Divide page into 2x2 plots +// Note: calling plstar replaces separate calls to plssub and plinit plstar( 2, 2 ); -/* Select font set as per input flag */ +// Select font set as per input flag if ( fontset ) plfontld( 1 ); else plfontld( 0 ); -/* Set up the data */ -/* Original case */ +// Set up the data +// Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; -/* Do a plot */ +// Do a plot plot1( 0 ); -/* Set up the data */ +// Set up the data xscale = 1.; yscale = 0.0014; yoff = 0.0185; -/* Do a plot */ +// Do a plot digmax = 5; plsyax( digmax, 0 ); @@ -168,30 +168,30 @@ plot3(); - /* - * Show how to save a plot: - * Open a new device, make it current, copy parameters, - * and replay the plot buffer - */ + // + // Show how to save a plot: + // Open a new device, make it current, copy parameters, + // and replay the plot buffer + // - if ( f_name ) /* command line option '-save filename' */ + if ( f_name ) // command line option '-save filename' { printf( "The current plot was saved in color Postscript under the name `%s'.\n", f_name ); - plgstrm( &cur_strm ); /* get current stream */ - plmkstrm( &new_strm ); /* create a new one */ + plgstrm( &cur_strm ); // get current stream + plmkstrm( &new_strm ); // create a new one - plsfnam( f_name ); /* file name */ - plsdev( "psc" ); /* device type */ + plsfnam( f_name ); // file name + plsdev( "psc" ); // device type - plcpstrm( cur_strm, 0 ); /* copy old stream parameters to new stream */ - plreplot(); /* do the save by replaying the plot buffer */ - plend1(); /* finish the device */ + plcpstrm( cur_strm, 0 ); // copy old stream parameters to new stream + plreplot(); // do the save by replaying the plot buffer + plend1(); // finish the device - plsstrm( cur_strm ); /* return to previous stream */ + plsstrm( cur_strm ); // return to previous stream } -/* Let's get some user input */ +// Let's get some user input if ( locate_mode ) { @@ -214,13 +214,13 @@ } } -/* Don't forget to call plend() to finish off! */ +// Don't forget to call plend() to finish off! plend(); exit( 0 ); } -/* =============================================================== */ +// =============================================================== void plot1( int do_test ) @@ -245,44 +245,44 @@ ys[i] = y[i * 10 + 3]; } -/* Set up the viewport and window using PLENV. The range in X is - * 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are - * scaled separately (just = 0), and we just draw a labelled - * box (axis = 0). - */ +// Set up the viewport and window using PLENV. The range in X is +// 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are +// scaled separately (just = 0), and we just draw a labelled +// box (axis = 0). +// plcol0( 1 ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); plcol0( 2 ); pllab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); -/* Plot the data points */ +// Plot the data points plcol0( 4 ); plpoin( 6, xs, ys, 9 ); -/* Draw the line through the data */ +// Draw the line through the data plcol0( 3 ); plline( 60, x, y ); -/* xor mode enable erasing a line/point/text by replotting it again */ -/* it does not work in double buffering mode, however */ +// xor mode enable erasing a line/point/text by replotting it again +// it does not work in double buffering mode, however if ( do_test && test_xor ) { #ifdef PL_HAVE_USLEEP PLINT st; - plxormod( 1, &st ); /* enter xor mode */ + plxormod( 1, &st ); // enter xor mode if ( st ) { for ( i = 0; i < 60; i++ ) { - plpoin( 1, x + i, y + i, 9 ); /* draw a point */ - usleep( 50000 ); /* wait a little */ - plflush(); /* force an update of the tk driver */ - plpoin( 1, x + i, y + i, 9 ); /* erase point */ + plpoin( 1, x + i, y + i, 9 ); // draw a point + usleep( 50000 ); // wait a little + plflush(); // force an update of the tk driver + plpoin( 1, x + i, y + i, 9 ); // erase point } - plxormod( 0, &st ); /* leave xor mode */ + plxormod( 0, &st ); // leave xor mode } #else printf( "The -xor command line option can only be exercised if your " @@ -291,23 +291,23 @@ } } -/* =============================================================== */ +// =============================================================== void plot2( void ) { int i; -/* Set up the viewport and window using PLENV. The range in X is -2.0 to - * 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately - * (just = 0), and we draw a box with axes (axis = 1). - */ +// Set up the viewport and window using PLENV. The range in X is -2.0 to +// 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately +// (just = 0), and we draw a box with axes (axis = 1). +// plcol0( 1 ); plenv( -2.0, 10.0, -0.4, 1.2, 0, 1 ); plcol0( 2 ); pllab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); -/* Fill up the arrays */ +// Fill up the arrays for ( i = 0; i < 100; i++ ) { @@ -317,7 +317,7 @@ y[i] = sin( x[i] ) / x[i]; } -/* Draw the line */ +// Draw the line plcol0( 3 ); plwid( 2 ); @@ -325,7 +325,7 @@ plwid( 1 ); } -/* =============================================================== */ +// =============================================================== void plot3( void ) @@ -333,25 +333,25 @@ PLINT space0 = 0, mark0 = 0, space1 = 1500, mark1 = 1500; int i; -/* For the final graph we wish to override the default tick intervals, and - * so do not use plenv(). - */ +// For the final graph we wish to override the default tick intervals, and +// so do not use plenv(). +// pladv( 0 ); -/* Use standard viewport, and define X range from 0 to 360 degrees, Y range - * from -1.2 to 1.2. - */ +// Use standard viewport, and define X range from 0 to 360 degrees, Y range +// from -1.2 to 1.2. +// plvsta(); plwind( 0.0, 360.0, -1.2, 1.2 ); -/* Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. */ +// Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0( 1 ); plbox( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); -/* Superimpose a dashed line grid, with 1.5 mm marks and spaces. - * plstyl expects a pointer! - */ +// Superimpose a dashed line grid, with 1.5 mm marks and spaces. +// plstyl expects a pointer! +// plstyl( 1, &mark1, &space1 ); plcol0( 2 ); plbox( "g", 30.0, 0, "g", 0.2, 0 ); Modified: trunk/examples/c/x02c.c =================================================================== --- trunk/examples/c/x02c.c 2010-10-29 20:39:57 UTC (rev 11288) +++ trunk/examples/c/x02c.c 2010-10-29 20:44:17 UTC (rev 11289) @@ -1,16 +1,16 @@ -/* $Id$ - * - * Multiple window and color map 0 demo. - */ +// $Id$ +// +// Multiple window and color map 0 demo. +// #include "plcdemos.h" -/*--------------------------------------------------------------------------*\ - * main - * - * Demonstrates multiple windows and color map 0 palette, both default and - * user-modified. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// main +// +// Demonstrates multiple windows and color map 0 palette, both default and +// user-modified. +//-------------------------------------------------------------------------- void demo1(); void demo2(); @@ -19,13 +... [truncated message content] |