From: <ai...@us...> - 2010-07-23 05:20:26
|
Revision: 11099 http://plplot.svn.sourceforge.net/plplot/?rev=11099&view=rev Author: airwin Date: 2010-07-23 05:20:18 +0000 (Fri, 23 Jul 2010) Log Message: ----------- Previous commit by Jerry removed all configurable items from Ada examples source files so that the configure of those source files got turned into a copy. Strip out this configure=copy for the Ada examples source files and adjust the Ada examples build accordingly for the changed directory for the examples source. N.B. the result passes the "make test_noninteractive" test for the build tree, and that same test for the installed examples with both the traditional Makefile+pkg-config approach for building and testing those examples as well as the more modern CMake-based approach for building and testing those examples. So all seems well for all builds and tests of the Ada bindings and examples with the new non-configured approach. N.B. One further known change is planned for the website generation to adjust for the new location of the Ada source files (in the source tree rather than configured files in the build tree). Modified Paths: -------------- trunk/examples/ada/CMakeLists.txt Added Paths: ----------- trunk/examples/ada/x01a.adb trunk/examples/ada/x02a.adb trunk/examples/ada/x03a.adb trunk/examples/ada/x04a.adb trunk/examples/ada/x05a.adb trunk/examples/ada/x06a.adb trunk/examples/ada/x07a.adb trunk/examples/ada/x08a.adb trunk/examples/ada/x09a.adb trunk/examples/ada/x10a.adb trunk/examples/ada/x11a.adb trunk/examples/ada/x12a.adb trunk/examples/ada/x13a.adb trunk/examples/ada/x14a.adb trunk/examples/ada/x15a.adb trunk/examples/ada/x16a.adb trunk/examples/ada/x17a.adb trunk/examples/ada/x18a.adb trunk/examples/ada/x19a.adb trunk/examples/ada/x20a.adb trunk/examples/ada/x21a.adb trunk/examples/ada/x22a.adb trunk/examples/ada/x23a.adb trunk/examples/ada/x24a.adb trunk/examples/ada/x25a.adb trunk/examples/ada/x26a.adb trunk/examples/ada/x27a.adb trunk/examples/ada/x28a.adb trunk/examples/ada/x29a.adb trunk/examples/ada/x30a.adb trunk/examples/ada/x31a.adb trunk/examples/ada/xthick01a.adb trunk/examples/ada/xthick02a.adb trunk/examples/ada/xthick03a.adb trunk/examples/ada/xthick04a.adb trunk/examples/ada/xthick05a.adb trunk/examples/ada/xthick06a.adb trunk/examples/ada/xthick07a.adb trunk/examples/ada/xthick08a.adb trunk/examples/ada/xthick09a.adb trunk/examples/ada/xthick10a.adb trunk/examples/ada/xthick11a.adb trunk/examples/ada/xthick12a.adb trunk/examples/ada/xthick13a.adb trunk/examples/ada/xthick14a.adb trunk/examples/ada/xthick15a.adb trunk/examples/ada/xthick16a.adb trunk/examples/ada/xthick17a.adb trunk/examples/ada/xthick18a.adb trunk/examples/ada/xthick19a.adb trunk/examples/ada/xthick20a.adb trunk/examples/ada/xthick21a.adb trunk/examples/ada/xthick22a.adb trunk/examples/ada/xthick23a.adb trunk/examples/ada/xthick24a.adb trunk/examples/ada/xthick25a.adb trunk/examples/ada/xthick26a.adb trunk/examples/ada/xthick27a.adb trunk/examples/ada/xthick28a.adb trunk/examples/ada/xthick29a.adb trunk/examples/ada/xthick30a.adb trunk/examples/ada/xthick31a.adb Removed Paths: ------------- trunk/examples/ada/x01a.adb.cmake trunk/examples/ada/x02a.adb.cmake trunk/examples/ada/x03a.adb.cmake trunk/examples/ada/x04a.adb.cmake trunk/examples/ada/x05a.adb.cmake trunk/examples/ada/x06a.adb.cmake trunk/examples/ada/x07a.adb.cmake trunk/examples/ada/x08a.adb.cmake trunk/examples/ada/x09a.adb.cmake trunk/examples/ada/x10a.adb.cmake trunk/examples/ada/x11a.adb.cmake trunk/examples/ada/x12a.adb.cmake trunk/examples/ada/x13a.adb.cmake trunk/examples/ada/x14a.adb.cmake trunk/examples/ada/x15a.adb.cmake trunk/examples/ada/x16a.adb.cmake trunk/examples/ada/x17a.adb.cmake trunk/examples/ada/x18a.adb.cmake trunk/examples/ada/x19a.adb.cmake trunk/examples/ada/x20a.adb.cmake trunk/examples/ada/x21a.adb.cmake trunk/examples/ada/x22a.adb.cmake trunk/examples/ada/x23a.adb.cmake trunk/examples/ada/x24a.adb.cmake trunk/examples/ada/x25a.adb.cmake trunk/examples/ada/x26a.adb.cmake trunk/examples/ada/x27a.adb.cmake trunk/examples/ada/x28a.adb.cmake trunk/examples/ada/x29a.adb.cmake trunk/examples/ada/x30a.adb.cmake trunk/examples/ada/x31a.adb.cmake trunk/examples/ada/xthick01a.adb.cmake trunk/examples/ada/xthick02a.adb.cmake trunk/examples/ada/xthick03a.adb.cmake trunk/examples/ada/xthick04a.adb.cmake trunk/examples/ada/xthick05a.adb.cmake trunk/examples/ada/xthick06a.adb.cmake trunk/examples/ada/xthick07a.adb.cmake trunk/examples/ada/xthick08a.adb.cmake trunk/examples/ada/xthick09a.adb.cmake trunk/examples/ada/xthick10a.adb.cmake trunk/examples/ada/xthick11a.adb.cmake trunk/examples/ada/xthick12a.adb.cmake trunk/examples/ada/xthick13a.adb.cmake trunk/examples/ada/xthick14a.adb.cmake trunk/examples/ada/xthick15a.adb.cmake trunk/examples/ada/xthick16a.adb.cmake trunk/examples/ada/xthick17a.adb.cmake trunk/examples/ada/xthick18a.adb.cmake trunk/examples/ada/xthick19a.adb.cmake trunk/examples/ada/xthick20a.adb.cmake trunk/examples/ada/xthick21a.adb.cmake trunk/examples/ada/xthick22a.adb.cmake trunk/examples/ada/xthick23a.adb.cmake trunk/examples/ada/xthick24a.adb.cmake trunk/examples/ada/xthick25a.adb.cmake trunk/examples/ada/xthick26a.adb.cmake trunk/examples/ada/xthick27a.adb.cmake trunk/examples/ada/xthick28a.adb.cmake trunk/examples/ada/xthick29a.adb.cmake trunk/examples/ada/xthick30a.adb.cmake trunk/examples/ada/xthick31a.adb.cmake Modified: trunk/examples/ada/CMakeLists.txt =================================================================== --- trunk/examples/ada/CMakeLists.txt 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/CMakeLists.txt 2010-07-23 05:20:18 UTC (rev 11099) @@ -93,11 +93,7 @@ set(ada_SRCS) foreach(STRING_INDEX ${ada_STRING_INDICES}) set(SOURCE_FILE x${STRING_INDEX}a.adb) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} - ) - list(APPEND ada_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE}) + list(APPEND ada_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) endforeach(STRING_INDEX ${ada_STRING_INDICES}) install(FILES ${ada_SRCS} DESTINATION ${DATA_DIR}/examples/ada) @@ -135,7 +131,7 @@ # CMake.) if(CORE_BUILD) - set(adalinkflags "-aI${CMAKE_BINARY_DIR}/examples/ada -aI${CMAKE_SOURCE_DIR}/bindings/ada -aL${CMAKE_BINARY_DIR}/bindings/ada/CMakeFiles/plplotada${LIB_TAG}.dir") + set(adalinkflags "-aI${CMAKE_SOURCE_DIR}/examples/ada -aI${CMAKE_SOURCE_DIR}/bindings/ada -aL${CMAKE_BINARY_DIR}/bindings/ada/CMakeFiles/plplotada${LIB_TAG}.dir") else(CORE_BUILD) set(adalinkflags "-aI${CMAKE_SOURCE_DIR}/ada -aI${ADA_INCLUDE_DIR} -aL${ADA_LIB_DIR}") endif(CORE_BUILD) @@ -143,13 +139,8 @@ foreach(STRING_INDEX ${ada_STRING_INDICES}) set(TARGET_NAME x${STRING_INDEX}a) set(SOURCE_FILE x${STRING_INDEX}a.adb) + set(adasrcfile ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) - if(CORE_BUILD) - set(adasrcfile ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE}) - else(CORE_BUILD) - set(adasrcfile ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) - endif(CORE_BUILD) - # Note due to limitations of the Ada language support for CMake, # the nominal source file for add_executable is compiled (which is # why a real file has to be specified), but otherwise it is Copied: trunk/examples/ada/x01a.adb (from rev 11096, trunk/examples/ada/x01a.adb.cmake) =================================================================== --- trunk/examples/ada/x01a.adb (rev 0) +++ trunk/examples/ada/x01a.adb 2010-07-23 05:20:18 UTC (rev 11099) @@ -0,0 +1,177 @@ +-- $Id$ + +-- Simple line plot and multiple windows demo. + +-- Copyright (C) 2007 Jerry Bauck + +-- 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 + +with + Ada.Text_IO, + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; +use + Ada.Text_IO, + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; + + + +procedure x01a is + xs, ys : Real_Vector (0 .. 5); + xscale, yscale, xoff, yoff : Long_Float; + fontset : Integer := 1; + notes : String := "Make sure you get it right!"; + + procedure plot1 is + xmin, xmax, ymin, ymax : Long_Float; + x, y : Real_Vector (0 .. 59); + begin + for i in x'Range loop + x(i) := xoff + xscale * Long_Float(i + 1) / Long_Float(x'Length); + y(i) := yoff + yscale * x(i)**2.0; + end loop; + + xmin := x(x'First); + xmax := x(x'Last); + ymin := y(y'First); + ymax := y(y'Last); + for i in xs'Range loop + xs(i) := x(i * 10 + 3); + ys(i) := y(i * 10 + 3); + end loop; + + -- 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 + plcol0(4); + plpoin(xs, ys, 9); + + -- Draw the line through the data + plcol0(3); + plline(x, y); + end plot1; + + + procedure plot2 is + x, y : Real_Vector (0 .. 99); + begin + -- 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 + for i in x'Range loop + x(i) := (Long_Float(i) - 19.0) / 6.0; + y(i) := 1.0; + if x(i) /= 0.0 then + y(i) := sin(x(i)) / x(i); + end if; + end loop; + + -- Draw the line + plcol0(3); + plwid(2); + plline(x, y); + plwid(1); + end plot2; + + + procedure plot3 is + x, y : Real_Vector (0 .. 100); + space1, mark1 : Integer_Array_1D(1 .. 1) := (others => 1500); + begin + pladv(0); + + -- 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. + 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! (-- Not Ada.) + plstyl(mark1, space1); + plcol0(2); + plbox("g", 30.0, 0, "g", 0.2, 0); + plstyl(Default_Continuous_Line); + + plcol0(3); + pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); + + for i in x'Range loop + x(i) := 3.6 * Long_Float(i); + y(i) := sin(x(i) * pi / 180.0); + end loop; + + plcol0(4); + plline(x, y); + end plot3; + +begin + -- Parse and process command line arguments + plparseopts(PL_PARSE_FULL); + + -- Get version number, just for kicks + Put_Line("PLplot library version: " & plgver); + + -- Initialize plplot + -- Divide page into 2x2 plots unless user overrides + plstar(2, 2); + + -- Set up the data + -- Original case + xscale := 6.0; + yscale := 1.0; + xoff := 0.0; + yoff := 0.0; + + -- Do a plot + plot1; + + -- Set up the data + xscale := 1.0; + yscale := 0.0014; + yoff := 0.0185; + + -- Do a plot + plsyax(5, 0); + plot1; + plot2; + plot3; + + -- Don't forget to call PLEND to finish off! + plend; +end x01a; Deleted: trunk/examples/ada/x01a.adb.cmake =================================================================== --- trunk/examples/ada/x01a.adb.cmake 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/x01a.adb.cmake 2010-07-23 05:20:18 UTC (rev 11099) @@ -1,177 +0,0 @@ --- $Id$ - --- Simple line plot and multiple windows demo. - --- Copyright (C) 2007 Jerry Bauck - --- 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 - -with - Ada.Text_IO, - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; -use - Ada.Text_IO, - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; - - - -procedure x01a is - xs, ys : Real_Vector (0 .. 5); - xscale, yscale, xoff, yoff : Long_Float; - fontset : Integer := 1; - notes : String := "Make sure you get it right!"; - - procedure plot1 is - xmin, xmax, ymin, ymax : Long_Float; - x, y : Real_Vector (0 .. 59); - begin - for i in x'Range loop - x(i) := xoff + xscale * Long_Float(i + 1) / Long_Float(x'Length); - y(i) := yoff + yscale * x(i)**2.0; - end loop; - - xmin := x(x'First); - xmax := x(x'Last); - ymin := y(y'First); - ymax := y(y'Last); - for i in xs'Range loop - xs(i) := x(i * 10 + 3); - ys(i) := y(i * 10 + 3); - end loop; - - -- 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 - plcol0(4); - plpoin(xs, ys, 9); - - -- Draw the line through the data - plcol0(3); - plline(x, y); - end plot1; - - - procedure plot2 is - x, y : Real_Vector (0 .. 99); - begin - -- 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 - for i in x'Range loop - x(i) := (Long_Float(i) - 19.0) / 6.0; - y(i) := 1.0; - if x(i) /= 0.0 then - y(i) := sin(x(i)) / x(i); - end if; - end loop; - - -- Draw the line - plcol0(3); - plwid(2); - plline(x, y); - plwid(1); - end plot2; - - - procedure plot3 is - x, y : Real_Vector (0 .. 100); - space1, mark1 : Integer_Array_1D(1 .. 1) := (others => 1500); - begin - pladv(0); - - -- 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. - 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! (-- Not Ada.) - plstyl(mark1, space1); - plcol0(2); - plbox("g", 30.0, 0, "g", 0.2, 0); - plstyl(Default_Continuous_Line); - - plcol0(3); - pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); - - for i in x'Range loop - x(i) := 3.6 * Long_Float(i); - y(i) := sin(x(i) * pi / 180.0); - end loop; - - plcol0(4); - plline(x, y); - end plot3; - -begin - -- Parse and process command line arguments - plparseopts(PL_PARSE_FULL); - - -- Get version number, just for kicks - Put_Line("PLplot library version: " & plgver); - - -- Initialize plplot - -- Divide page into 2x2 plots unless user overrides - plstar(2, 2); - - -- Set up the data - -- Original case - xscale := 6.0; - yscale := 1.0; - xoff := 0.0; - yoff := 0.0; - - -- Do a plot - plot1; - - -- Set up the data - xscale := 1.0; - yscale := 0.0014; - yoff := 0.0185; - - -- Do a plot - plsyax(5, 0); - plot1; - plot2; - plot3; - - -- Don't forget to call PLEND to finish off! - plend; -end x01a; Copied: trunk/examples/ada/x02a.adb (from rev 11096, trunk/examples/ada/x02a.adb.cmake) =================================================================== --- trunk/examples/ada/x02a.adb (rev 0) +++ trunk/examples/ada/x02a.adb 2010-07-23 05:20:18 UTC (rev 11099) @@ -0,0 +1,170 @@ +-- $Id$ + +-- Multiple window and color map 0 demo. + +-- Copyright (C) 2007 Alan W. Irwin + +-- 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 + +with + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings, + Ada.Strings.Fixed, + PLplot_Auxiliary, + PLplot_Traditional; + +use + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings, + Ada.Strings.Fixed, + PLplot_Auxiliary, + PLplot_Traditional; + + + +------------------------------------------------------------------------------ +-- Demonstrates multiple windows and color map 0 palette, both default and +-- user-modified. +------------------------------------------------------------------------------ + +procedure x02a is + -------------------------------------------------------------------------- + -- draw_windows + -- Draws a set of numbered boxes with colors according to cmap0 entry. + -------------------------------------------------------------------------- + + procedure draw_windows(nw, cmap0_offset : Integer) is + vmin, vmax : Long_Float; + + begin + plschr(0.0, 3.5); + plfont(4); + + for i in 0..(nw-1) loop + plcol0(i+cmap0_offset); + pladv(0); + vmin := 0.1; + vmax := 0.9; + for j in 0..2 loop + plwid(j + 1); + plvpor(vmin, vmax, vmin, vmax); + plwind(0.0, 1.0, 0.0, 1.0); + plbox("bc", 0.0, 0, "bc", 0.0, 0); + vmin := vmin + 0.1; + vmax := vmax - 0.1; + end loop; + plwid(1); + plptex(0.5, 0.5, 1.0, 0.0, 0.5, Trim(Integer'image(i), Left)); + end loop; + end draw_windows; + + -------------------------------------------------------------------------- + -- demo1 + -- Demonstrates multiple windows and default color map 0 palette. + -------------------------------------------------------------------------- + + procedure demo1 is + begin + plbop; + + -- Divide screen into 16 regions + plssub(4, 4); + draw_windows(16, 0); + pleop; + end demo1; + + -------------------------------------------------------------------------- + -- demo2 + -- Demonstrates multiple windows, user-modified color map 0 palette, and + -- HLS -> RGB translation. + -------------------------------------------------------------------------- + + procedure demo2 is + -- Set up cmap0 + -- Use 100 custom colors in addition to base 16 + r, g, b: Integer_Array_1D(0..115); + + -- Min & max lightness values + lmin : Long_Float := 0.15; + lmax : Long_Float := 0.85; + h, l, s : Long_Float; + r1, g1, b1 : Long_Float; + begin + plbop; + + -- Divide screen into 100 regions. + plssub(10, 10); + + for i in 0..99 loop + + -- Bounds on HLS, from plhlsrgb() commentary + -- hue [0., 360.] degrees + -- lightness [0., 1.] magnitude + -- saturation [0., 1.] magnitude + + -- Vary hue uniformly from left to right + h := (360.0 / 10.0 ) * Long_Float( i mod 10 ); + + -- Vary lightness uniformly from top to bottom, between min & max. + l := lmin + (lmax - lmin) * Long_Float(i / 10) / 9.0; + + -- Use max saturation. + s := 1.0; + + plhlsrgb(h, l, s, r1, g1, b1); + + -- Ada converts floats to integers by rounding while C does so by + -- truncation. There is no fool-proof way to fix that but this is pretty + -- close: Add a bit less than 1/2 to the float before converting. A good + -- number to use appears to be about 0.5 - 10^-16 which _might_ + -- be an exact fix for 64-bit floats since they have about 16 digits + -- of accuracy. + r(i+16) := Integer((r1 * 255.001) - 0.499999999999999); + g(i+16) := Integer((g1 * 255.001) - 0.499999999999999); + b(i+16) := Integer((b1 * 255.001) - 0.499999999999999); + end loop; + + -- Load default cmap0 colors into our custom set. + for i in 0..15 loop + plgcol0(i, r(i), g(i), b(i)); + end loop; + + -- Now set cmap0 all at once (faster, since fewer driver calls). + plscmap0(r, g, b); + + draw_windows(100, 16); + + pleop; + end demo2; + +begin + -- Parse and process command line arguments. + plparseopts(PL_PARSE_FULL); + + -- Initialize plplot. + plinit; + + -- Run demos. + demo1; + demo2; + + -- Don't forget to call plend to finish off! + plend; + +end x02a; Deleted: trunk/examples/ada/x02a.adb.cmake =================================================================== --- trunk/examples/ada/x02a.adb.cmake 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/x02a.adb.cmake 2010-07-23 05:20:18 UTC (rev 11099) @@ -1,170 +0,0 @@ --- $Id$ - --- Multiple window and color map 0 demo. - --- Copyright (C) 2007 Alan W. Irwin - --- 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 - -with - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - Ada.Strings, - Ada.Strings.Fixed, - PLplot_Auxiliary, - PLplot_Traditional; - -use - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - Ada.Strings, - Ada.Strings.Fixed, - PLplot_Auxiliary, - PLplot_Traditional; - - - ------------------------------------------------------------------------------- --- Demonstrates multiple windows and color map 0 palette, both default and --- user-modified. ------------------------------------------------------------------------------- - -procedure x02a is - -------------------------------------------------------------------------- - -- draw_windows - -- Draws a set of numbered boxes with colors according to cmap0 entry. - -------------------------------------------------------------------------- - - procedure draw_windows(nw, cmap0_offset : Integer) is - vmin, vmax : Long_Float; - - begin - plschr(0.0, 3.5); - plfont(4); - - for i in 0..(nw-1) loop - plcol0(i+cmap0_offset); - pladv(0); - vmin := 0.1; - vmax := 0.9; - for j in 0..2 loop - plwid(j + 1); - plvpor(vmin, vmax, vmin, vmax); - plwind(0.0, 1.0, 0.0, 1.0); - plbox("bc", 0.0, 0, "bc", 0.0, 0); - vmin := vmin + 0.1; - vmax := vmax - 0.1; - end loop; - plwid(1); - plptex(0.5, 0.5, 1.0, 0.0, 0.5, Trim(Integer'image(i), Left)); - end loop; - end draw_windows; - - -------------------------------------------------------------------------- - -- demo1 - -- Demonstrates multiple windows and default color map 0 palette. - -------------------------------------------------------------------------- - - procedure demo1 is - begin - plbop; - - -- Divide screen into 16 regions - plssub(4, 4); - draw_windows(16, 0); - pleop; - end demo1; - - -------------------------------------------------------------------------- - -- demo2 - -- Demonstrates multiple windows, user-modified color map 0 palette, and - -- HLS -> RGB translation. - -------------------------------------------------------------------------- - - procedure demo2 is - -- Set up cmap0 - -- Use 100 custom colors in addition to base 16 - r, g, b: Integer_Array_1D(0..115); - - -- Min & max lightness values - lmin : Long_Float := 0.15; - lmax : Long_Float := 0.85; - h, l, s : Long_Float; - r1, g1, b1 : Long_Float; - begin - plbop; - - -- Divide screen into 100 regions. - plssub(10, 10); - - for i in 0..99 loop - - -- Bounds on HLS, from plhlsrgb() commentary - -- hue [0., 360.] degrees - -- lightness [0., 1.] magnitude - -- saturation [0., 1.] magnitude - - -- Vary hue uniformly from left to right - h := (360.0 / 10.0 ) * Long_Float( i mod 10 ); - - -- Vary lightness uniformly from top to bottom, between min & max. - l := lmin + (lmax - lmin) * Long_Float(i / 10) / 9.0; - - -- Use max saturation. - s := 1.0; - - plhlsrgb(h, l, s, r1, g1, b1); - - -- Ada converts floats to integers by rounding while C does so by - -- truncation. There is no fool-proof way to fix that but this is pretty - -- close: Add a bit less than 1/2 to the float before converting. A good - -- number to use appears to be about 0.5 - 10^-16 which _might_ - -- be an exact fix for 64-bit floats since they have about 16 digits - -- of accuracy. - r(i+16) := Integer((r1 * 255.001) - 0.499999999999999); - g(i+16) := Integer((g1 * 255.001) - 0.499999999999999); - b(i+16) := Integer((b1 * 255.001) - 0.499999999999999); - end loop; - - -- Load default cmap0 colors into our custom set. - for i in 0..15 loop - plgcol0(i, r(i), g(i), b(i)); - end loop; - - -- Now set cmap0 all at once (faster, since fewer driver calls). - plscmap0(r, g, b); - - draw_windows(100, 16); - - pleop; - end demo2; - -begin - -- Parse and process command line arguments. - plparseopts(PL_PARSE_FULL); - - -- Initialize plplot. - plinit; - - -- Run demos. - demo1; - demo2; - - -- Don't forget to call plend to finish off! - plend; - -end x02a; Copied: trunk/examples/ada/x03a.adb (from rev 11096, trunk/examples/ada/x03a.adb.cmake) =================================================================== --- trunk/examples/ada/x03a.adb (rev 0) +++ trunk/examples/ada/x03a.adb 2010-07-23 05:20:18 UTC (rev 11099) @@ -0,0 +1,112 @@ +-- $Id$ + +-- Polar plot demo. +-- Generates polar plot, with 1-1 scaling. + +-- Copyright (C) 2007 Jerry Bauck + +-- 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 + +with + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings, + Ada.Strings.Fixed, + PLplot_Auxiliary, + PLplot_Traditional; +use + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings, + Ada.Strings.Fixed, + PLplot_Auxiliary, + PLplot_Traditional; + + + +procedure x03a is + dtr, theta, dx, dy, r, offset : Long_Float; + x0, y0 : Real_Vector(0..360); + x, y : Real_Vector(0..360); + +begin + dtr := pi / 180.0; + for i in x0'range loop + x0(i) := cos(dtr * Long_Float(i)); + y0(i) := sin(dtr * Long_Float(i)); + end loop; + + -- Parse and process command line arguments. + plparseopts(PL_PARSE_FULL); + + -- Set orientation to portrait. Note not all device drivers + -- support this, in particular most interactive drivers do not. + plsori(Portrait); + + -- Initialize plplot + plinit; + + -- Set up viewport and window, but do not draw box. + plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); + + -- Draw circles for polar grid. + 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); + for i in 0..11 loop + theta := 30.0 * Long_Float(i); + dx := cos(dtr * theta); + dy := sin(dtr * theta); + + -- Draw radial spokes for polar grid. + pljoin(0.0, 0.0, dx, dy); + + -- Write labels for angle. + + if theta < 9.99 then + offset := 0.45; + elsif theta < 99.9 then + offset := 0.30; + else + offset := 0.15; + end if; + + -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg + if dx >= -0.00001 then + plptex(dx, dy, dx, dy, -offset, Trim(Integer'image(Integer(theta)), Left)); + else + plptex(dx, dy, -dx, -dy, 1.0 + offset, Trim(Integer'image(Integer(theta)), Left)); + end if; + end loop; + + -- Draw the graph. + for i in x'range loop + r := sin(dtr * Long_Float(5 * i)); + x(i) := x0(i) * r; + y(i) := y0(i) * r; + end loop; + plcol0(3); + plline(x, y); + + plcol0(4); + plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); + + -- Close the plot at end. + plend; +end x03a; Deleted: trunk/examples/ada/x03a.adb.cmake =================================================================== --- trunk/examples/ada/x03a.adb.cmake 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/x03a.adb.cmake 2010-07-23 05:20:18 UTC (rev 11099) @@ -1,112 +0,0 @@ --- $Id$ - --- Polar plot demo. --- Generates polar plot, with 1-1 scaling. - --- Copyright (C) 2007 Jerry Bauck - --- 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 - -with - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - Ada.Strings, - Ada.Strings.Fixed, - PLplot_Auxiliary, - PLplot_Traditional; -use - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - Ada.Strings, - Ada.Strings.Fixed, - PLplot_Auxiliary, - PLplot_Traditional; - - - -procedure x03a is - dtr, theta, dx, dy, r, offset : Long_Float; - x0, y0 : Real_Vector(0..360); - x, y : Real_Vector(0..360); - -begin - dtr := pi / 180.0; - for i in x0'range loop - x0(i) := cos(dtr * Long_Float(i)); - y0(i) := sin(dtr * Long_Float(i)); - end loop; - - -- Parse and process command line arguments. - plparseopts(PL_PARSE_FULL); - - -- Set orientation to portrait. Note not all device drivers - -- support this, in particular most interactive drivers do not. - plsori(Portrait); - - -- Initialize plplot - plinit; - - -- Set up viewport and window, but do not draw box. - plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); - - -- Draw circles for polar grid. - 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); - for i in 0..11 loop - theta := 30.0 * Long_Float(i); - dx := cos(dtr * theta); - dy := sin(dtr * theta); - - -- Draw radial spokes for polar grid. - pljoin(0.0, 0.0, dx, dy); - - -- Write labels for angle. - - if theta < 9.99 then - offset := 0.45; - elsif theta < 99.9 then - offset := 0.30; - else - offset := 0.15; - end if; - - -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg - if dx >= -0.00001 then - plptex(dx, dy, dx, dy, -offset, Trim(Integer'image(Integer(theta)), Left)); - else - plptex(dx, dy, -dx, -dy, 1.0 + offset, Trim(Integer'image(Integer(theta)), Left)); - end if; - end loop; - - -- Draw the graph. - for i in x'range loop - r := sin(dtr * Long_Float(5 * i)); - x(i) := x0(i) * r; - y(i) := y0(i) * r; - end loop; - plcol0(3); - plline(x, y); - - plcol0(4); - plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); - - -- Close the plot at end. - plend; -end x03a; Copied: trunk/examples/ada/x04a.adb (from rev 11096, trunk/examples/ada/x04a.adb.cmake) =================================================================== --- trunk/examples/ada/x04a.adb (rev 0) +++ trunk/examples/ada/x04a.adb 2010-07-23 05:20:18 UTC (rev 11099) @@ -0,0 +1,101 @@ +-- $Id$ +-- +-- Log plot demo. + +-- Copyright (C) 2007 Jerry Bauck + +-- 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 + +with + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; +use + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; + + + +procedure x04a is + + procedure plot1(Plot_Type : Integer) is + freql, ampl, phase : Real_Vector(0 .. 100); + f0, freq : Long_Float; + begin + pladv(0); + f0 := 1.0; + for i in freql'range loop + freql(i) := -2.0 + Long_Float(i) / 20.0; + freq := 10.0 ** freql(i); + ampl(i) := 20.0 * log(1.0 / sqrt(1.0 + (freq / f0) ** 2.0), 10.0); + phase(i) := -(180.0 / pi) * arctan(freq / f0); + end loop; + + plvpor(0.15, 0.85, 0.1, 0.9); + plwind(-2.0, 3.0, -80.0, 0.0); + + -- Try different axis and labelling styles. + plcol0(1); + + if Plot_Type = 0 then + plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); + elsif Plot_Type = 1 then + plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); + end if; + + -- Plot ampl vs freq + plcol0(2); + plline(freql, ampl); + plcol0(1); + plptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade"); + + -- Put labels on + plcol0(1); + plmtex("b", 3.2, 0.5, 0.5, "Frequency"); + plmtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter"); + plcol0(2); + plmtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)"); + + -- For the gridless case, put phase vs freq on same plot + if Plot_Type = 0 then + plcol0(1); + plwind(-2.0, 3.0, -100.0, 0.0); + plbox("", 0.0, 0, "cmstv", 30.0, 3); + plcol0(3); + plline(freql, phase); + plcol0(3); + plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)"); + end if; + end plot1; + +begin + -- Parse and process command line arguments + plparseopts(PL_PARSE_FULL); + + -- Initialize plplot + plinit; + plfont(2); + + -- Make log plots using two different styles. + plot1(0); + plot1(1); + + plend; +end x04a; Deleted: trunk/examples/ada/x04a.adb.cmake =================================================================== --- trunk/examples/ada/x04a.adb.cmake 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/x04a.adb.cmake 2010-07-23 05:20:18 UTC (rev 11099) @@ -1,101 +0,0 @@ --- $Id$ --- --- Log plot demo. - --- Copyright (C) 2007 Jerry Bauck - --- 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 - -with - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; -use - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; - - - -procedure x04a is - - procedure plot1(Plot_Type : Integer) is - freql, ampl, phase : Real_Vector(0 .. 100); - f0, freq : Long_Float; - begin - pladv(0); - f0 := 1.0; - for i in freql'range loop - freql(i) := -2.0 + Long_Float(i) / 20.0; - freq := 10.0 ** freql(i); - ampl(i) := 20.0 * log(1.0 / sqrt(1.0 + (freq / f0) ** 2.0), 10.0); - phase(i) := -(180.0 / pi) * arctan(freq / f0); - end loop; - - plvpor(0.15, 0.85, 0.1, 0.9); - plwind(-2.0, 3.0, -80.0, 0.0); - - -- Try different axis and labelling styles. - plcol0(1); - - if Plot_Type = 0 then - plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); - elsif Plot_Type = 1 then - plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); - end if; - - -- Plot ampl vs freq - plcol0(2); - plline(freql, ampl); - plcol0(1); - plptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade"); - - -- Put labels on - plcol0(1); - plmtex("b", 3.2, 0.5, 0.5, "Frequency"); - plmtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter"); - plcol0(2); - plmtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)"); - - -- For the gridless case, put phase vs freq on same plot - if Plot_Type = 0 then - plcol0(1); - plwind(-2.0, 3.0, -100.0, 0.0); - plbox("", 0.0, 0, "cmstv", 30.0, 3); - plcol0(3); - plline(freql, phase); - plcol0(3); - plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)"); - end if; - end plot1; - -begin - -- Parse and process command line arguments - plparseopts(PL_PARSE_FULL); - - -- Initialize plplot - plinit; - plfont(2); - - -- Make log plots using two different styles. - plot1(0); - plot1(1); - - plend; -end x04a; Copied: trunk/examples/ada/x05a.adb (from rev 11096, trunk/examples/ada/x05a.adb.cmake) =================================================================== --- trunk/examples/ada/x05a.adb (rev 0) +++ trunk/examples/ada/x05a.adb 2010-07-23 05:20:18 UTC (rev 11099) @@ -0,0 +1,60 @@ +-- $Id$ + +-- Histogram demo. +-- Draws a histogram from sample data. + +-- Copyright (C) 2007 Jerry Bauck + +-- 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 + +with + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; +use + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; + + + +procedure x05a is + NPTS : constant Integer := 2047; + data : Real_Vector(0 .. NPTS - 1); + delt : Long_Float; -- delta is a reserved word in Ada. +begin + -- Parse and process command line arguments + plparseopts(PL_PARSE_FULL); + + -- Initialize plplot + plinit; + + -- Fill up data points + delt := 2.0 * pi / Long_Float(NPTS); + for i in data'range loop + data(i) := sin(Long_Float(i) * delt); + end loop; + + plcol0(1); + plhist(data, -1.1, 1.1, 44, 0); + plcol0(2); + pllab("#frValue", "#frFrequency", + "#frPLplot Example 5 - Probability function of Oscillator"); + plend; +end x05a; Deleted: trunk/examples/ada/x05a.adb.cmake =================================================================== --- trunk/examples/ada/x05a.adb.cmake 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/x05a.adb.cmake 2010-07-23 05:20:18 UTC (rev 11099) @@ -1,60 +0,0 @@ --- $Id$ - --- Histogram demo. --- Draws a histogram from sample data. - --- Copyright (C) 2007 Jerry Bauck - --- 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 - -with - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; -use - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; - - - -procedure x05a is - NPTS : constant Integer := 2047; - data : Real_Vector(0 .. NPTS - 1); - delt : Long_Float; -- delta is a reserved word in Ada. -begin - -- Parse and process command line arguments - plparseopts(PL_PARSE_FULL); - - -- Initialize plplot - plinit; - - -- Fill up data points - delt := 2.0 * pi / Long_Float(NPTS); - for i in data'range loop - data(i) := sin(Long_Float(i) * delt); - end loop; - - plcol0(1); - plhist(data, -1.1, 1.1, 44, 0); - plcol0(2); - pllab("#frValue", "#frFrequency", - "#frPLplot Example 5 - Probability function of Oscillator"); - plend; -end x05a; Copied: trunk/examples/ada/x06a.adb (from rev 11096, trunk/examples/ada/x06a.adb.cmake) =================================================================== --- trunk/examples/ada/x06a.adb (rev 0) +++ trunk/examples/ada/x06a.adb 2010-07-23 05:20:18 UTC (rev 11099) @@ -0,0 +1,105 @@ +-- $Id: x01a.adb.cmake 8022 2007-11-13 18:58:30Z airwin $ + +-- Displays the entire "plpoin" symbol (font) set. + +-- Copyright (C) 2010 Jerry Bauck + +-- 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 + +with + Ada.Strings, + Ada.Strings.Fixed, + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; +use + Ada.Strings, + Ada.Strings.Fixed, + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; + + + +procedure x06a is + + k, maxfont : Integer; + x, y : Real_Vector(1 .. 1); + +begin + -- Parse and process command line arguments + plparseopts(PL_PARSE_FULL); + + -- Initialize plplot + plinit; + + for Kind_Font in 0 .. 1 loop + plfontld(Kind_Font); + if Kind_Font = 0 then + maxfont := 1; + else + maxfont := 4; + end if; + + for font in 0 .. maxfont - 1 loop + plfont(font + 1); + pladv(0); + + -- Set up viewport and window + plcol0(2); + plvpor(0.1, 1.0, 0.1, 0.9); + plwind(0.0, 1.0, 0.0, 1.3); + + -- Draw the grid using plbox + plbox("bcg", 0.1, 0, "bcg", 0.1, 0); + + -- Write the digits below the frame + plcol0(15); + for i in 0 .. 9 loop + plmtex("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5, Trim(Integer'image(i), Left)); + end loop; + + k := 0; + for i in 0 .. 12 loop + + -- Write the digits to the left of the frame + plmtex("lv", 1.0, (1.0 - (2.0 * Long_Float(i) + 1.0) / 26.0), 1.0, Trim(Integer'image(10 * i), Left)); + for j in 0 .. 9 loop + x(1) := 0.1 * Long_Float(j) + 0.05; + y(1) := 1.25 - 0.1 * Long_Float(i); + + -- Display the symbols (plpoin expects that x and y are arrays so + -- pass pointers) + if k < 128 then + plpoin(x, y, k); + end if; + k := k + 1; + end loop; + end loop; + + if Kind_Font = 0 then + plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)"); + else + plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)"); + end if; + end loop; -- font + end loop; -- Kind_Font + plend; + +end x06a; Deleted: trunk/examples/ada/x06a.adb.cmake =================================================================== --- trunk/examples/ada/x06a.adb.cmake 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/x06a.adb.cmake 2010-07-23 05:20:18 UTC (rev 11099) @@ -1,105 +0,0 @@ --- $Id: x01a.adb.cmake 8022 2007-11-13 18:58:30Z airwin $ - --- Displays the entire "plpoin" symbol (font) set. - --- Copyright (C) 2010 Jerry Bauck - --- 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 - -with - Ada.Strings, - Ada.Strings.Fixed, - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; -use - Ada.Strings, - Ada.Strings.Fixed, - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; - - - -procedure x06a is - - k, maxfont : Integer; - x, y : Real_Vector(1 .. 1); - -begin - -- Parse and process command line arguments - plparseopts(PL_PARSE_FULL); - - -- Initialize plplot - plinit; - - for Kind_Font in 0 .. 1 loop - plfontld(Kind_Font); - if Kind_Font = 0 then - maxfont := 1; - else - maxfont := 4; - end if; - - for font in 0 .. maxfont - 1 loop - plfont(font + 1); - pladv(0); - - -- Set up viewport and window - plcol0(2); - plvpor(0.1, 1.0, 0.1, 0.9); - plwind(0.0, 1.0, 0.0, 1.3); - - -- Draw the grid using plbox - plbox("bcg", 0.1, 0, "bcg", 0.1, 0); - - -- Write the digits below the frame - plcol0(15); - for i in 0 .. 9 loop - plmtex("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5, Trim(Integer'image(i), Left)); - end loop; - - k := 0; - for i in 0 .. 12 loop - - -- Write the digits to the left of the frame - plmtex("lv", 1.0, (1.0 - (2.0 * Long_Float(i) + 1.0) / 26.0), 1.0, Trim(Integer'image(10 * i), Left)); - for j in 0 .. 9 loop - x(1) := 0.1 * Long_Float(j) + 0.05; - y(1) := 1.25 - 0.1 * Long_Float(i); - - -- Display the symbols (plpoin expects that x and y are arrays so - -- pass pointers) - if k < 128 then - plpoin(x, y, k); - end if; - k := k + 1; - end loop; - end loop; - - if Kind_Font = 0 then - plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)"); - else - plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)"); - end if; - end loop; -- font - end loop; -- Kind_Font - plend; - -end x06a; Copied: trunk/examples/ada/x07a.adb (from rev 11096, trunk/examples/ada/x07a.adb.cmake) =================================================================== --- trunk/examples/ada/x07a.adb (rev 0) +++ trunk/examples/ada/x07a.adb 2010-07-23 05:20:18 UTC (rev 11099) @@ -0,0 +1,98 @@ +-- $Id: x01a.adb.cmake 8022 2007-11-13 18:58:30Z airwin $ + +-- Font demo. + +-- Copyright (C) 2010 Jerry Bauck + +-- 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 + +with + Ada.Strings, + Ada.Strings.Fixed, + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; +use + Ada.Strings, + Ada.Strings.Fixed, + Ada.Numerics, + Ada.Numerics.Long_Elementary_Functions, + PLplot_Auxiliary, + PLplot_Traditional; + + + +procedure x07a is + + k : Integer; + x, y : Real_Vector(1 .. 1); + base : array(0 .. 19) of Integer := (0, 100, 0, 100, 200, 500, 600, 700, 800, + 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900); + +begin + -- Parse and process command line arguments + plparseopts(PL_PARSE_FULL); + + -- Initialize plplot + plinit; + + plfontld(0); + for l in 0 .. 19 loop + if l = 2 then + plfontld(1); + end if; + pladv(0); + + -- Set up viewport and window + plcol0(2); + plvpor(0.15, 0.95, 0.1, 0.9); + plwind(0.0, 1.0, 0.0, 1.0); + + -- Draw the grid using plbox + plbox("bcg", 0.1, 0, "bcg", 0.1, 0); + + -- Write the digits below the frame + plcol0(15); + for i in 0 .. 9 loop + plmtex("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5, Trim(Integer'image(i), Left)); + end loop; + + k := 0; + for i in 0 .. 9 loop + + -- Write the digits to the left of the frame + plmtex("lv", 1.0, (0.95 - 0.1 * Long_Float(i)), 1.0, Trim(Integer'image(base(l) + 10 * i), Left)); + for j in 0 .. 9 loop + x(1) := 0.1 * Long_Float(j) + 0.05; + y(1) := 0.95 - 0.1 * Long_Float(i); + + -- Display the symbols + plsym(x, y, base(l) + k); + k := k + 1; + end loop; + end loop; + + if l < 2 then + plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)"); + else + plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)"); + end if; + end loop; + plend; + +end x07a; Deleted: trunk/examples/ada/x07a.adb.cmake =================================================================== --- trunk/examples/ada/x07a.adb.cmake 2010-07-23 05:07:44 UTC (rev 11098) +++ trunk/examples/ada/x07a.adb.cmake 2010-07-23 05:20:18 UTC (rev 11099) @@ -1,98 +0,0 @@ --- $Id: x01a.adb.cmake 8022 2007-11-13 18:58:30Z airwin $ - --- Font demo. - --- Copyright (C) 2010 Jerry Bauck - --- 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 - -with - Ada.Strings, - Ada.Strings.Fixed, - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; -use - Ada.Strings, - Ada.Strings.Fixed, - Ada.Numerics, - Ada.Numerics.Long_Elementary_Functions, - PLplot_Auxiliary, - PLplot_Traditional; - - - -procedure x07a is - - k : Integer; - x, y : Real_Vector(1 .. 1); - base : array(0 .. 19) of Integer := (0, 100, 0, 100, 200, 500, 600, 700, 800, - 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900); - -begin - -- Parse and process command line arguments - plparseopts(PL_PARSE_FULL); - - -- Initialize plplot - plinit; - - plfontld(0); - for l in 0 .. 19 loop - if l = 2 then - plfontld(1); - end if; - pladv(0); - - -- Set up viewport and window - plcol0(2); - plvpor(0.15, 0.95, 0.1, 0.9); - plwind(0.0, 1.0, 0.0, 1.0); - - -- Draw the grid using plbox - plbox("bcg", 0.1, 0, "bcg", 0.1, 0); - - -- Write the digits below the frame - plcol0(15); - for i in 0 .. 9 loop - plmtex("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5,... [truncated message content] |