PGPLOT-2.27/0000755000175000017500000000000014012625446012403 5ustar osboxesosboxesPGPLOT-2.27/INSTALL0000644000175000017500000000304113435120245013425 0ustar osboxesosboxesInstallation ------------ Last update to this file: Apr 10th 2006 1) First you must compile and install the pgplot graphics libraries: The source can be obtained from the ftp site astro.caltech.edu in directory /pub/pgplot. Alternatively see the home ftp sites above. To build pgplot you need a FORTRAN compiler - the free compiler GNU-77 (or the newer GFORTRAN) works just fine. There is a PGPLOT Home Page at: http://astro.caltech.edu/~tjp/pgplot/ 2) Download and unpack the module. Then follow the standard Perl build procedure: perl Makefile.PL If you want to install somewhere other than the standard perl location (e.g. in your home directory) replace this line with something like: perl Makefile.PL PREFIX=/home/me make make test [When you run 'make test' you will be prompted for a graphics device. Try /XSERVE for a X11 display.] If something goes wrong read the file HELP, if everything works: make install If you want to install in the standard perl location you will need to do this as root. (e.g. 'sudo make install') If you used PREFIX above the files will install themselves in /home/me/lib/perl5/site_perl/... Then to use them you will need to set the environment variable PERL5LIB to point to this, e.g. for csh users: setenv PERL5LIB /home/me/lib/perl5/site_perl ------------ See the file HELP for problem solutions. See the file INSTALL-Win32 for installation on Windows systems. See the file INSTALL-MacOSX for some Mac hints. PGPLOT-2.27/arrays.h0000644000175000017500000000206614012370505014052 0ustar osboxesosboxes/* These are the function prototypes for arrays.c */ /* Functions defined in this module, see header comments on each one for more details: */ #ifndef _INC_ARRAYS_ void* pack1D(SV* arg, char packtype); /* Pack perl 1D array */ void* pack2D(SV* arg, char packtype); /* Pack perl 1-2D array */ void* packND(SV* arg, char packtype); /* Pack perl array N-D array */ void unpack1D(SV* arg, void * var, /* Unpack 1D array */ char packtype, int n); AV* coerce1D ( SV* arg, int n ); /* Coerce/create array to specified size */ void* get_mortalspace( int n, char packtype ); /* Utility to just get workspace */ /* Sort out macro name changes in 5.004_53 (PATCHLEVEL < 5) Note that recent Perl versions don't define PATCHLEVEL by default */ #ifndef PATCHLEVEL #include #endif #if defined(PATCHLEVEL) && (PATCHLEVEL < 5) #define PL_na na #endif /* Prevent the prototypes being defined twice */ #define _INC_ARRAYS_ #endif PGPLOT-2.27/INSTALL-MacOSX0000644000175000017500000000140413435120245014516 0ustar osboxesosboxesInstallation on Mac OS X ------------------------ Last update to this file: Apr 10th 2006 Should be the same as for generic UNIX if libcpgplot and libpgplot are installed in 'the usual places' i.e. perl Makefile.PL PREFIX=/home/me make make test sudo make install This will then be installed in to something like /Library/Perl/5.8.6/... I compile the pgplot libs with gfortran 4.0 and everything worked smoothly (except for some device drivers I didn't need) after some fiddling. Note if pgplot includes the Aquaterm driver you will need to add the following by hand to the link step in the Makefile generated by Makefile.PL - -lpng -laquaterm -Wl,-framework -Wl,Foundation Sorry! One day maybe I can figure out how to autodetect this cleanly. PGPLOT-2.27/META.json0000644000175000017500000000252314012625446014026 0ustar osboxesosboxes{ "abstract" : "unknown", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "PGPLOT", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "Devel::CheckLib" : "1.14", "ExtUtils::F77" : "1.13" } }, "develop" : { "requires" : { "CPAN::Changes" : "0" } }, "test" : { "requires" : { "Test::More" : "0.88" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/PDLPorters/perl5-PGPLOT/issues" }, "repository" : { "type" : "git", "url" : "git://github.com/PDLPorters/perl5-PGPLOT.git", "web" : "https://github.com/PDLPorters/perl5-PGPLOT" } }, "version" : "2.27", "x_IRC" : "irc://irc.perl.org/#pdl", "x_serialization_backend" : "JSON::PP version 4.04" } PGPLOT-2.27/typemap0000644000175000017500000000045513435120245014004 0ustar osboxesosboxesTYPEMAP int * T_INTP float T_NV float * T_FLOATP Logical T_IV int2D * T_INT2DP float2D * T_FLOAT2DP INPUT T_INTP $var = ($type)pack1D($arg,'i') T_FLOATP $var = ($type)pack1D($arg,'f') T_INT2DP $var = ($type)pack2D($arg,'i') T_FLOAT2DP $var = ($type)pack2D($arg,'f') PGPLOT-2.27/INSTALL-Win320000644000175000017500000001067513435120245014340 0ustar osboxesosboxes INSTALL INSTRUCTIONS FOR Win32 Systems ======================================= Author: "Sisyphus" - sisyphus1 at optusnet dot com dot au Last update to this file: Apr 10th 2006 Caveats ======= Here's how to build the PGPLOT perl module on Win32 ... or at least here's one way to do it. There are no doubt other approaches that will work. These instructions relate to a native Win32 environment, NOT Cygwin. PGPLOT-2.19 should build straight out of the box on Cygwin if the pgplot C library can be found. I don't know what sort of graphics display Cygwin users have for running the test suite - they may also need to specify '/PNG'. From here on, I shall refer to the pgplot C library as "pgplot" - and to the perl module as "PGPLOT". ============= PRELIMINARIES ============= First up you need a pgplot C library against which to build PGPLOT. I've used Jose Fonseca's (MinGW-built) pgplot library available from http://www.kalinabears.com.au/w32perl/pgplot-5.2.2-mingw32.tar.bz2. It's an old port, but is adequate for building PGPLOT if you can't find a more recent port - and don't want to (or can't) build pgplot yourself. If you do want to build pgplot yourself using MinGW, then the diff at the following location might be useful to you: http://jrfonseca.home.dyndns.org/projects/gnu-win32/software/ported/patches/pgplot-5.2.2-mingw32.diff.gz Anyway, Fonseca's port of pgplot has all the files needed to build PGPLOT for both MinGW-built perl and MSVC++-built perl: pgplot/bin/cpgplot.dll pgplot/bin/pgplot.dll pgplot/bin/grfont.dat pgplot/include/cpgplot.h pgplot/lib/cpgplot.a pgplot/lib/pgplot.a The location of the 2 dll's (cpgplot.dll and pgplot.dll) needs to be added to the system path. We also need to set an environment variable so the system can find grfont.dat: set PGPLOT_FONT=\full_path\to_grfont.dat\grfont.dat On Win32 I don't have a decent graphics display, so I use PGPLOT's capability to write images to a png file. For that it's also necessary to add the location of libpng.dll and zlib.dll to the system path. (These can both be readily Googled if you don't have them.) The pgplot library needs to be found by the PGPLOT build process. To make sure that happens copy libcpgplot.a and libpgplot.a from Fonseca's library to X:\usr\lib. And copy cpgplot.h from Fonseca's library to X:\usr\include. (You'll need to replace X with whatever letter it is that denotes the drive you're building PGPLOT in - ie if your PGPLOT build directory is in the D drive, copy to D:\usr\lib and D:\usr\include respectively.) Install dmake (available from http://search.cpan.org/dist/dmake/) if you don't already have it and add the location of dmake.exe to your path. Install MinGW (available from http://www.mingw.org/download.shtml) if you don't already have it and add the MinGW\bin folder to your path. That should take care of the preliminaries. ================ MINGW-BUILT PERL ================ Having done the preliminaries: Install ExtUtils::F77-1.15 or later (from CPAN source). Then build PGPLOT by simply running (as per usual): perl Makefile.PL dmake dmake test (Here you'll be prompted to specify '/PNG' so that the tests can be written to png files and viewed at the conclusion of the test suite.) dmake install =========================================================== MSVC-BUILT PERL (including ActiveState and IndigoStar perl) =========================================================== Having done the preliminaries: Install Extutils::FakeConfig (according to the instructions in its readme). Install Extutils::F77-1.15 or later (from CPAN source) by running: perl -MConfig_m Makefile.PL dmake dmake test dmake install Then build PGPLOT by running: perl -MConfig_m Makefile.PL dmake dmake test (Here you'll be prompted to specify '/PNG' so that the tests can be written to png files and viewed at the conclusion of the test suite.) dmake install For ActiveState builds 815 and later it should NOT be necessary to install ExtUtils::FakeConfig as these builds should work seamlessly with dmake and the MinGW compiler. If you have such a build of ActiveState perl and opt to NOT install ExtUtils::FakeConfig, then do NOT supply the '-MConfig_m' option whenever running 'perl Makefile.PL'. Other than that, the procedure is identical. If that involves too much work there are ppm packages (which include the png and zlib dll's) for PGPLOT available from http://www.kalinabears.com.au/w32perl/pgplot.html (for both perl-5.6 and perl-5.8). PGPLOT-2.27/MANIFEST.SKIP0000644000175000017500000000067014012371716014302 0ustar osboxesosboxes%$ -stamp$ .*/TAGS$ .*Version_check$ .*\#$ .*\.0$ .*\.orig$ .*\.rej$ \.swp$ .exe$ /\.\#.* /pm_to_blib$ /tmp.* MANIFEST\.bak$ MANIFEST\.old META\.json META\.yml Makefile$ Makefile\.aperl Makefile\.old \.(tmp|new|diff|ori)$ \.BAK$ \.bck$ \.bs$ \.bundle$ \.lck$ \.m$ \.o$ \.out$ \.patch$ \.so$ \.tar\.gz$ /core$ \b_eumm/ ^\.\#.* ^\.exists ^\.git ^blib/ ^perl$ ^pm_to_blib$ ~$ ^xt/ ^\.github/ ^PGPLOT\.[co] \.gcov$ \.gcda$ \.gcno$ ^cover_db/ PGPLOT-2.27/t/0000755000175000017500000000000014012625446012646 5ustar osboxesosboxesPGPLOT-2.27/t/t6.t0000644000175000017500000000241714012360100013347 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing perl function passing to pgconx"; # Read in image (int*2 raw byte array) my $img=""; open(my $fh,"test.img") || die "Data file test.img not found"; if($^O =~ /mswin32/i) {binmode($fh)} read($fh, $img, 32768); close($fh) or die "Can't close test.img: $!"; note length($img)," bytes read\n"; my @image = unpack("n*",$img); print $#image+1," element image stored\n"; PGPLOT::pgbegin(0,$dev,1,1); note "Plotting"; PGPLOT::pgsci(3); PGPLOT::pgwnad(1,128,1,128); PGPLOT::pgbox("BCNST",0,0,"BCNST",0,0); PGPLOT::pglabel("X","Y","Dropped Galaxy"); PGPLOT::pgsci(5); PGPLOT::pgsls(1); my @cont = (-1,1000,2000,3000,4000,5000); PGPLOT::pgsci(5); PGPLOT::pgconx(\@image, 128, 128, 1,128,1,128, \@cont, 6, "squashplot"); PGPLOT::pgwnad(0,1000,0,1000); PGPLOT::pgend(); pass; done_testing; sub squashplot { my ($visible,$x,$y,$z) = @_; my $xworld = $x*$x/128; my $yworld = $y*$y/128; if ($visible) { PGPLOT::pgdraw($xworld,$yworld); }else{ PGPLOT::pgmove($xworld,$yworld); } } PGPLOT-2.27/t/t10.t0000644000175000017500000000370014012623747013441 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing multiple ways of passing things"; # Create 138x128 image - note must use transpose as # perl is column major like C (see docs) my $k=0; my (@img1D, @img2D); for(my $i=0; $i<128; $i++) { for(my $j=0; $j<138; $j++) { $img2D[$i][$j] = sqrt($i*$j) / 128; $img1D[$k] = $img2D[$i][$j]; $k++; # For 1D test }} my $imgchar = pack("f*",@img1D); PGPLOT::pgbegin(0,$dev,2,2); # Open plot device note "Plotting..."; my @tr=(0,1,0,0,0,1); my @x=(10,20,30,40,50,60,70,80,90,100,110); my @y=(30,35,40,45,50,55,60,65,70,75, 80); nextplot('Points: scalars passed one by one','Image: packed char string'); PGPLOT::pggray($imgchar,138,128,1,138,1,128,1,0,\@tr); for(my $i=0; $i<11; $i++){ PGPLOT::pgpt(1,$x[$i],$y[$i],17) } nextplot('Points: 1D array passed by glob','Image: 1D array passed by glob'); PGPLOT::pggray(\@img1D,138,128,1,138,1,128,1,0,\@tr); PGPLOT::pgpt(11,\@x,\@y,17); nextplot('Points: 1D array passed by reference','Image: 1D array passed by reference'); PGPLOT::pggray(\@img1D,138,128,1,138,1,128,1,0,\@tr); PGPLOT::pgpt(11,\@x,\@y,17); nextplot('Line: 1D cross-section of 2D array','Image: 2D array passed by reference'); PGPLOT::pggray(\@img2D,138,128,1,138,1,128,1,0,\@tr); PGPLOT::pgwindow(0,128,0,1); PGPLOT::pgline(128, [0..127], $img2D[127]); PGPLOT::pgend(); pass; done_testing; sub nextplot { note $_[0]; note $_[1]; note "--------------------------------------"; PGPLOT::pgpage(); PGPLOT::pgwnad(0,128,0,128); PGPLOT::pgsci(3); PGPLOT::pgsch(1.3); PGPLOT::pgbox("BCST",0,0,"BCST",0,0); if ($^O ne 'freebsd') { # blows up for some reason PGPLOT::pgmtext('T',1.0,0.2,0,$_[0]); PGPLOT::pgmtext('T',2.4,0.2,0,$_[1]); } PGPLOT::pgsci(4); } PGPLOT-2.27/t/t8.t0000644000175000017500000000200514012360571013356 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing scalars in array routines"; PGPLOT::pgbegin(0,$dev,1,1); # Open plot device PGPLOT::pgscf(2); PGPLOT::pgslw(4); PGPLOT::pgsch(1.6); PGPLOT::pgenv(10.0,30.0,-2.0,6.0,0,0); PGPLOT::pgsci(6); PGPLOT::pglabel("X axis \\gP","Y axis \\gF","Top Label \\gW"); PGPLOT::pgsci(7); PGPLOT::pgbbuf(); for(my $i=0; $i<10; $i++) { my $x = $i+15; my $y = $i-1; my $e = 0.9; my $x1 = $x - $e; my $x2 = $x + 2.0* $e; my $y1 = $y - 0.7* $e; my $y2 = $y + 0.3* $e; PGPLOT::pgsci(7); PGPLOT::pgpoint(1,$x,$y,$i+5); PGPLOT::pgsci(3); PGPLOT::pgerrb(3,1,$x,$y,4,3.0); PGPLOT::pgsci(2); PGPLOT::pgerrx(1,$x1,$x2,$y,1); PGPLOT::pgerry(1,$x,$y2,$y1,.1); } PGPLOT::pgebuf(); PGPLOT::pgiden(); PGPLOT::pgend(); pass; done_testing; PGPLOT-2.27/t/t2.t0000644000175000017500000001325314012623711013355 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing advanced point and line plot routines"; PGPLOT::pgbegin(0,$dev,1,1); PGPLOT::pgscf(2); # Set label character font PGPLOT::pgslw(4); # Set line width PGPLOT::pgsch(1.6); # Set label character height PGPLOT::pgenv(10.0,30.0,-2.0,6.0,0,0); PGPLOT::pgsci(6); PGPLOT::pglabel("X axis \\gP","Y axis \\gF","Top Label \\gW"); PGPLOT::pgsci(7); my $i=-1; our (@x, @y, @e, @x1, @x2, @y1, @y2); while(){ $i++; ($x[$i], $y[$i]) = split(' '); } PGPLOT::pgline($i,*x,*y); PGPLOT::pgsci(3); for($i=0; $i<10; $i++) { $x[$i] = $i+15; $y[$i] = $i-1; $e[$i] = 0.9; $x1[$i] = $x[$i] - $e[$i]; $x2[$i] = $x[$i] + 2.0* $e[$i]; $y1[$i] = $y[$i] - 0.7* $e[$i]; $y2[$i] = $y[$i] + 0.3* $e[$i]; } PGPLOT::pgpoint(10,\@x,\@y,14); PGPLOT::pgerrx(10,\@x1,\@x2,*y,1); PGPLOT::pgerry(10,*x,*y2,*y1,.1); # Note we can also pass globs PGPLOT::pgsci(2); PGPLOT::pgsah(1,30,0.5); PGPLOT::pgarro(20,0,25,2); PGPLOT::pgmtext('B', -2.0, 0.95, 1, "This is a test") if $^O ne 'freebsd'; # blows up for some reason PGPLOT::pgsci(9); PGPLOT::pgptxt(25,2,35,0,'This way...'); PGPLOT::pgqinf("CURSOR", my $ans, my $l); if ($ans eq "YES") { diag "Entering interactive cursor test...\n"; PGPLOT::pgsci(4); diag "Enter some points with the cursor, press 'x' when done\n"; our (@xt, @yt); PGPLOT::pglcur(5, (my $n = 0),\@xt,\@yt); PGPLOT::pgsci(9); PGPLOT::pgpoint($n,*xt,*yt,20); for(@xt) { diag sprintf "%5.2f ",$_; } for(@yt) { diag sprintf "%5.2f ",$_; } PGPLOT::pgsci(2); PGPLOT::pgpoly($n,\@xt,\@yt); } PGPLOT::pgiden(); PGPLOT::pgend(); pass; done_testing; __DATA__ 17.000000000000 1.8515548576633 17.090909090909 1.8907204814559 17.181818181818 1.9295359694614 17.272727272727 1.9680015320877 17.363636363636 2.0061177764022 17.454545454545 2.0438854788985 17.545454545455 2.0813053106065 17.636363636364 2.1183775285123 17.727272727273 2.1551016548418 17.818181818182 2.1914761754610 17.909090909091 2.2274982964675 18.000000000000 2.2631637990568 18.090909090909 2.2984670235480 18.181818181818 2.3334009941233 18.272727272727 2.3679576705054 18.363636363636 2.4021282884047 18.454545454545 2.4359037344501 18.545454545455 2.4692748984585 18.636363636364 2.5022329570773 18.727272727273 2.5347695641881 18.818181818182 2.5668769479863 18.909090909091 2.5985479346970 19.000000000000 2.6297759289711 19.090909090909 2.6605548795749 19.181818181818 2.6908792486119 19.272727272727 2.7207439885008 19.363636363636 2.7501445190802 19.454545454545 2.7790766916671 19.545454545455 2.8075367289695 19.636363636364 2.8355211378950 19.727272727273 2.8630266031458 19.818181818182 2.8900498792887 19.909090909091 2.9165877047968 20.000000000000 2.9426367619456 20.090909090909 2.9681937015030 20.181818181818 2.9932552421733 20.272727272727 3.0178183437014 20.363636363636 3.0418804415552 20.454545454545 3.0654397220766 20.545454545455 3.0884954112766 20.636363636364 3.1110480486517 20.727272727273 3.1330997194487 20.818181818182 3.1546542241000 20.909090909091 3.1757171712601 21.000000000000 3.1962959901364 21.090909090909 3.2163998676902 21.181818181818 3.2360396257475 21.272727272727 3.2552275607789 21.363636363636 3.2739772736228 21.454545454545 3.2923035164850 21.545454545455 3.3102220796353 21.636363636364 3.3277497309551 21.727272727273 3.3449042097046 21.818181818182 3.3617042642169 21.909090909091 3.3781697143502 22.000000000000 3.3943215153121 22.090909090909 3.4101818004154 22.181818181818 3.4257738855463 22.272727272727 3.4411222258316 22.363636363636 3.4562523231832 22.454545454545 3.4711905905443 22.545454545455 3.4859641839488 22.636363636364 3.5006008167596 22.727272727273 3.5151285717900 22.818181818182 3.5295757265490 22.909090909091 3.5439706045569 23.000000000000 3.5583414614507 23.090909090909 3.5727164084470 23.181818181818 3.5871233678865 23.272727272727 3.6015900466180 23.363636363636 3.6161439038134 23.454545454545 3.6308120817070 23.545454545455 3.6456212622683 23.636363636364 3.6605974115804 23.727272727273 3.6757653780882 23.818181818182 3.6911483216329 23.909090909091 3.7067669668871 24.000000000000 3.7226386953562 24.090909090909 3.7387765105380 24.181818181818 3.7551879257226 24.272727272727 3.7718738281295 24.363636363636 3.7888273645828 24.454545454545 3.8060328765675 24.545454545455 3.8234648968141 24.636363636364 3.8410872196533 24.727272727273 3.8588520839843 24.818181818182 3.8766995601456 24.909090909091 3.8945572940574 25.000000000000 3.9123408056662 25.090909090909 3.9299545354314 25.181818181818 3.9472937671957 25.272727272727 3.9642474355297 25.363636363636 3.9807016791172 25.454545454545 3.9965438681261 25.545454545455 4.0116667476424 25.636363636364 4.0259723198282 25.727272727273 4.0393751330183 25.818181818182 4.0518047388756 25.909090909091 4.0632071938271 26.000000000000 4.0735455942983 PGPLOT-2.27/t/t4.t0000644000175000017500000000246714012357377013400 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing greyscale, contour and vector routines"; # Read in image (int*2) my $img=""; open my $fh, "test.img" or die "Data file test.img not found: $!"; binmode $fh if $^O =~ /mswin32/i; read($fh, $img, 32768); close $fh or die "Can't close test.img: $!"; note length($img)," bytes read\n"; my @image = unpack("n*",$img); note $#image+1," element image stored\n"; PGPLOT::pgbegin(0,$dev,1,1); note "Plotting...\n"; PGPLOT::pgsci(3); PGPLOT::pgwnad(12000,13000,13000,12000); my @tr=(12000,8,0,12000,0,8); PGPLOT::pggray(\@image,128,128,1,128,1,128,5000,0,\@tr); PGPLOT::pglabel("\\ga","\\gd","Galaxy"); PGPLOT::pgtbox("ZYHBCNST",0,0,"ZYDBCNST",0,0); PGPLOT::pgwedg('R', 2, 5, 5000, 0, 'Counts'); PGPLOT::pgsci(4); PGPLOT::pgsls(1); my @cont = (-1,1000,2000,3000,4000,5000); PGPLOT::pgcons(\@image, 128, 128, 1,128,1,128, \@cont, 6, \@tr); PGPLOT::pgwnad(0,1000,0,1000); @tr=(0,100,0,0,0,100); PGPLOT::pgsah(1,30,0.5); PGPLOT::pgsci(2); PGPLOT::pgvect([(30) x 100], [(50) x 100], 10, 10, 1,9,1,9, 1, 1, \@tr, -10000); PGPLOT::pgend(); pass; done_testing; PGPLOT-2.27/t/t1.t0000644000175000017500000000233514012355007013353 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; diag <){ # Read data in 2 columns from file handle # and put in two perl arrays ($x[$i], $y[$i]) = split(' '); $i++; } # Plot points - note how perl arrays are passed PGPLOT::pgpoint($i,\@x,\@y,17); PGPLOT::pgend(); # Close plot pass; done_testing; __DATA__ 1 -4.5 2 -4 3 -3.2 4 -2.1 5 -1 6 0.3 7 1.2 8 2.4 9 2.9 PGPLOT-2.27/t/t5.t0000644000175000017500000000162514012357655013373 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; PGPLOT::pgbegin(0,$dev,2,2); PGPLOT::pgsci(3); PGPLOT::pgscf(2); PGPLOT::pgsch(1.4); my $pi=3.141592654; # Anonymous subs! PGPLOT::pgfunx(sub{ sqrt($_[0]) }, 500, 0, 10, 0); PGPLOT::pgfuny(sub{ sin(4*$_[0]) }, 360, 0, 2*$pi, 0); # Pass by name and pass by reference PGPLOT::pgfunt("funt_x", "funt_y", 360,0, 2*$pi, 0); PGPLOT::pgfunt(\&funt_x2, \&funt_y2, 360,0, 2*$pi, 0); PGPLOT::pgend(); pass; done_testing; sub funt_x { my($t)=$_[0]; return cos($t);; } sub funt_y { my($t)=$_[0]; return sin($t); } sub funt_x2 { my($t)=$_[0]; return cos(4*$t)*cos($t);; } sub funt_y2 { my($t)=$_[0]; return cos(4*$t)*sin($t); } PGPLOT-2.27/t/t9.t0000644000175000017500000000450214012361222013355 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing PGPLOT 5.0 colour image routines"; # Read in image (int*2) my $img=""; open(my $fh,"test.img") || die "Data file test.img not found"; if($^O =~ /mswin32/i) {binmode($fh)} read($fh, $img, 32768); close($fh) or die "Can't close test.img: $!"; note length($img)," bytes read"; my @image = unpack("n*",$img); note $#image+1," element image stored"; PGPLOT::pgbegin(0,$dev,1,1); # Open plot device note "Plotting..."; PGPLOT::pgsci(3); PGPLOT::pgwnad(12000,13000,13000,12000); my @tr=(12000,8,0,12000,0,8); PGPLOT::pgimag(\@image,128,128,1,128,1,128,0,5000,\@tr); PGPLOT::pglabel("\\ga","\\gd","Galaxy"); PGPLOT::pgtbox("ZYHBCNST",0,0,"ZYDBCNST",0,0); # Note: pgimag() usually defaults to a grey scale unless you explicitly set # a colour ramp look-up table with pgctab(). Because it is a look # up table it can be set after drawing the image. It is best to set an # explicit LUT as a grey scale default can not be guaranteed on all devices. # Set PHIL2 colour table my @l=(0,0.004,0.502,0.941,1); my @r=(0,0,1,1,1); my @g=(0,0,0.2,1,1); my @b=(0,0.2,0,0.1,1); PGPLOT::pgctab(\@l,\@r,\@g,\@b,5,1,0.5); PGPLOT::pgsci(4); PGPLOT::pgsls(1); my @cont = (-1,1000,2000,3000,4000,5000); PGPLOT::pgcons(\@image, 128, 128, 1,128,1,128, \@cont, 6, \@tr); for(@cont){ PGPLOT::pgconl(\@image, 128, 128, 1,128,1,128, $_, \@tr, $_,200,100); } PGPLOT::pgsci(4); PGPLOT::pgscf(2); my (@xbox, @ybox); PGPLOT::pgqtxt(12125,12100,45,0.5,'PGPLOT...',\@xbox,\@ybox); PGPLOT::pgpoly(4,\@xbox, \@ybox); PGPLOT::pgsci(7); PGPLOT::pgptxt(12125,12100,45,0.5,'PGPLOT...'); PGPLOT::pgqinf("CURSOR",my $ans,my $l); if ($ans eq "YES") { for(my $mode=0; $mode<8; $mode++){ note "Entering interactive PGBAND test MODE=$mode, hit any key, Q to exit early..."; PGPLOT::pgsci($mode+1); PGPLOT::pgband($mode,0,12500,12500,my $x,my $y,my $ch); last if $ch eq "q" || $ch eq "Q"; PGPLOT::pgqtxt($x,$y,45,0.5,'PGPLOT...',\@xbox,\@ybox); PGPLOT::pgpoly(4,\@xbox, \@ybox); PGPLOT::pgsci($mode+2); PGPLOT::pgptxt($x,$y,45,0.5,'PGPLOT...'); }} PGPLOT::pgend(); pass; done_testing; PGPLOT-2.27/t/t7.t0000644000175000017500000000155014012360354013360 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing pghi2d routine"; # Read in image (int*2) my $img=""; open(my $fh,"test.img") || die "Data file test.img not found"; if($^O =~ /mswin32/i) {binmode($fh)} read($fh, $img, 32768); close($fh) or die "Can't close test.img: $!"; note length($img)," bytes read"; my @image = unpack("n*",$img); note $#image+1," element image stored"; PGPLOT::pgbegin(0,$dev,1,1); note "Plotting\n"; PGPLOT::pgenv(0,256,0,65000,0,0); PGPLOT::pgsci(5); my @xvals = (1..128); my @work = (1..128); PGPLOT::pghi2d(\@image, 128, 128, 1,128,1,128, \@xvals, 1, 200, 1, \@work); PGPLOT::pgend(); pass; done_testing; PGPLOT-2.27/t/t11.t0000644000175000017500000000632014012362352013433 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing Object-Oriented stuff"; PGPLOT::pgbegin(9,$dev,1,1); PGPLOT::pgwnad(-100,100,-100,100); PGPLOT::pgpage(); PGPLOT::pgbox('BC',0,0,'BC',0,0); # Define some object classes ############################################################## package Square; # Create a new Square - colour is first argument sub new { my $type = shift; # Ignore as we know we are a Square; my $self = {}; # $self is ref to anonymous hash my $colour = shift; $colour = 2 unless defined($colour); # Default is red $self->{'Colour'}=$colour; $self->{'Xvertices'} = [-10, 10, 10,-10, -10]; # Initialise as square $self->{'Yvertices'} = [-10,-10, 10, 10, -10]; bless $self; } # Method to plot a Square object at $x,$y sub plot { my $self = shift; my($x,$y) = @_; my(@xpts) = @{$self->{'Xvertices'}}; my(@ypts) = @{$self->{'Yvertices'}}; for (@xpts) { $_ = $_ + $x } for (@ypts) { $_ = $_ + $y } PGPLOT::pgsci($self->{'Colour'}); PGPLOT::pgpoly(scalar(@xpts), \@xpts, \@ypts); PGPLOT::pgsci(1); PGPLOT::pgline(scalar(@xpts), \@xpts, \@ypts); } # Method to expand a Square object sub expand { my $self = shift; my $fac = shift; my $xpts = $self->{'Xvertices'}; my $ypts = $self->{'Yvertices'}; for (@$xpts) { $_ = $_ * $fac } for (@$ypts) { $_ = $_ * $fac } } # Method to rotate a Square object sub rotate { my $self = shift; my $angle = (shift)*(3.141592564/180); my $x = $self->{'Xvertices'}; my $y = $self->{'Yvertices'}; my ($x2,$y2); for(my $i=0; $i<=$#{$x}; $i++) { $x2 = $$x[$i]*cos($angle) + $$y[$i]*sin($angle); $y2 = -$$x[$i]*sin($angle) + $$y[$i]*cos($angle); $$x[$i] = $x2; $$y[$i] = $y2; } } ############################################################## package Triangle; # Only difference is "new" method. Otherwise inherit # all other properties from "Square"; our @ISA = qw( Square ); # Create a new Triangle sub new { my $type = shift; # Ignore as we know we are a Square; my $self = {}; # $self is ref to anonymous hash my $colour = shift; $colour = 3 unless defined($colour); # Default is green $self->{'Colour'}=$colour; $self->{'Xvertices'} = [-10, 10, 0, -10]; # Initialise as square $self->{'Yvertices'} = [-10,-10, 5, -10]; bless $self; } ############################################################## # Now let's use these objects package main; note "Testing Square Objects..."; my $shape1 = new Square; # Plot first shape at 50,50; note "Square plot method..."; $shape1->plot(50,50); note "Square expand and rotate methods..."; $shape1->expand(2.3); # Make the shape bigger $shape1->rotate(20); # Rotate the shape bigger $shape1->plot(-20,-50); note "Inheriting Square methods in Triangles..."; my $shape2 = new Triangle; $shape2->plot(-20,50); my $shape3 = new Triangle(4); # Blue triangle $shape3->rotate(-15); $shape3->expand(1.5); $shape3->plot(50,-50); PGPLOT::pgend(); pass; done_testing; PGPLOT-2.27/t/t12.t0000644000175000017500000000330214012363766013443 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing some new PGPLOT 5.2.0 routines"; PGPLOT::pgqinf("VERSION", my $val, my $len); $val =~ s/\.//g; $val =~ s/v//; plan skip_all => "PGPLOT version must be > 5.2.0 for this test $val\n" if $val<520; # Read in image (int*2) my $img=""; open(my $fh,"test.img") || die "Data file test.img not found"; if($^O =~ /mswin32/i) {binmode($fh)} read($fh, $img, 32768); close($fh) or die "can't close test.img: $!"; note length($img)," bytes read"; my @image = unpack("n*",$img); note $#image+1," element image stored"; PGPLOT::pgbegin(0,$dev,1,1); note "Plotting"; PGPLOT::pgsci(3); PGPLOT::pgwnad(12000,13000,13000,12000); my @tr=(12000,8,0,12000,0,8); PGPLOT::pglabel("\\ga","\\gd","Galaxy"); PGPLOT::pgtbox("ZYHBCNST",0,0,"ZYDBCNST",0,0); PGPLOT::pgsci(4); PGPLOT::pgconf(\@image, 128, 128, 1,128,1,128, 1000,2000, \@tr); PGPLOT::pgsci(2); PGPLOT::pgconf(\@image, 128, 128, 1,128,1,128, 2000,3000, \@tr); my @cont = (-1,1000,2000,3000,4000,5000); PGPLOT::pgsci(7); PGPLOT::pgcons(\@image, 128, 128, 1,128,1,128, \@cont, 6, \@tr); PGPLOT::pgsci(1); PGPLOT::pgaxis('LN2',12500,12800,12900,12100,1,4,0,0, 1,2,0.5, -2,30); PGPLOT::pgtick(12500,12800,12900,12100, 0.35, 3,5, 6,90,'pgperl!'); PGPLOT::pgqndt(my $ndrivers); note "Testing pgqdt() - $ndrivers drivers found"; for my $n (1..$ndrivers) { PGPLOT::pgqdt($n,my $type,my $tlen,my $descr,my $dlen,my $inter); note "$n: $type $tlen $descr $dlen $inter"; } PGPLOT::pgend(); pass; done_testing; PGPLOT-2.27/t/t3.t0000644000175000017500000000127014012356745013364 0ustar osboxesosboxesuse strict; use warnings; use Test::More; use Config; # Stop f77-linking causing spurious undefined symbols (alpha) $ENV{'PERL_DL_NONLAZY'}=0 if $Config{'osname'} eq "dec_osf"; require PGPLOT; my $dev = $ENV{PGPLOT_DEV} || '/NULL'; $ENV{PGPLOT_XW_WIDTH}=0.3; note "Testing histogram routines"; my $i=0; my @data=(); while(){ $i++; chop; $data[$i-1] = $_; } PGPLOT::pgbegin(0,$dev,1,1); PGPLOT::pgscf(2); PGPLOT::pgslw(4); PGPLOT::pgsch(1.6); PGPLOT::pgsci(6); PGPLOT::pgsci(7); PGPLOT::pghist($i,\@data,0,10,10,2); PGPLOT::pglabel("Data Value","Number of data items","Test histogram"); PGPLOT::pgend(); pass; done_testing; __DATA__ 1 1 2 3 4 7 3 5 7 3 5 6 2 2 2 2 1 6 7 PGPLOT-2.27/pgcompatbility.p0000644000175000017500000000145513435120245015613 0ustar osboxesosboxes ;# Single point routines provided for backwards compatability ;# with old perl4 version of pgperl - note array routines ;# can now be used directly, e.g.: pgpt(1,$x,$y,$symbol) etc. sub pgerrb1 { die 'Usage: &pgerrb1($dir,$x,$y,$e,$t)' if (scalar(@_)!=5); local($dir,$x,$y,$e,$t) = @_; pgerrb($dir,1,$x,$y,$e,$t); } sub pgerrx1 { die 'Usage: &pgerrx1($x1,$x2,$y,$t)' if (scalar(@_)!=4); local($x1,$x2,$y,$t) = @_; pgerrx(1,$x1,$x2,$y,$t); } sub pgerry1 { die 'Usage: &pgerry1($x,$y1,$y2,$t)' if (scalar(@_)!=4); local($x,$y1,$y2,$t) = @_; pgerry(1,$x,$y1,$y2,$t); } sub pgpoint1 {pgpt1(@_)} sub pgpt1 { die 'Usage: &pgpt1($xpts,$ypts,$symbol)' if (scalar(@_)!=3); local($xpts,$ypts,$symbol) = @_; pgpt(1,$xpts,$ypts,$symbol); } ;# Exit with OK status 1; PGPLOT-2.27/HINTS.osf0000644000175000017500000000221013435120245013767 0ustar osboxesosboxes Digital Unix (dec_osf) ---------------------- Often a problem like this: apollo% perl -Iblib test.pl Default Device for plot tests [recommend /XSERVE] ? ============== Running test1.p ============== Can't load '/scratch/astrop/vjm/build/PGPLOT-2.11/blib/arch/auto/PGPLOT/PGPLOT.so' for module PGPLOT: dlopen: cannot load /scratch/astrop/vjm/build/PGPLOT-2.11/blib/arch/auto/PGPLOT/PGPLOT.so at /usr/physics/lib/perl5/DynaLoader.pm line 140, chunk 1. at /scratch/astrop/vjm/build/PGPLOT-2.11/blib/lib/PGPLOT.pm line 29 BEGIN failed--compilation aborted at test1.p line 3, chunk 1. The answer: From: Vince McIntyre Karl the immediate problem was LD_LIBRARY_PATH and the bastard OSF/1 ld. When I added /usr/X11R6/lib to LD_LIBRARY_PATH, the module loads ok. The problem appears to be that our libcpgplot doesn't have runtime paths embedded, and we need LD_LIBRARY_PATH. So you're off the hook :-) All I have to do now is figure out what's wrong with our installation of the pgplot x11 devices... Thanks for listening Vince ------------------------------------------------------------------------------ PGPLOT-2.27/pgfun.c0000644000175000017500000000714214012370505013663 0ustar osboxesosboxes /* This file contains miscelleneous C code which is required to initialise the module and handle C<->perl function passing. */ /* Alternate ways of calling F77 from C */ #ifdef NO_TRAILING_USCORE #define PGFUNX pgfunx #define PGFUNY pgfuny #define PGFUNT pgfunt #define PGCONX pgconx #else #define PGFUNX pgfunx_ #define PGFUNY pgfuny_ #define PGFUNT pgfunt_ #define PGCONX pgconx_ #endif /* Prototypes */ static SV* pgfunname[2]; float pgfun1(); float pgfun2(); void pgfunplot(); void PGFUNX(float fy(), int *n, float *xmin, float *xmax, int *pgflag); void PGFUNY(float fx(), int *n, float *ymin, float *ymax, int *pgflag); void PGFUNT(float fx(), float fy(), int *n, float *tmin, float *tmax, int *pgflag); void PGCONX(float *a, int *idim, int *jdim, int *i1, int *i2, int *j1, int *j2, float *c, int *nc, void plot()); /* CPGPLOT prototypes missing in PGPLOT 5 - these handle passed functions. Mechanism used below only works with standard UNIX C/F77 passing. I have yet to find a system where this doesn't work but pacthes are welcome. */ cpgfunx (float pgfun1(), int n, float xmin, float xmax, int pgflag) { PGFUNX(pgfun1,&n,&xmin,&xmax,&pgflag); } cpgfuny (float pgfun1(), int n, float ymin, float ymax, int pgflag) { PGFUNY(pgfun1,&n,&ymin,&ymax,&pgflag); } cpgfunt (float pgfun1(), float pgfun2(), int n, float tmin, float tmax, int pgflag) { PGFUNT(pgfun1,pgfun2,&n,&tmin,&tmax,&pgflag); } cpgconx ( float* a, int idim, int jdim, int i1, int i2, int j1, int j2, float* c, int nc, void pgfunplot()) { PGCONX(a,&idim,&jdim,&i1,&i2,&j1,&j2,c,&nc,pgfunplot); } /* The functions we actually pass to f77 - these call back to the correct perl function whose names(s) are passed via the back door (i.e. char static varables) */ /* pgplot called function perl intermediate number 1 */ float pgfun1(x) float *x; { dSP ; int count; SV* funname; float retval; funname = pgfunname[0]; /* Pass perl function name */ ENTER ; SAVETMPS ; PUSHMARK(sp) ; /* Push arguments */ XPUSHs(sv_2mortal(newSVnv(*x))); PUTBACK ; /* Call Perl */ count = perl_call_sv(funname, G_SCALAR); SPAGAIN; if (count !=1) croak("Error calling perl function\n"); retval = (float) POPn ; /* Return value */ PUTBACK ; FREETMPS ; LEAVE ; return retval; } /* pgplot called function perl intermediate number 2 */ float pgfun2(x) float *x; { dSP ; int count; SV* funname; float retval; funname = pgfunname[1]; /* Pass perl function name */ ENTER ; SAVETMPS ; PUSHMARK(sp) ; /* Push arguments */ XPUSHs(sv_2mortal(newSVnv(*x))); PUTBACK ; /* Call Perl */ count = perl_call_sv(funname, G_SCALAR); SPAGAIN; if (count !=1) croak("Error calling perl function\n"); retval = (float) POPn ; /* Return value */ PUTBACK ; FREETMPS ; LEAVE ; return retval; } /* pgplot called function perl intermediate for PGCONX */ void pgfunplot(visible,x,y,z) int *visible; float *x,*y,*z; { dSP ; int count; SV* funname; float retval; funname = pgfunname[0]; /* Pass perl function name */ ENTER ; SAVETMPS ; PUSHMARK(sp) ; /* Push arguments */ XPUSHs(sv_2mortal(newSViv(*visible))); XPUSHs(sv_2mortal(newSVnv(*x))); XPUSHs(sv_2mortal(newSVnv(*y))); XPUSHs(sv_2mortal(newSVnv(*z))); PUTBACK ; /* Call Perl */ count = perl_call_sv(funname, G_SCALAR); SPAGAIN; if (count !=1) croak("Error calling perl function\n"); PUTBACK ; FREETMPS ; LEAVE ; } PGPLOT-2.27/CHANGES0000644000175000017500000001314314012625373013377 0ustar osboxesosboxes2.27 2021-02-16 - need ExtUtils::F77 import to work at least on FreeBSD - disable calls to pgmtext(!) in tests on FreeBSD 2.26 2021-02-15 - ExtUtils::F77 is not a runtime requirement - tests no longer ask for device - set the environment var (default /NULL) 2.25 2021-02-13 - macOS11 patch for LD flags - thanks @karlglazebrook - use Devel::CheckLib to find right PNG lib 2.24 2019-03-19 - doc updates - thanks @djerius - patches to use pkg-config if available - thanks @djerius 2.23 2019-03-17 - typo fix from gregor herrmann - add CONFIGURE_REQUIRES dep - thanks CHORNY for report 2.22 2019-03-17 - Minor change to Makefile.PL to add link with libpng12,libz (avoids PERL_DL_NONLAZY error with SciPDL), and also to search SciPDL directory /Applications/PDL/pgplot - fixes to tests to work on Perl 5.26+ - metadata updates 2.21 2011-01-01 - Semi-dirty hack in Makefile.PL to force i386/x86_64 single arch only builds on Mac OS X. - Karl (for libpgplot compatibility which seems to be generally built this way, e.g. in SciKarl) Note added some clever code to try and match the arch of the pgplot binaries. - PGPLOT::HANDLE warning fix (Chris Phillips Jun 2010) - Make linking order -lcpgplot -lpgplot for cygwin (Chris Marshall Dec 2010) 2.20 2007-05-16 - Doug Burke's Makefile.PL patch - re-org and better OS X support. - Added /usr/local/pgplot to the include search path - Added -png to the default list of libs as just about every pgplot build needs this - Now works cleanly on Intel and PPC OS X with gcc, g77 and gfortran - Added INSTALL, INSTALL-MacOSX and INSTALL-Win32 instruction files and updated README 2.19 2006-01-03 - Diab's patch to allow specifying alternate libary paths on the command line (see HELP) - Added pgpt1 and pgerr1 back for compatibility with latest C PGPLOT - Win32 patches from Rob - Sisyphus (2005/1/25) 2.18 2000-12-28 - Added file HINTS.osf, updated HELP - Fixed memory leak in coerce1D (thanks to Pete Ratzlaff) - Added Doug Hunt's internals patch to export more pgplot C routines - Improvements to HELP file 2.17 2000-05-08 - Charles Lane's patch to do with new perl versions (PL_XXX stuff) - Changed my email address. 2.16 2000-03-10 - Added function struct to allow access to expose certain PGPLOT routines to the outside (currently cpgmove, cpgdraw) 2.15 1999-10-26 - Fixed Makefile.PL minor problem 2.14 1999-10-15 - Updated HELP some more. - Removed ExtUtils from distribution and made seperate to avoid confusing CPAN, is now a PREREQ_PM - Removed erroneous reference in PGPLOT.pm (Charles Lane). - Added HINTS.irix 2.13 1999-05-14 - Updates to ExtUtils::F77 (now v1.10) (q.t.) for RedHat 6.0 etc. 2.12 1999-05-11 - Added PGPLOT_DIR to path for include files. - Removed pgpt1 and pgerrb1 left over from old perl4 version - see pgcompatbility.p if you still need them. - Changed macro names for perl 5.004_53 (Joshua Pritikin ) and inserted a conditional so older perl's still work. - More ExtUtils::F77 changes (now at v1.09) - Small test.pl patch from Chuck Lane - Fixed error in test12.p 2.11 1998-09-11 - Added support for PGPLOT_DIR in Makefile.PL, updated HELP. - Mentioned 'perl Makefile.PL PREFIX=...' in README. - More HELP stuff. - ExtUtils::F77 v1.08 2.10 1998-05-21 - Various changes to ExtUtils::F77 q.v. 2.09 1998-02-17 - Documented xubpp problem in HELP because I got fed up with waiting for p5p to fix. No other changes. 2.08 1998-01-07 - Added improved -lgcc support. - PGPLOT version check in test12.p 2.07 1997-09-03 - Added support for new functions in PGPLOT 5.2.0 library. Note: TK driver looks nice but haven't yet implemented this in perl version. Presumably can be done with perl/Tk. - Extra test12.p for new routines - No longer supporting binary versions in any shape or form. Life is too short. Get a FORTRAN compiler. :-) - Added -lgcc for gcc built perls in ExtUtils::F77 2.06 1997-06-09 - Important bug fixes to array packing code which is now called arrays.{c,h} - Added fake MAIN__ symbol to stop annoying bug reports about some versions of gcc. :-) - arrays.c now supports unsigned chars and shorts. (Thanks Tim!) - Additions to HELP and documentation - Patches to improve ExtUtils::F77 - Improvements to tests - pgcompatibilty.p (NOT INSTALLED!) defines simple compatibilty routines for perl4 pgperl version. This had some gnarly single point versions of routines which are now superfluous. 2.02 1997-02-19 - Made Makefile.PL more clever. - Added a file HELP with useful problem fixing information. - Fixed some small type cast bugs in kgbpack.c 2.01 1997-01-03 - No longer providing perl4 version. - All the array packing functions reimplemented in C to improve speed and robustness. - Simplified build procedure - PGPLOT module should now build in standard Perl way. (i.e. 'perl Makefile.PL; make; make test; make install'). Makefile.PL should not have to be edited and upgrading should now be much easier. - Added 'pass by reference' convention to allow explicit use of pre-packed binary data. - Supports pgplot routines up to pgplot v5.1.1. - Added POD documentation. - FORTRAN link support is now via ExtUtils::F77 module (included). - Now providing binaries of pgplot libraries for various architectures rather than statically-linked module binaries. This should make upgrading easier. - Removed special one-point routine versions (hang-over from perl4 version). - Removed pgplot.pl (again a hang-over from old perl4 version). - General tidy up and reorganisation of distribution PGPLOT-2.27/PGPLOT.pm0000644000175000017500000001677714012625353013765 0ustar osboxesosboxespackage PGPLOT; $VERSION="2.27"; use Exporter; use DynaLoader; @ISA = qw(Exporter DynaLoader); @EXPORT = qw( pgarro pgask pgaxis pgband pgbbuf pgbeg pgbegin pgbin pgbox pgcirc pgclos pgconb pgconf pgconl pgcons pgcont pgconx pgctab pgcurs pgcurse pgdraw pgebuf pgend pgenv pgeras pgerrb pgerr1 pgerrx pgerry pgetxt pgfunt pgfunx pgfuny pggray pghi2d pghist pgiden pgimag pglab pglabel pglcur pgldev pglen pgline pgmove pgmtxt pgmtext pgncur pgncurse pgnumb pgolin pgopen pgpage pgadvance pgpanl pgpap pgpaper pgpixl pgpnts pgpoly pgpt pgpt1 pgpoint pgptxt pgptext pgqah pgqcf pgqch pgqci pgqclp pgqcir pgqcol pgqcr pgqcs pgqdt pgqfs pgqhs pgqid pgqinf pgqitf pgqls pgqlw pgqndt pgqpos pgqtbg pgqtxt pgqvp pgqvsz pgqwin pgrect pgrnd pgrnge pgsah pgsave pgunsa pgscf pgsch pgsci pgscir pgsclp pgscr pgscrl pgscrn pgsfs pgshls pgshs pgsitf pgslct pgsls pgslw pgstbg pgsubp pgsvp pgvport pgswin pgwindow pgtbox pgtick pgtext pgupdt pgvect pgvsiz pgvsize pgvstd pgvstand pgwedg pgwnad ); if($^O =~ /mswin32/i) { local $DynaLoader::dl_dlext = 'xs.dll'; bootstrap PGPLOT $VERSION; } else {bootstrap PGPLOT $VERSION} # return OK status 1; __DATA__ =head1 NAME PGPLOT - allow subroutines in the PGPLOT graphics library to be called from Perl. =head1 SYNOPSIS use PGPLOT; pgbegin(0,"/xserve",1,1); pgenv(1,10,1,10,0,0); pglabel('X','Y','My plot'); pgpoint(7,[2..8],[2..8],17); # etc... pgend; =head1 DESCRIPTION This module provides an inteface to the PGPLOT graphics library. To obtain the library and its manual, see L. For every PGPLOT function the module provides an equivalent Perl function with the same arguments. Thus the user of the module should refer to the PGPLOT manual to learn all about how to use PGPLOT and for the complete list of available functions. Note that PGPLOT is at its heart a Fortran library, so the documentation describes the Fortran interface. Also refer to the extensive set of test scripts (C) included in the module distribution for examples of usage of all kinds of PGPLOT routines. How the function calls map on to Perl calls is detailed below. =head2 Argument Mapping - Simple Numbers And Arrays This is more or less as you might expect - use Perl scalars and Perl arrays in place of FORTRAN/C variables and arrays. Any FORTRAN REAL/INTEGER/CHARACTER* scalar variable maps to a Perl scalar (Perl doesn't care about the differences between strings and numbers and ints and floats). Thus you can say: To draw a line to point (42,$x): pgdraw(42,$x); To plot 10 points with data in Perl arrays C<@x> and C<@y> with plot symbol no. 17. Note the Perl arrays are passed by reference: pgpoint(10, \@x, \@y, 17); You can also use the old Perl4 style: pgpoint(10, *x, *y, 17); but this is deprecated in Perl5. Label the axes: pglabel("X axis", "Data units", $label); Draw ONE point, see how when C C can take a scalar as well as a array argument: pgpoint(1, $x, $y, 17); =head2 Argument Mapping - Images And 2d Arrays Many of the PGPLOT commands (e.g. C) take 2D arrays as arguments. Several schemes are provided to allow efficient use from Perl: =over 4 =item 1. Simply pass a reference to a 2D array, e.g: # Create 2D array $x=[]; for($i=0; $i<128; $i++) { for($j=0; $j<128; $j++) { $$x[$i][$j] = sqrt($i*$j); } } pggray( $x, 128, 128, ...); =item 2. Pass a reference to a 1D array: @x=(); for($i=0; $i<128; $i++) { for($j=0; $j<128; $j++) { $x[$i][$j] = sqrt($i*$j); } } pggray( \@x, 128, 128, ...); Here @x is a 1D array of 1D arrays. (Confused? - see perldata(1)). Alternatively @x could be a flat 1D array with 128x128 elements, 2D routines such as C etc. are programmed to do the right thing as long as the number of elements match. =item 3. If your image data is packed in raw binary form into a character string you can simply pass the raw string. e.g.: read(IMG, $img, 32768); pggray($img, $xsize, $ysize, ...); Here the C function reads the binary data from a file and the C function displays it as a grey-scale image. This saves unpacking the image data in to a potentially very large 2D perl array. However the types must match. The string must be packed as a C<"f*"> for example to use C. This is intended as a short-cut for sophisticated users. Even more sophisticated users will want to download the C module which provides a wealth of functions for manipulating binary data. I: As PGPLOT is a Fortran library it expects its images to be be stored in row order. Thus a 1D list is interpreted as a sequence of rows end to end. Perl is similar to C in that 2D arrays are arrays of pointers thus images end up stored in column order. Thus using perl multidimensional arrays the coordinate ($i,$j) should be stored in $img[$j][$i] for things to work as expected, e.g: $img = []; for $j (0..$nx-1) for $i (0..$ny-1) { $$img[$j][$i] = whatever(); }} pggray($$img, $nx, $ny, ...); Also PGPLOT displays coordinate (0,0) at the bottom left (this is natural as the subroutine library was written by an astronomer!). =back =head2 Argument Mapping - Function Names Some PGPLOT functions (e.g. C) take functions as callback arguments. In Perl simply pass a subroutine reference or a name, e.g.: # Anonymous code reference: pgfunx(sub{ sqrt($_[0]) }, 500, 0, 10, 0); # Pass by ref: sub foo { my $x=shift; return sin(4*$x); } pgfuny(\&foo, 360, 0, 2*$pi, 0); # Pass by name: pgfuny("foo", 360, 0, 2*$pi, 0); =head2 Argument Mapping - General Handling Of Binary Data In addition to the implicit rules mentioned above PGPLOT now provides a scheme for explicitly handling binary data in all routines. If your scalar variable (e.g. C<$x>) holds binary data (i.e. 'packed') then simply pass PGPLOT a reference to it (e.g. C<\$x>). Thus one can say: read(MYDATA, $wavelens, $n*4); read(MYDATA, $spectrum, $n*4); pgline($n, \$wavelens, \$spectrum); This is very efficient as we can be sure the data never gets copied and will always be interpreted as binary. Again see the L module for sophisticated manipulation of binary data, since it takes great advantage of these facilities. See in particular L. Be VERY careful binary data is of the right size or your segments might get violated. =head1 HISTORY Originally developed in the olden days of Perl4 (when it was known as 'pgperl' due to the necessity of making a special perl executable) PGPLOT is now a dynamically loadable perl module which interfaces to the FORTRAN graphics library of the same name. =head1 OBTAINING PGPLOT PGPLOT is a FORTRAN library with C bindings, While the Perl module uses the latter, a FORTRAN compiler is still required to build the library. The official library and the manual are available from L Building the library using the official distribution is arcane, tedious, and error-prone. Additionally, the official distribution lacks a number of bug fixes and additions provided by the community over the years. A modern packaging (using the GNU autotools) of the more up-to-date code base is available from L The packaging has been tested on Linux and Mac OS X. Source code is available at either of these sites =over =item L =item L =back =head1 AUTHORS Karl Glazebrook Ekgb@aaoepp.aao.gov.auE PGPLOT-2.27/HELP0000644000175000017500000001504413435120245013055 0ustar osboxesosboxes List of various gotchas! ------------------------ Last Change: Jan 3rd, 2006. Karl Glazebrook. ExtUtils::F77 ------------- This module requires installation of ExtUtils::F77 to compile. The latest version is v1.13 so you probably better get that from CPAN (www.cpan.org) Non-standard PATHs ------------------ If your PGPLOT, X11, etc. libs are located in non-standard places you may use the following command line command line options to "perl Makefile.PL" which take comma separated lists of values. The possible options are: * XDIR: The directories to search for X11 libraries (without the -L) * XLIB: The X11 libraries to link (without the -l * IDIR: The PGPLOT include directory * LDIR: The PGPLOT library directory * EXLIB: extra libraries to link (in my case it's png,z) * EXDIR: Library directories for the extra libraries perl5.004_?? problem -------------------- If you type 'make' and see an error message like: /usr/bin/perl -I/usr/lib/perl5/i586-linux/5.00404 -I/usr/lib/perl5 /usr/lib/perl5/ExtUtils/xsubpp -typemap /usr/lib/perl5/ExtUtils/typemap -typemap typemap PGPLOT.xs >PGPLOT.tc && mv PGPLOT.tc PGPLOT.c make: *** [PGPLOT.c] Error 139 (sometimes with a segmentation violation or bus error) Then you have encountered a bug in perl versions 5.004_01 and later (5.004 itself works just fine). The generation of PGPLOT.c from PGPLOT.xs fails because of a bug in xsubpp to do with handling of line numbers (of all things). This has been reported and ought to be fixed. Meanwhile here is a workaround: Edit the 'Makefile' which has been generated by the 'perl Makefile.PL ...' command and add the '-nolinenumbers' option to the xsubpp call. The line should look something like: XSUBPPARGS = -nolinenumbers -typemap $(XSUBPPDIR)/typemap -typemap typemap Then type 'make' again and everything should work. Common Problems and Possible Solutions -------------------------------------- *** First check the HINTS.* files for OS-specific problems. *** If you have libpgplot set up following the recommended defaults and the Makefile.PL recognises your system then Perl/PGPLOT should build out of the box. If you don't you may experience problems. Read on for possible fixes. Patches for ExtUtils::F77, to make it even smarter, are very welcome! o Check the -lX11 you are linking with is the same one that libpgplot was built against! This can cause the module to die with a very unhelpful error. Use -L/dir to fix this. o If 'make test' does not work try 'perl -Mblib test.pl'. Sometimes one can get funny dynamic loading problem. [The former sets PERL_DL_NONLAZY=1 which makes it fail on any unresolved symbol. Sometimes this is wrong.] If 'perl -Mblib test.pl' produces sensible graphs it is probably safe to do a 'make install'. o Next make sure you can compile, link and run successfully PGPLOT C programs (e.g. 'cpgdemo' in the PGPLOT distribution). If not you will not be able to run the perl version. A common requirement is to set the environment variable PGPLOT_DIR if PGPLOT is installed in a non-standard location. o You may experience problems if the module does not 'know' about the FORTRAN/C interface on your architecture. Please contact me and I will try to help if I have time. Alternatively - install GNU-77! (You gnu it makes sense...) and edit 'Makefile.PL' to select GNU-77 (this is the default on Linux, etc. anyway). o If you are using f2c based Fortran compilers (e.g. g77 or f2c) then it is possible that it is not picking this fact up. [e.g. on systems where the default f77 is something else like Solaris. Note is is SUPPOSED to figure this out. :-)]. In such cases try editing the line: use ExtUtils::F77; to become: use ExtUtils::F77 qw(generic g77); o Make sure when you build the pgplot library you did a 'make cpg' to create the C library and the cpgplot.h header file. o See if you can compile and run the C program cpgdemo.c which comes with the pgplot library itself - 'make cpg' in the pgplot build sequence. If this fails there is no way the PGPLOT module will work. o Check Perl normal dynamic loading works, try: perl -e 'use Socket' and see if there are any errors. If you contact me I can supply a simple test module. o Using Linux and G77, you might need to ensure that libf2c.a is present in the normal library search path. You might also need to add ' -lgcc' after the fortran runtime library in Makefile.PL o If using G77 check the library /usr/lib/libf2c.a is the one that came with g77 and not an older one that comes with F2C. Check also that is is not picking up an older shared library (e.g. /usr/lib/libf2c.so) that does not correspond to the current libf2c.a. The g77 one should be a link to libg77, e.g.: lrwxrwxrwx 1 root root 42 Aug 28 16:17 /usr/lib/libf2c.a -> /usr/lib/gcc-lib/i486-linux/2.7.2/libg77.a o Check the cc compiler you used to build cpgplot is the same one you used to build Perl (this is the one invoked by Makefile.PL) o Using the PGPLOT module with a dynamically loaded libpgplot library on some UNIX systems CAN be problematic (many confusing possibilites of -L/-R/LD_LIBRARY_PATH/LD_RUN_PATH exist). Commonly the module builds with no errors but fails to plot anything. You can maybe fix this by ensuring the pgplot libraries are linked in to /usr/local/lib/ (as per the pgplot install instructions) or alternatively playing with LD_LIBRARY_PATH. If this fails try deleting the libpgplot.so* or libpgplot.sl* shareable library (or at least move it to /tmp!). Alternatively, if you don't have system priviledge, try this dirty hack: mkdir pgplot_tmp cp /usr/local/pgplot/lib*pgplot.a pgplot_tmp ranlib pgplot_tmp/* (don't worry if the 'ranlib' command gives an error - many UNIX systems don't have or need it.) Now start from the top again. The Makefile.PL will automatically detect 'pgplot_tmp' and link in these files statically. o Finally, if you mail me for help include in your message the complete log output of: perl -V; perl Makefile.PL; make; make test Architecture-Specific Problems/Tips ----------------------------------- HP systems - Try using c89 with HP's fort77 compiler rather than gcc. (e.g. if you get a message about not being able to resolve symbol '__main__') DEC Alphas - are suceptible to the LD_LIBRARY_PATH problems mentioned above. RedHat 5.2 is reported to work with the following RPMs for C and FORTRAN :- egcs-c++-1.0.3a-1 egcs-1.0.3a-1 egcs-objc-1.0.3a-1 egcs-g77-1.0.3a-1 f2c-19970805-3 PGPLOT-2.27/META.yml0000644000175000017500000000125414012625446013656 0ustar osboxesosboxes--- abstract: unknown author: - unknown build_requires: ExtUtils::MakeMaker: '0' Test::More: '0.88' configure_requires: Devel::CheckLib: '1.14' ExtUtils::F77: '1.13' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: PGPLOT no_index: directory: - t - inc resources: bugtracker: https://github.com/PDLPorters/perl5-PGPLOT/issues repository: git://github.com/PDLPorters/perl5-PGPLOT.git version: '2.27' x_IRC: irc://irc.perl.org/#pdl x_serialization_backend: 'CPAN::Meta::YAML version 0.018' PGPLOT-2.27/PGPLOT.xs0000644000175000017500000004563414012370505013771 0ustar osboxesosboxes /* PGPLOT.xs This file contains the routines provide the glue which allow perl to call C and hence f77/pgplot via the CPGPLOT library. */ #include "EXTERN.h" /* std perl include */ #include "perl.h" /* std perl include */ #include "XSUB.h" /* XSUB include */ #include "cpgplot.h" /* CPGPLOT prototypes */ #include "pgfun.c" /* Function callback code */ #include "arrays.h" /* Pack functions decs */ #include "arrays.c" /* Pack functions defs */ typedef int int2D; /* So 2D arrays are handled automagically */ typedef float float2D; /* by typemap */ /* Buffers for routines that return strings */ static char strbuff[256]; static char strbuff2[256]; #define SIZEOF(X) sizeof(strbuff) void MAIN__ () { /* Cheat to define MAIN__ symbol */ croak("This should never happen"); } /* New struct stuff */ /* Create structure to hold pointers to PGPLOT functions */ struct PGPLOT_function_handle { I32 binversion; void (*cpgmove) (float x, float y); void (*cpgdraw) (float x, float y); void (*cpgqcir) (int *icilo, int *icihi); void (*cpgsci) (int ci); void (*cpgpt1) (float x, float y, int sym); }; typedef struct PGPLOT_function_handle PGPLOT_function_handle; /* Now create an instance of this */ PGPLOT_function_handle myPGPLOT_handle; /* See BOOT section for the rest of the struct stuff */ MODULE = PGPLOT PACKAGE = PGPLOT void pgarro(x1,y1,x2,y2) float x1 float y1 float x2 float y2 CODE: cpgarro(x1,y1,x2,y2); void pgask(flag) Logical flag CODE: cpgask(flag); void pgaxis(opt,x1,y1,x2,y2,v1,v2,step,nsub,dmajl,dmajr,fmin,disp,orient) char * opt float x1 float y1 float x2 float y2 float v1 float v2 float step int nsub float dmajl float dmajr float fmin float disp float orient CODE: cpgaxis(opt,x1,y1,x2,y2,v1,v2,step,nsub,dmajl,dmajr,fmin,disp,orient); int pgband(mode,posn,xref,yref,x,y,ch) int mode int posn float xref float yref float x float y char ch = NO_INIT CODE: RETVAL = cpgband(mode,posn,xref,yref,&x,&y,&ch); OUTPUT: x y ch RETVAL void pgbbuf() CODE: cpgbbuf(); int pgbeg(unit,file,nxsub,nysub) int unit char * file int nxsub int nysub CODE: RETVAL = cpgbeg(unit,file,nxsub,nysub); OUTPUT: RETVAL int pgbegin(unit,file,nxsub,nysub) int unit char * file int nxsub int nysub CODE: RETVAL = cpgbeg(unit,file,nxsub,nysub); OUTPUT: RETVAL void pgbin(nbin,x,data,center) int nbin float * x float * data Logical center CODE: cpgbin(nbin,x,data,center); void pgbox(xopt,xtick,nxsub,yopt,ytick,nysub) char * xopt float xtick int nxsub char * yopt float ytick int nysub CODE: cpgbox(xopt,xtick,nxsub,yopt,ytick,nysub); void pgcirc(xcent,ycent,radius) float xcent float ycent float radius CODE: cpgcirc(xcent,ycent,radius); void pgclos() CODE: cpgclos(); void pgconb(a,idim,jdim,i1,i2,j1,j2,c,nc,tr,blank) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float * c int nc float * tr float blank CODE: cpgconb(a,idim,jdim,i1,i2,j1,j2,c,nc,tr,blank); void pgconf(a,idim,jdim,i1,i2,j1,j2,c1,c2,tr) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float c1 float c2 float * tr CODE: cpgconf(a,idim,jdim,i1,i2,j1,j2,c1,c2,tr); void pgconl(a,idim,jdim,i1,i2,j1,j2,c,tr,label,intval,minint) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float c float * tr char * label int intval int minint CODE: cpgconl(a,idim,jdim,i1,i2,j1,j2,c,tr,label,intval,minint); void pgcons(a,idim,jdim,i1,i2,j1,j2,c,nc,tr) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float * c int nc float * tr CODE: cpgcons(a,idim,jdim,i1,i2,j1,j2,c,nc,tr); void pgcont(a,idim,jdim,i1,i2,j1,j2,c,nc,tr) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float * c int nc float * tr CODE: cpgcont(a,idim,jdim,i1,i2,j1,j2,c,nc,tr); void pgconx(a,idim,jdim,i1,i2,j1,j2,c,nc,plot) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float * c int nc SV* plot CODE: pgfunname[0] = plot; cpgconx(a,idim,jdim,i1,i2,j1,j2,c,nc,pgfunplot); void pgctab(l,r,g,b,nc,contra,bright) float * l float * r float * g float * b int nc float contra float bright CODE: cpgctab(l,r,g,b,nc,contra,bright); int pgcurs(x,y,ch) float x float y char ch = NO_INIT CODE: RETVAL = cpgcurs(&x,&y,&ch); OUTPUT: x y ch RETVAL int pgcurse(x,y,ch) float x float y char ch = NO_INIT CODE: RETVAL = cpgcurs(&x,&y,&ch); OUTPUT: x y ch RETVAL void pgdraw(x,y) float x float y CODE: cpgdraw(x,y); void pgebuf() CODE: cpgebuf(); void pgend() CODE: cpgend(); void pgenv(xmin,xmax,ymin,ymax,just,axis) float xmin float xmax float ymin float ymax int just int axis CODE: cpgenv(xmin,xmax,ymin,ymax,just,axis); void pgeras() CODE: cpgeras(); void pgerrb(dir,n,x,y,e,t) int dir int n float * x float * y float * e float t CODE: cpgerrb(dir,n,x,y,e,t); void pgerr1(dir,x,y,e,t) int dir float x float y float e float t CODE: cpgerr1(dir,x,y,e,t); void pgerrx(n,x1,x2,y,t) int n float * x1 float * x2 float * y float t CODE: cpgerrx(n,x1,x2,y,t); void pgerry(n,x,y1,y2,t) int n float * x float * y1 float * y2 float t CODE: cpgerry(n,x,y1,y2,t); void pgetxt() CODE: cpgetxt(); void pgfunt(fx,fy,n,tmin,tmax,pgflag) SV* fx SV* fy int n float tmin float tmax int pgflag CODE: pgfunname[0] = fx; pgfunname[1] = fy; cpgfunt(pgfun1,pgfun2,n,tmin,tmax,pgflag); void pgfunx(fy,n,xmin,xmax,pgflag) SV* fy int n float xmin float xmax int pgflag CODE: pgfunname[0] = fy; cpgfunx(pgfun1,n,xmin,xmax,pgflag); void pgfuny(fx,n,ymin,ymax,pgflag) SV* fx int n float ymin float ymax int pgflag CODE: pgfunname[0] = fx; cpgfuny(pgfun1,n,ymin,ymax,pgflag); void pggray(a,idim,jdim,i1,i2,j1,j2,fg,bg,tr) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float fg float bg float * tr CODE: cpggray(a,idim,jdim,i1,i2,j1,j2,fg,bg,tr); void pghi2d(data,nxv,nyv,ix1,ix2,iy1,iy2,x,ioff,bias,center,ylims) float2D * data int nxv int nyv int ix1 int ix2 int iy1 int iy2 float * x int ioff float bias Logical center float * ylims CODE: cpghi2d(data,nxv,nyv,ix1,ix2,iy1,iy2,x,ioff,bias,center,ylims); void pghist(n,data,datmin,datmax,nbin,pgflag) int n float * data float datmin float datmax int nbin int pgflag CODE: cpghist(n,data,datmin,datmax,nbin,pgflag); void pgiden() CODE: cpgiden(); void pgimag(a,idim,jdim,i1,i2,j1,j2,a1,a2,tr) float2D * a int idim int jdim int i1 int i2 int j1 int j2 float a1 float a2 float * tr CODE: cpgimag(a,idim,jdim,i1,i2,j1,j2,a1,a2,tr); void pglab(xlbl,ylbl,toplbl) char * xlbl char * ylbl char * toplbl CODE: cpglab(xlbl,ylbl,toplbl); void pglabel(xlbl,ylbl,toplbl) char * xlbl char * ylbl char * toplbl CODE: cpglab(xlbl,ylbl,toplbl); void pglcur(maxpt,npt,x,y) int maxpt int npt float * x = NO_INIT float * y = NO_INIT CODE: coerce1D( (SV*)ST(2), maxpt ); /* Make sure arrays are big enough */ coerce1D( (SV*)ST(3), maxpt ); x = (float *) pack1D( (SV*)ST(2), 'f' ); /* Pack arrays */ y = (float *) pack1D( (SV*)ST(3), 'f' ); cpglcur(maxpt,&npt,x,y); unpack1D( (SV*)ST(2), (void *)x, 'f', 0); unpack1D( (SV*)ST(3), (void *)y, 'f', 0); OUTPUT: npt void pgldev() CODE: cpgldev(); void pglen(units,string,xl,yl) int units char * string float xl = NO_INIT float yl = NO_INIT CODE: cpglen(units,string,&xl,&yl); OUTPUT: xl yl void pgline(n,xpts,ypts) int n float * xpts float * ypts CODE: cpgline(n,xpts,ypts); void pgmove(x,y) float x float y CODE: cpgmove(x,y); void pgmtxt(side,disp,coord,fjust,text) char * side float disp float coord float fjust char * text CODE: cpgmtxt(side,disp,coord,fjust,text); void pgmtext(side,disp,coord,fjust,text) char * side float disp float coord float fjust char * text CODE: cpgmtxt(side,disp,coord,fjust,text); void pgncur(maxpt,npt,x,y,symbol) int maxpt int npt float * x = NO_INIT float * y = NO_INIT int symbol CODE: coerce1D( (SV*)ST(2), maxpt ); /* Make sure arrays are big enough */ coerce1D( (SV*)ST(3), maxpt ); x = (float *) pack1D( (SV*)ST(2), 'f' ); /* Pack arrays */ y = (float *) pack1D( (SV*)ST(3), 'f' ); cpgncur(maxpt,&npt,x,y,symbol); unpack1D( (SV*)ST(2), (void *)x, 'f', 0); unpack1D( (SV*)ST(3), (void *)y, 'f', 0); OUTPUT: npt void pgncurse(maxpt,npt,x,y,symbol) int maxpt int npt float * x = NO_INIT float * y = NO_INIT int symbol CODE: coerce1D( (SV*)ST(2), maxpt ); /* Make sure arrays are big enough */ coerce1D( (SV*)ST(3), maxpt ); x = (float *) pack1D( (SV*)ST(2), 'f' ); /* Pack arrays */ y = (float *) pack1D( (SV*)ST(3), 'f' ); cpgncur(maxpt,&npt,x,y,symbol); unpack1D( (SV*)ST(2), (void *)x, 'f', 0); unpack1D( (SV*)ST(3), (void *)y, 'f', 0); OUTPUT: npt void pgnumb(mm,pp,form,string,nc) int mm int pp int form char * string = NO_INIT int nc = NO_INIT CODE: string = strbuff; nc = SIZEOF(string); cpgnumb(mm,pp,form,string,&nc); OUTPUT: string nc void pgolin(maxpt,npt,x,y,symbol) int maxpt int npt float * x = NO_INIT float * y = NO_INIT int symbol CODE: coerce1D( (SV*)ST(2), maxpt ); /* Make sure arrays are big enough */ coerce1D( (SV*)ST(3), maxpt ); x = (float *) pack1D( (SV*)ST(2), 'f' ); /* Pack arrays */ y = (float *) pack1D( (SV*)ST(3), 'f' ); cpgolin(maxpt,&npt,x,y,symbol); unpack1D( (SV*)ST(2), (void *)x, 'f', 0); unpack1D( (SV*)ST(3), (void *)y, 'f', 0); OUTPUT: npt int pgopen(device) char * device CODE: RETVAL = cpgopen(device); OUTPUT: RETVAL void pgpage() CODE: cpgpage(); void pgadvance() CODE: cpgpage(); void pgpanl(ix,iy) int ix int iy CODE: cpgpanl(ix,iy); void pgpap(width,aspect) float width float aspect CODE: cpgpap(width,aspect); void pgpaper(width,aspect) float width float aspect CODE: cpgpap(width,aspect); void pgpixl(ia,idim,jdim,i1,i2,j1,j2,x1,x2,y1,y2) int2D * ia int idim int jdim int i1 int i2 int j1 int j2 float x1 float x2 float y1 float y2 CODE: cpgpixl(ia,idim,jdim,i1,i2,j1,j2,x1,x2,y1,y2); void pgpnts(n,x,y,symbol,ns) int n float * x float * y int * symbol int ns CODE: cpgpnts(n,x,y,symbol,ns); void pgpoly(n,xpts,ypts) int n float * xpts float * ypts CODE: cpgpoly(n,xpts,ypts); void pgpt(n,xpts,ypts,symbol) int n float * xpts float * ypts int symbol CODE: cpgpt(n,xpts,ypts,symbol); void pgpt1(xpt,ypt,symbol) float xpt float ypt int symbol CODE: cpgpt1(xpt,ypt,symbol); void pgpoint(n,xpts,ypts,symbol) int n float * xpts float * ypts int symbol CODE: cpgpt(n,xpts,ypts,symbol); void pgptxt(x,y,angle,fjust,text) float x float y float angle float fjust char * text CODE: cpgptxt(x,y,angle,fjust,text); void pgptext(x,y,angle,fjust,text) float x float y float angle float fjust char * text CODE: cpgptxt(x,y,angle,fjust,text); void pgqah(fs,angle,vent) int fs = NO_INIT float angle = NO_INIT float vent = NO_INIT CODE: cpgqah(&fs,&angle,&vent); OUTPUT: fs angle vent void pgqcf(font) int font = NO_INIT CODE: cpgqcf(&font); OUTPUT: font void pgqch(size) float size = NO_INIT CODE: cpgqch(&size); OUTPUT: size void pgqci(ci) int ci = NO_INIT CODE: cpgqci(&ci); OUTPUT: ci void pgqcir(icilo,icihi) int icilo = NO_INIT int icihi = NO_INIT CODE: cpgqcir(&icilo,&icihi); OUTPUT: icilo icihi void pgqclp(state) int state = NO_INIT CODE: cpgqclp(&state); OUTPUT: state void pgqcol(ci1,ci2) int ci1 = NO_INIT int ci2 = NO_INIT CODE: cpgqcol(&ci1,&ci2); OUTPUT: ci1 ci2 void pgqcr(ci,cr,cg,cb) int ci float cr = NO_INIT float cg = NO_INIT float cb = NO_INIT CODE: cpgqcr(ci,&cr,&cg,&cb); OUTPUT: cr cg cb void pgqcs(units,xch,ych) int units float xch = NO_INIT float ych = NO_INIT CODE: cpgqcs(units,&xch,&ych); OUTPUT: xch ych void pgqdt(n,type,tlen,descr,dlen,inter) int n char * type = NO_INIT int tlen = NO_INIT char * descr = NO_INIT int dlen = NO_INIT int inter = NO_INIT CODE: type = strbuff; tlen = SIZEOF(type); descr = strbuff2; dlen = SIZEOF(descr); cpgqdt(n,type,&tlen,descr,&dlen,&inter); OUTPUT: type tlen descr dlen inter void pgqfs(fs) int fs = NO_INIT CODE: cpgqfs(&fs); OUTPUT: fs void pgqhs(angle,sepn,phase) float angle = NO_INIT float sepn = NO_INIT float phase = NO_INIT CODE: cpgqhs(&angle,&sepn,&phase); OUTPUT: angle sepn phase void pgqid(id) int id = NO_INIT CODE: cpgqid(&id); OUTPUT: id void pgqinf(item,value,length) char * item char * value = NO_INIT int length = NO_INIT CODE: value = strbuff; length = SIZEOF(value); cpgqinf(item,value,&length); OUTPUT: value length void pgqitf(itf) int itf = NO_INIT CODE: cpgqitf(&itf); OUTPUT: itf void pgqls(ls) int ls = NO_INIT CODE: cpgqls(&ls); OUTPUT: ls void pgqlw(lw) int lw = NO_INIT CODE: cpgqlw(&lw); OUTPUT: lw void pgqndt(n) int n = NO_INIT CODE: cpgqndt(&n); OUTPUT: n void pgqpos(x,y) float x = NO_INIT float y = NO_INIT CODE: cpgqpos(&x,&y); OUTPUT: x y void pgqtbg(tbci) int tbci = NO_INIT CODE: cpgqtbg(&tbci); OUTPUT: tbci void pgqtxt(x,y,angle,fjust,text,xbox,ybox) float x float y float angle float fjust char * text float * xbox = NO_INIT float * ybox = NO_INIT CODE: xbox = get_mortalspace(4,'f'); ybox = get_mortalspace(4,'f'); cpgqtxt(x,y,angle,fjust,text,xbox,ybox); unpack1D( (SV*)ST(5), (void *)xbox, 'f', 4); unpack1D( (SV*)ST(6), (void *)ybox, 'f', 4); void pgqvp(units,x1,x2,y1,y2) int units float x1 = NO_INIT float x2 = NO_INIT float y1 = NO_INIT float y2 = NO_INIT CODE: cpgqvp(units,&x1,&x2,&y1,&y2); OUTPUT: x1 x2 y1 y2 void pgqvsz(units,x1,x2,y1,y2) int units float x1 = NO_INIT float x2 = NO_INIT float y1 = NO_INIT float y2 = NO_INIT CODE: cpgqvsz(units,&x1,&x2,&y1,&y2); OUTPUT: x1 x2 y1 y2 void pgqwin(x1,x2,y1,y2) float x1 = NO_INIT float x2 = NO_INIT float y1 = NO_INIT float y2 = NO_INIT CODE: cpgqwin(&x1,&x2,&y1,&y2); OUTPUT: x1 x2 y1 y2 void pgrect(x1,x2,y1,y2) float x1 float x2 float y1 float y2 CODE: cpgrect(x1,x2,y1,y2); float pgrnd(x,nsub) float x int nsub = NO_INIT CODE: RETVAL = cpgrnd(x,&nsub); OUTPUT: nsub RETVAL void pgrnge(x1,x2,xlo,xhi) float x1 float x2 float xlo = NO_INIT float xhi = NO_INIT CODE: cpgrnge(x1,x2,&xlo,&xhi); OUTPUT: xlo xhi void pgsah(fs,angle,vent) int fs float angle float vent CODE: cpgsah(fs,angle,vent); void pgsave() CODE: cpgsave(); void pgunsa() CODE: cpgunsa(); void pgscf(font) int font CODE: cpgscf(font); void pgsch(size) float size CODE: cpgsch(size); void pgsci(ci) int ci CODE: cpgsci(ci); void pgscir(icilo,icihi) int icilo int icihi CODE: cpgscir(icilo,icihi); void pgsclp(state) int state CODE: cpgsclp(state); void pgscr(ci,cr,cg,cb) int ci float cr float cg float cb CODE: cpgscr(ci,cr,cg,cb); void pgscrl(dx,dy) float dx float dy CODE: cpgscrl(dx,dy); void pgscrn(ci,name,ier) int ci char * name int ier = NO_INIT CODE: cpgscrn(ci,name,&ier); OUTPUT: ier void pgsfs(fs) int fs CODE: cpgsfs(fs); void pgshls(ci,ch,cl,cs) int ci float ch float cl float cs CODE: cpgshls(ci,ch,cl,cs); void pgshs(angle,sepn,phase) float angle float sepn float phase CODE: cpgshs(angle,sepn,phase); void pgsitf(itf) int itf CODE: cpgsitf(itf); void pgslct(id) int id CODE: cpgslct(id); void pgsls(ls) int ls CODE: cpgsls(ls); void pgslw(lw) int lw CODE: cpgslw(lw); void pgstbg(tbci) int tbci CODE: cpgstbg(tbci); void pgsubp(nxsub,nysub) int nxsub int nysub CODE: cpgsubp(nxsub,nysub); void pgsvp(xleft,xright,ybot,ytop) float xleft float xright float ybot float ytop CODE: cpgsvp(xleft,xright,ybot,ytop); void pgvport(xleft,xright,ybot,ytop) float xleft float xright float ybot float ytop CODE: cpgsvp(xleft,xright,ybot,ytop); void pgswin(x1,x2,y1,y2) float x1 float x2 float y1 float y2 CODE: cpgswin(x1,x2,y1,y2); void pgwindow(x1,x2,y1,y2) float x1 float x2 float y1 float y2 CODE: cpgswin(x1,x2,y1,y2); void pgtbox(xopt,xtick,nxsub,yopt,ytick,nysub) char * xopt float xtick int nxsub char * yopt float ytick int nysub CODE: cpgtbox(xopt,xtick,nxsub,yopt,ytick,nysub); void pgtick(x1,y1,x2,y2,v,tikl,tikr,disp,orient,str) float x1 float y1 float x2 float y2 float v float tikl float tikr float disp float orient char * str CODE: cpgtick(x1,y1,x2,y2,v,tikl,tikr,disp,orient,str); void pgtext(x,y,text) float x float y char * text CODE: cpgtext(x,y,text); void pgupdt() CODE: cpgupdt(); void pgvect(a,b,idim,jdim,i1,i2,j1,j2,c,nc,tr,blank) float2D * a float2D * b int idim int jdim int i1 int i2 int j1 int j2 float c int nc float * tr float blank CODE: cpgvect(a,b,idim,jdim,i1,i2,j1,j2,c,nc,tr,blank); void pgvsiz(xleft,xright,ybot,ytop) float xleft float xright float ybot float ytop CODE: cpgvsiz(xleft,xright,ybot,ytop); void pgvsize(xleft,xright,ybot,ytop) float xleft float xright float ybot float ytop CODE: cpgvsiz(xleft,xright,ybot,ytop); void pgvstd() CODE: cpgvstd(); void pgvstand() CODE: cpgvstd(); void pgwedg(side,disp,width,fg,bg,label) char * side float disp float width float fg float bg char * label CODE: cpgwedg(side,disp,width,fg,bg,label); void pgwnad(x1,x2,y1,y2) float x1 float x2 float y1 float y2 CODE: cpgwnad(x1,x2,y1,y2); BOOT: /* New struct stuff */ /* Initialise structure of pointers to core C routines */ myPGPLOT_handle.binversion = 20001129; /* Date structure redefined */ myPGPLOT_handle.cpgdraw = cpgdraw; myPGPLOT_handle.cpgmove = cpgmove; myPGPLOT_handle.cpgqcir = cpgqcir; myPGPLOT_handle.cpgsci = cpgsci; myPGPLOT_handle.cpgpt1 = cpgpt1; /* "Publish" pointer to this structure in perl variable for use by other modules */ sv_setiv(perl_get_sv("PGPLOT::HANDLE",TRUE|GV_ADDMULTI), (IV) (void*) &myPGPLOT_handle); PGPLOT-2.27/HINTS.irix0000644000175000017500000000427513435120245014170 0ustar osboxesosboxesFrom - Wed Sep 22 10:59:33 1999 Received: from ns3.ge.com (ns3.ge.com [192.35.39.22]) by aaoepp2.aao.GOV.AU (8.9.1/8.9.1/AAO-1.1a) with ESMTP id UAA18253 for ; Tue, 21 Sep 1999 20:26:05 +1000 (EST) From: johnj.sasso@ps.ge.com Received: from thomas.ge.com (thomas-o.ge.com [10.47.28.21]) by ns3.ge.com (8.9.3/8.9.3) with ESMTP id GAA06458 for ; Tue, 21 Sep 1999 06:26:46 -0400 (EDT) Received: from nyschx06psge.ps.ge.com (nyschx06psge.ps.ge.com [3.159.84.11]) by thomas.ge.com (8.9.3/8.9.3) with ESMTP id GAA27441 for ; Tue, 21 Sep 1999 06:26:46 -0400 (EDT) Received: by nyschx06psge.ps.ge.com with Internet Mail Service (5.5.2448.0) id ; Tue, 21 Sep 1999 06:17:03 -0400 Message-ID: <8D53D4CD22CAD011B95700805F31FAAD047B2902@nyschx04psge.sch.ge.com> To: kgb@aaoepp.aao.GOV.AU Subject: RE: Problem running pgperl on IRIX 6.5.3 Date: Tue, 21 Sep 1999 06:17:17 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="iso-8859-1" Content-Length: 1068 Status: O X-Mozilla-Status: 8011 X-Mozilla-Status2: 00000000 X-UIDL: 3545b6f100003adb Karl, Thanks for the response. I've managed to resolve the problem, after some troubleshooting noting that in the installation instructions for PGPLOT (the non-Perl, core package) the method for creating the shared library libcpgplot.so is not entirely correct. They used: ld -shared -o libcpgplot.so --whole_archive libcpgplot.a Well, the problem is that the objects in libcpgplot.a reference objects in libpgplot.a, so one needs to link them together. What I did under IRIX 6.5.3 is: ld -shared -n32 -all libcpgplot.a -o libcpgplot.so -none libpgplot.a Also, I had to recompile the core PGPLOT package with the -n32 option, as the Perl PGPLOT package does; otherwise, it defaults to -o32 compilation and the result is improper linking to libraries. --john -----Original Message----- From: Karl Glazebrook [mailto:kgb@aaoepp.aao.GOV.AU] Sent: Tuesday, September 21, 1999 12:37 AM To: John Sasso Subject: Re: Problem running pgperl on IRIX 6.5.3 Looks to me like it is not linking vs cpgplot correctly send me the output of 'perl Makefile.PL; make' ? PGPLOT-2.27/test.img0000644000175000017500000010000013435120245014042 0ustar osboxesosboxes||||h:000DD&&&0DXlND0:::DNbN:DNXNXNvblD000:0&0NbbXXN:&0DNbblDX&00NRlX&r|||N:N:N&&:0&&:0DXDvvb:0:DND&00&0000blNlNlbND::0&000&:XbbbND:DDNvXXN0:&*pbXr||||||0bvDN&DX::lXbXbbbDD0NNXv:0NNDN0:NNXvvlNDN00000DNXvlXNXXNDbXbN&DvbN0|||r|bl:NvlN0lNlbvXXD:00XXvbXDNDDbXD:vvDDXb0&0D:DXbNXNDXbXDbbvbb0b0NHXbDr|0NXb:NbXvXDD::lv>.XNXDNbbX> lb:NvN&::NXXlbNlvvXXXblXvvl&|||||N0blb bXNXl RbbblbR*  lbbN00::DbblllbbDlbv l :|||||&&&lNN  4  *>H4 4\z>bN:DNNbXXNbvlNbblvnllD|||r||||DDb0bvb > Bz4 $\ zRR H*F`bXb:D:NNvbllllbbXX|||&&DXXl  `>H.f4>\*HRf>  4H\zpRlXlbXXXNDllbvlvlbl:N0|r||||0Dl *  $8pfHR\\zVp*  4*>R>\ vvlbbNNlvlblvlXX  vD||r0:Xl> *RH .V~B~L$Vj~.4*p4fp vlvvvNlbvv:N>*N&||||Nl>H\Rfj8j$V$$$`.fR blbvvvl::0 *>>b:|||||:DDv Hp$BBLLVL8$.B~`pNXD  >\X0r&Nblv4f~$2d$VBL~ `L>vXN*4\\b&|00Nb$`>fzj~8Bj:dL~`LB~.p>HlXl@zz\ b&|0:bH$jR z44p.ftP$ZP(P8VtBp4 \  vbb $\ vN||||&Nb fR4\RHzz$ p\V$Hzt$(j~<d``V.8zp\> :HH*    lX4.~4 :||Dbv*   HzzfHR>f$pz$4p8V(Nt8~tV4**  Hff>R>4H4 bXv zN:|&l4pf*4H>HHf 8 44V$LpB~N<(8$VBR *HzLjp\ 4HfHbNbpHl0|0&XRHH4     H`zV F n$B`LjRR\.8tfR\R*D\f vbX Hzp lD|&DNv\p.zp4*   *4Hfz.j(2LV(FB$H\zf *\H*  X0*RzpN&0:Xl>~zz\R *>H4* >>RpfppB.$tZTF tVzj*RH*  **   vNbpf *lD|&DXLtzfpzzp4* *4ff$B xdHRRR  vDz4N0N pLz\fpzfRpp\pB8$$`xb |2j~p>\>**    vXHb:0l>|nj.L$`.L`.Bx.Z TrhJ2BfzH  * b\zpvb&N4f` t8B`VLBV~V rtP  ZdTT2.zp\H  RRbl0N4*F8x ^zHfRHzjn~^`BJ@tzf4 *  Rp\ffl:hh^hrrh|rr|&X*>\$F~RR *>  >RpV~Bj2LLd B.V(b,R4Rz\fHfb0l&v488~ZjfzpH  > 4>fzzj(FddnF<L.j8txNlH  >>H>\4z\ l0b\.$~@ .j* >44HR\Rpf\R8..$Vt~dZ2n<`~""$B 6n.pR > >>*f pH vN:l B8~~LxZH4   z\ppRRp88t nZFdj(T,rjx 2 V\*4*   > fHf> lD0v zV2$8H\ffzHHB$~2ddFZZjx^TFVL<@J hf\4  4 >4H b:&0b*fZ@~*zfR>\\L.LLB8dr^ZjP ` DL\4 ppH*>>zRR bN:NHx* *R*>Rp\zpz\ HpVN~LBj~LVtL hdr8nJLp4  zf *H* 4pfNN&b \`F 4 p\>H>>fR*ztV..BLJt,"|`Zhr\>p*4 RHH p XN:0N*\8L<  >pRf\RHR~6d2x(ZnJJd|@F(zR** RH  \zllN0:Xpfz( jp\>H\HRV8`(v j~Z(P Z@bFp\ >f44f*   R>lD&0DHtLt8zR>4 >>H.j~nlrD~B.P$82d2Z FR 4pHHfH *H vND&&:XR2* >* >>H.B$` <b6J((B2F2@Pnz8J BzR4fp\ R\Rz* bND::lHz~>p44H4>R> ffz8j`L$^@nxtjPtF2nh<6,JDVf> \pp \>pz> vlN&0lHRpHRH>RRHR>Hf8$jPF|,6,Jx$PP^6Rnjj *zR>fp>vXN&Dbv ~jp*RR\HR*p..  ,rl06& BP VtLd"6h6".fH\4Rzp\ \f* XD&D:Nv 4 >~.> 4pR*>H>RfzB`Vd|>>l^X L x F ,hPdxF.2<@hxjVtp\4  LLRppfH>\Rb:&&&&NXXf*>zBL\ 4HfRjn  $ Z  L F t  xTx8B`F"^0@b t\HH\\ppf>R bD00:NblHLzLt>  4>>fB2|N d Z  B . *vp z f:4 Z `2(j8L2x@P`pR.$pzz*pf lD&0&0Db\H4$>  RRHpt|   4 ^d24N  6Nh t2<8F"rx(B.f\fzRRH* X:&D:vfp\\4H H H*4H\8~ H ph~<^hd ,d \ nZ.V2|6L L Rp>fHN0:&&NNv4f>4Hzf4 **pHH*HfV<6\ J " hTZ  Pdx<jtl 8vF(B8`<|| NNdz~jzpfRH D&DXX4p\Rzz>*fpff\\4\pzFDp 2  h d:("^Zxn<0PjjjL`8x@ &2zL~\Rz>>p\\ lN0&0:X pppRzff>RjP"p x  @ PFX^ T,P B.jj|n  Zp\Rz$L H bN000Nb4Rf >\LZ @ 0 zn^rT,h|h|,"J<F~VL2<rbxn<pfzz$`.f \\HbN:00NNR\pLpHRp.hf   r,@6r"|F(tZZx@>l<B`fpz* *b:00DbbXv*HH.zpfF:6@& n *"6^^^@n,^""PnhT~~P,0HN@8$Bd~p>*4XD&0Xbbbv*f$\p\HjZ,Hf"^"hT|6|^TJ,r<8jB<r@XbTTLVVnfz4H NXb&&:Dvlb j8.ppzpR\p" zD,,,"|@DDN\:rJ0r L<T0&|T6BL.L88V.H\** v00D::bbv`V`p>HnZ,b* xf ~ ~vJ^<rb fp* R&:l~<6P6r&L.t$~V f* l:&&N::bv4dV\ 4$ ` 2 t jnTFbR> L  : R 8 nv `b^l"h|h~L$ <t.HHz\*XD00DXblNVzH>L.jT  d"d@nn|b\  Z 4( . zT@d. .T 8r"FjF8*>pR Xl:::DXbllzLL\$.HR.`t $ F  ,P"|  P^ D  L@ x L,@r<62LjB\ R fXX0&DNXbb \,z$V``V<JH ~ ( p 0P|" .  v n >PfrvD. : <Ddd(<PFP2|^66J (tLZx~.>H4R*b:&:DDllpP jttBZ $\P^h, . n    f 2 p|@^x(2FT|"rXh@(n<`.pf  X000NlvvHB~8hf   BT6<2* , f"\$h"t'"0 vHxxnd^zbn2jB8>H vD0:NbvFBRt~Ld ` 2 ,hF(d@Z .  X ` %:)( &J \ 8 2n<  & 6 4 2h`$t~f\4vD:D4lv>z~zfj``(  " <P(": j b&$@)66G4+R!h>  FF2 2rP ^Dx.8.`.f H  l00Dllv p.`j~V.tfzH2PP((dF& B@T$J-" X > LP(@  x r~4 4R>  N:bv*V~8pL2P V4<ZZnd   < fT "!,D UF6,t&H#R *j f|Fd(FZFtx@Z2nBf\fR b&:b 4~pfH "ZddFdP( F  ^  6"V$.^3T+-d&%z.| \ dPZnPZP$jxF&j$f \ v0Dv*> *p.8^ ~ 6b(Txd"@x F P  x\X #*)&"`j" 6 tffx2 8jV`tz~f>4\RX&0N *`jV  z D> |"F,^  t <! d"#d#b" T D J6n2&"8'(B zp>\ N:D *R8\.BV8Ld B B@Nn<xP hRH  (f<l2`  zv@,x F"b~,84*z\>b0:Xv*>H\fjttZ<(ndR @ $~z(\ <vNhr6nlTt.p   f>lN0:X   >L$z\jbh<P (h>4,*P  4r@ n>JrJhr@hB( @t`` *H$H4 XD0Nb*>Bp~ ZrT< x<<nl  ZL8  Z j TTT^^F2Lx(~8*   LRH\l0&&Nl4zt~~tF2PJr(d(ZP"<bB L Z n*  " 4@|r:(`tFZ$`..\4H> *\\\v:&&&XvzR<F40 @rZ"  x    |60@r"d2fp$t8j4*f>4R l:&&:v >4zRdx"D<Bj24 ZD&R&|Jr|Dlrd^~88j$\\HpL~z4N0X*pRR*B Z6RF,@N|nZLVZD" .hlT"JTH(nhB.8$H* R$p :&Dv\j("*Jxd&|d~. vn@ *r^&,Jr04 "JTr|V~VzH**>f>b0&X * HB(LZ pZBn2|6ZF j j.V hvn,X fDD|Fj~^>hLV`L$zpfR*pp*N&&:v >8< rj`6@|x  8JT2DJP |rhvX,~n(`Lzp> fz*v00N*4V~j 8 l(BBTRx"<d`8|DF@J^Xvh6Fn2nhh"J^Z$L`B.zz\  lD:l >$$BDbn.n,@xxZZP8.t 8 FbD  x:N|x.jFX n8$$f*pzRN&:bR>8t6T`j Fx^dFPB`n^ :T ZZ2Z28t r.8$8zpH*p>lD0Dl Rfz\BnjnlFFZ8tJh| .Fntd<2xP6|( R >f4N0NvHRp.dV , ZPTTZ j8 nbNTh  n:< Z@T"^.8\H  Rb:XHRr~nx<dBjFJ^""Z .$(6@> f|P,`8BBf>*>HvD&DvN*zp$2zP"@<`vp 0,"2F j8tbtFnTN^,x(2 L22F`>*\R l:&D>~V>H8hd^Fh| t p 0|(nBVL$j2xVVn,2t j8BfH> lDbR4<F<2r0|  66Z~tjt`8t tjd.88F~j.fRzjpN0Xpppz x"D > Z@<Z``8``L8jZF$$$88j`B$~VV$\\$t~RN0Dlppp$FF V@>  t 4(~t$j$.B~LBt~VB`BV~tBLBVB~jBffbD:|:bpz>t  l@@dn " T~V$tt~VL$.BBj88B~Bt2(tV`B$.L.8VfzHz4Rt2Hl:0&0N H$f V~j|"  t  PP<Vt.Bt~8$`.LL$8B(VttB$B`8H>$`R>v:&&&N R\L`8>4 VZ8$x<TD B F |~2x2~$.8``V8jBV$Lt.B`L888$\HRpz.$HN:&Dv4.tLRL.jLj&>  n2<ttL.$88B$$V2tV.B`8zpR\$>v:|Dbz\8Vt`L~2, Z : x xP  `88tj~Bn<L8z`.Hb:0v  \B$$88(<<,&N 8Z(<|FL$`((``~RRpf`VlD|0XVpR$< Fl 2rP|("< VB`J nd8`8$VL`\4$8B lN&D zL4lNb\V$`D  :  L"<J^nx2F<~.tnZ<nPZV$VtV4zVL.f  NN$fvt`~P :J BT2F(dn<dBjrn(~ jfp$p>*X0|Nz8lRRpjF" d | fb"Fn(2(dF xLtL6,..TTJRF"\>X&|DR$BXbRz8tn |"|^FZ<V$8L2 @Xlvb .lL$BLzR N NH8L.>vvl*R*8tx\4f P0dt(t`8.8$t,N j 06Zt.zHb&T/H||0b4\bXbNH>*f@L* :  j,62j<L$V.> pPT^Xv^2BBtz>lD&b pfvXlX >\8 jHN&ZjB~~VBB8`~`.Bx"xj<P2>vN0|&XHzzp XDbX  >z.`0(J2 ""ddVVLL8` n<2FxB8>vN:|N*fpR\Xb R  *f`:x Xl6ZN`x(P|TZ( <VF<\>vXN&&&Dv*p>4 **R tbvd(JPdnrjt>vbND:|:b 4R**  Hzp4\H0 xh:, dPBppz4*>4H\H vlXD0|0v**RHpz`H$t\,6&Zf &J|2x"$\ H\HzHRvbXN:0|&l*      4jR*fVj~ |,T`Td P j$4Rf *bX:&|l&N   H$N>  >$>(x$~8t$f 4*vvXX0Lx:Dv *4p\ RHH\ tL`(L8ffzz\R4RlXN::Dl *z 4  Ht.zR\B\\   * 4p vbXN:l||0:N^ \ 4p\R4 >zpp4 *4  >44vvXN::|&0DDl 4 8\   4H4*H   >.\>lbX:||00N 4> *\ H   z *  lvXND&|||::Nv   lN:0|||&:XbbN0&r||r:DXlvvlv vlD:||0DN::Nv lblbvlllvXN0&&0r|||&DNvX:DXlvlbllNvllXXlXNllbXND0||0Xl&0XvbvvvlbbNXNDDbNXDNbbDDX00&:DXlv&bvlvlbvvvvbbXbNNNDNDDND:NN::::0&&|&0:Xb0DvlvXNblXXXbblbXlDD0DN:000:0&||||&&&0Nv NXlvllllvvbblbXNDNNXD00000&&:DXv 4 vlvvvv tvbX::NNN:DD00&0&&rr&0DNXbH  lvbbvvlb:DDND:::DD0:0&&|PGPLOT-2.27/README0000644000175000017500000000356113435120245013263 0ustar osboxesosboxes PGPLOT module for Perl ---------------------- Karl Glazebrook karl_pgplot at mac dot com Last update to this file: Apr 10th 2006 This module allows the use of the the PGPLOT graphics library from the popular Perl scripting language. PGPLOT makes it very easy to process and plot data using the powerful file and text manipulation facilites built in to Perl. Perl provides a superset of the features of the useful UNIX utilities awk and sed and is the `Swiss-Army Chainsaw' of UNIX programming. Because Perl is a scripting language a program can be changed and rerun to instantly see the effect on a plot. This makes program development a lot faster and much more fun than when using PGPLOT from fully compiled languages such as C or FORTRAN. Users of MONGO and SM will be familiar with this style of programming. Perl also allows you to create advanced World Wide Web page features and/or routinely do system management tasks (Perl handles regular expressions, files and sockets with equal ease). PGPLOT is a very popular library for plotting astronomical data. (As a glance through any issue of ApJ or MNRAS will confirm.) I have always found that with PGPLOT I could produced far nicer and more complex plots than I could with MONGO but it was always harder to use because it had to be done from C or FORTRAN. SM is a nice package, but the language is primitive in comparison with Perl and it is not free software. The PGPLOT module for Perl is free software and provides a complete Perl interface to all of the PGPLOT library functions. It builds against the PGPLOT C/FORTRAN libraries. The core module is available from The Comprehensive Perl Archive (CPAN) network in the directory http://search.cpan.org/search%3fmodule=PGPLOT ---------------- Installation instructions - see the file INSTALL Problems - see the file HELP News - see the file CHANGES for new features/bug fixes. PGPLOT-2.27/MANIFEST0000644000175000017500000000073514012625446013541 0ustar osboxesosboxesarrays.c arrays.h CHANGES HELP HINTS.irix HINTS.osf INSTALL INSTALL-MacOSX INSTALL-Win32 LICENSE Makefile.PL MANIFEST This list of files MANIFEST.SKIP pgcompatbility.p pgfun.c PGPLOT.pm PGPLOT.xs README t/t1.t t/t10.t t/t11.t t/t12.t t/t2.t t/t3.t t/t4.t t/t5.t t/t6.t t/t7.t t/t8.t t/t9.t test.img typemap META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) PGPLOT-2.27/Makefile.PL0000644000175000017500000002252214012620031014341 0ustar osboxesosboxesuse strict; use ExtUtils::MakeMaker; use Config; use Devel::CheckLib qw(check_lib); use ExtUtils::F77; # need imports else doesn't work # Examples of how to explicitly override default automatic choice # of OS and compiler (currently commented out): #use ExtUtils::F77 qw(solaris); #use ExtUtils::F77 qw(generic g77); # use command line KEY=VALUE to override defaults. VALUES are comma # separated lists my %Arg = ( # X11 library directories XDIR => '/usr/openwin/lib,/usr/X11/lib,/usr/X11R6/lib', # X11 libraries XLIB => 'X11', # where cpgplot.h should be IDIR => undef, # where libpgplot.a should be LDIR => undef, # extra libraries and directories EXLIB => join(',', grep check_lib(lib => $_), qw(png12 png16 z)), EXDIR => '/Applications/PDL/pgplot,/usr/local/lib', ); # Get user preferences my @NARGV; while( $_ = shift @ARGV ) { if ( /^([\S]+)=(.+)/ && exists $Arg{$1} ) { $Arg{$1} = $2; } else { push @NARGV, $_; } } @ARGV = @NARGV; # look for libraries and includes if not specified on the command line if ( !defined $Arg{IDIR} || !defined $Arg{LDIR} ) { my $IDIR; my $LDIR; # Specification of PGPLOT location via environment variable if ( defined $ENV{PGPLOT_DIR} ) { $IDIR = $ENV{PGPLOT_DIR}; $LDIR = $ENV{PGPLOT_DIR}; } # if using the autotool'd version of PGPLOT (see the "OBTAINING PGPLOT" # section in PGPLOT.pm for more details) pkg-config may be able to # find everything needed. # First try pure-perl vesion elsif ( eval { require PkgConfig; 1 } ) { my $pkg = PkgConfig->find( 'cpgplot' ); if ( $pkg->pkg_exists ) { my @libdirs = map { s/-L//; $_ } grep { /^-L/ } $pkg->get_ldflags; $LDIR = join( ',', @libdirs ); my @incdirs = map { s/-I//; $_ } grep { /^-I/ } $pkg->get_cflags; $IDIR = join( ',', @incdirs ); } } # now try the wrapper around the pkg-config executable elsif ( eval { require ExtUtils::PkgConfig; 1; } ) { my %pkg = eval { ExtUtils::PkgConfig->find( 'cpgplot' ); }; if ( !$@ ) { my @libdirs = map { s/^-L//; $_ } grep { /^-L/ } split( ' ', ExtUtils::PkgConfig->libs_only_L( 'cpgplot' ) ); $LDIR = join( ',', @libdirs ); my @incdirs = map { s/^-I//; $_ } grep { /^-I/ } split( ' ', ExtUtils::PkgConfig->cflags( 'cpgplot' ) ); $IDIR = join( ',', @incdirs ); } } # and if nothing worked, use some defaults $Arg{IDIR} ||= $IDIR || '/usr/include,/Applications/PDL/pgplot,/usr/local/pgplot'; $Arg{LDIR} ||= $LDIR || '/usr/lib,/usr/lib64'; } my $LIBDIRS = join(' ', map { "-L$_" } map { split( ',', $_ ) } @Arg{qw/ XDIR LDIR EXDIR /} ); my $LIBS = join(' ', map { "-l$_" } qw/ cpgplot pgplot /, map { split( ',', $_ ) } @Arg{qw/ XLIB EXLIB /} ); my $IDIRS = join( ' ', map { "-I$_" } split( ',', $Arg{IDIR} ) ); # # Usage: # $needed_libs = find_required_driver_libs($dir); # # Aim: # Parse the drivers.list file to find out what extra libraries # are needed by the module. The file is assumed to be in # the directory $dir. If the file can not be read then # "" is returned rather than exiting with an error. # # The return value is a string like "-lpng -laquaterm", which # can be "". # # This is only used in the OS-X case. It is not currently guaranteed # to be complete since I have not made a complete study of the # drivers. # sub find_required_driver_libs ($) { my $indir = shift; my $infile = "${indir}/drivers.list"; my $retval = ""; open my $fh, '<', $infile or return $retval; # known library requirements # my %libs = ( 'PNDRIV' => 'png', 'AQDRIV' => 'aquaterm', ); while (<$fh>) { next if /^\s*$/ or /^!/; # /; (comment is to un-confuse emacs highlighting) chomp; my @words = split; if ( exists $libs{$words[0]} ) { $retval .= " -l" . $libs{$words[0]}; delete $libs{$words[0]}; # since the driver can appear multiple times in drivers.list } } $fh->close; return $retval; } # sub: find_required_driver_libs() # What os are we using? # my $is_vms = $^O eq "VMS"; my $is_osx = $^O eq "darwin"; my $is_win32 = $^O =~ /mswin32/i; # Move the logic out of the WriteMakefile statement to make it a # bit easier to follow. We use the %items hash to store key,value # pairs that will be used in the WriteMakefile call. Note that # some key settings are platform specific. # my %items; $items{DEFINE} = "-DNO_TRAILING_USCORE" unless ExtUtils::F77->trail_; $items{DLEXT} = "xs.dll" if $is_win32; if ( $is_vms ) { $items{INC} = 'pgplot_dir:'; $items{LIBS} = 'pgplot_dir:cpgplot.olb'; } else { $items{INC} = $IDIRS; $items{OBJECT} = '$(BASEEXT)$(OBJ_EXT) pgplot_tmp/libcpgplot.a ' . 'pgplot_tmp/libpgplot.a' if -d 'pgplot_tmp'; $items{LIBS} = [ join( ' ', $LIBDIRS, $LIBS, ExtUtils::F77->runtime ) ]; # This is not ideal since it assumes that: # objc is required # the logic in find_required_driver_libs() is correct # the libraries are located either in a location pointed to by LDFLAGS # or in /sw/lib # if ($is_osx) { my $pgplot_dir = defined $ENV{PGPLOT_DIR} ? $ENV{PGPLOT_DIR} : "/usr/lib"; my $dir = -d 'pgplot_tmp' ? 'pgplot_tmp' : $pgplot_dir; $items{LIBS}[0] .= " -lobjc " . (defined $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "-L/sw/lib") . find_required_driver_libs($pgplot_dir); } # The following is needed for PGPLOT compiled on OS-X, at least # for both the version used from FINK and a hand-compiled version. # $items{LDDLFLAGS} = "$Config{lddlflags} -Wl,-framework -Wl,Foundation" if $is_osx; # Nasty hack to build only i386/x86_64 only instead of a Universal binary on OS X # I put this in to avoid an error if linking with the pgplot libs in # SciKarl (2.4.6 and above). Hope one day to remove this. # - Karl Glazebrook if ($is_osx) { $items{CCFLAGS} = $Config{ccflags}; $items{LDFLAGS} = $Config{ldflags}; $items{LDDLFLAGS} = $Config{lddlflags}; # Added this 11/1/2021 to avoid warnings about 'compact unwinds' on MacOS11 my @darwin_vers = split("\\.",$Config{osvers}); # Darwin version XX.YY.ZZ if ($darwin_vers[0]>=20) { # Big Sur $items{LDDLFLAGS} .= " -Wl,-no_compact_unwind"; # Avoid mess of warnings about this } # Karl - now figure out automagically WHICH binary arch # to build for and change the various flags mac_universal( \$items{CCFLAGS}, \$items{LDFLAGS}, \$items{LDDLFLAGS}); print "TEST $items{CCFLAGS}\n"; print "TEST $items{LDFLAGS}\n"; print "TEST $items{LDDLFLAGS}\n"; } } WriteMakefile( 'NAME' => 'PGPLOT', 'CONFIGURE_REQUIRES' => { 'ExtUtils::F77' => 1.13, 'Devel::CheckLib' => '1.14' }, 'TEST_REQUIRES' => { 'Test::More' => '0.88' }, 'VERSION_FROM' => 'PGPLOT.pm', 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }, 'depend' => { '$(OBJECT)' => q[pgfun.c arrays.c PGPLOT.c]}, 'META_MERGE' => { "meta-spec" => { version => 2 }, dynamic_config => 1, # deps actually do change resources => { bugtracker => {web=>'https://github.com/PDLPorters/perl5-PGPLOT/issues'}, repository => { url => 'git://github.com/PDLPorters/perl5-PGPLOT.git', type => 'git', web => 'https://github.com/PDLPorters/perl5-PGPLOT', }, }, prereqs => { develop => { requires => { 'CPAN::Changes' => '0', }, }, }, x_IRC => 'irc://irc.perl.org/#pdl', }, %items ); # This subroutine is a nasty hack to modify OS X compile strings # to only build for a single architectutre # Karl Glazebrook (Dec 2010); sub mac_universal { # Note args passed as refs otherwise don't get modified! my @args = @_; my $s = ${$args[0]}; my $count=0; # Do matching against various combinations of # -arch ppc -arch i386 -arch x86_64 # Prefer i386 then prefer x86_64. $count++ while $s =~ /-arch\s\S+/g; return if $count <2; # Do nothing print "\nMac OS X with multiple architecture perl detected...\n"; print "Trying to figure out which arch to build for...\n"; # Figure out which single architecture to build for # when we have more than one my $singlearch = 'x86_64'; $singlearch = 'i386' if $s=~/-arch\s+i386/ & $s=~/-arch\s+ppc/; $singlearch = 'x86_64' if $s=~/-arch\s+x86_64/; # If we can find pgplot's xwindow server try and match the arch it is built for my $pgarch = ''; my $f1 = `which pgxwin_server`; chomp $f1; # Find in path $f1 = '/usr/local/bin/pgxwin_server' if !-e $f1; # Backuo choice if (-e $f1) { print "- Found $f1, trying to determine binary type\n"; my $exe = `file $f1`; chomp $exe; $pgarch = (split(' ',$exe))[-1]; } if ($pgarch ne '') { print "- Found binary type $pgarch\n"; $singlearch = $pgarch; } print "- Building for single architecture -arch $singlearch\n"; # Now substitute the single arch for the multiple pnes my $t; for $t (@args) { $$t =~ s/-arch\s\S+/TESTMARKER/; # Temp mark first occurence $$t =~ s/-arch\s\S+/ /g; # Remove all -arch's $$t =~ s/TESTMARKER/-arch $singlearch/; # Put one back print "\nRESULT: $$t\n"; } } PGPLOT-2.27/LICENSE0000644000175000017500000000073413435120245013407 0ustar osboxesosboxes LICENSE INFORMATION ------------------- The PGPLOT module for Perl is distributed under the same licensing terms as Perl itself. Please see the file "README" in the Perl distribution for more details. The PGPLOT library is copyrighted by the California Institute of Technology but is available free for education, academic research and non-commercial purposes. Please see the file copyright.notice in the PGPLOT distribtuion for more details. Karl Glazebrook 7/Dec/1996 PGPLOT-2.27/arrays.c0000644000175000017500000004576214012370505014057 0ustar osboxesosboxes/* Library of typemap functions for C arrays, idea is to provide automatic conversion between references to perl arrays and C arrays. If the argument is a scalar this is automatically detected and handles as a one element array. Thanks go to Tim Bunce for the pointer to gv.h so I could figure out how to handle glob values. Karl Glazebrook [kgb@aaoepp.aao.gov.au] Dec 95: Add double precision arrays - frossie@jach.hawaii.edu Dec 96: Add 'ref to scalar is binary' handling - kgb@aaoepp.aao.gov.au Jan 97: Handles undefined values as zero - kgb@aaoepp.aao.gov.au Feb 97: Fixed a few type cast howlers+bugs - kgb@aaoepp.aao.gov.au Apr 97: Add support for unsigned char and shorts- timj@jach.hawaii.edu */ #include "EXTERN.h" /* std perl include */ #include "perl.h" /* std perl include */ #include "XSUB.h" /* XSUB include */ /* Functions defined in this module, see header comments on each one for more details: */ #include "arrays.h" int is_scalar_ref (SV* arg) { /* Utility to determine if ref to scalar */ SV* foo; if (!SvROK(arg)) return 0; foo = SvRV(arg); if (SvPOK(foo)) return 1; else return 0; } /* #################################################################################### pack1D - argument is perl scalar variable and one char pack type. If it is a reference to a 1D array pack it and return pointer. If it is a glob pack the 1D array of the same name. If it is a scalar pack as 1 element array. If it is a reference to a scalar then assume scalar is prepacked binary data [1D-ness is checked - routine croaks if any of the array elements themselves are references.] Can be used in a typemap file (uses mortal scratch space and perl arrays know how big they are), e.g.: TYPEMAP int * T_INTP float * T_FLOATP double * T_DOUBLEP INPUT T_INTP $var = ($type)pack1D($arg,'i') T_FLOATP $var = ($type)pack1D($arg,'f') T_DOUBLEP $var = ($type)pack1D($arg,'d') */ void* pack1D ( SV* arg, char packtype ) { int iscalar; float scalar; double dscalar; short sscalar; unsigned char uscalar; AV* array; I32 i,n; SV* work; SV** work2; double nval; STRLEN len; if (is_scalar_ref(arg)) /* Scalar ref */ return (void*) SvPV(SvRV(arg), len); if (packtype!='f' && packtype!='i' && packtype!='d' && packtype!='s' && packtype != 'u') croak("Programming error: invalid type conversion specified to pack1D"); /* Create a work char variable - be cunning and make it a mortal *SV which will go away automagically when we leave the current context, i.e. no need to malloc and worry about freeing - thus we can use pack1D in a typemap! */ work = sv_2mortal(newSVpv("", 0)); /* Is arg a scalar? Return scalar*/ if (!SvROK(arg) && SvTYPE(arg)!=SVt_PVGV) { if (packtype=='f') { scalar = (float) SvNV(arg); /* Get the scalar value */ sv_setpvn(work, (char *) &scalar, sizeof(float)); /* Pack it in */ } if (packtype=='i') { iscalar = (int) SvNV(arg); /* Get the scalar value */ sv_setpvn(work, (char *) &iscalar, sizeof(int)); /* Pack it in */ } if (packtype=='d') { dscalar = (double) SvNV(arg); /*Get the scalar value */ sv_setpvn(work, (char *) &dscalar, sizeof(double)); /* Pack it in */ } if (packtype=='s') { sscalar = (short) SvNV(arg); /*Get the scalar value */ sv_setpvn(work, (char *) &sscalar, sizeof(short)); /* Pack it in */ } if (packtype=='u') { uscalar = (unsigned char) SvNV(arg); /*Get the scalar value */ sv_setpvn(work, (char *) &uscalar, sizeof(char)); /* Pack it in */ } return (void *) SvPV(work, PL_na); /* Return the pointer */ } /* Is it a glob or reference to an array? */ if (SvTYPE(arg)==SVt_PVGV || (SvROK(arg) && SvTYPE(SvRV(arg))==SVt_PVAV)) { if (SvTYPE(arg)==SVt_PVGV) { array = (AV *) GvAVn((GV*) arg); /* glob */ }else{ array = (AV *) SvRV(arg); /* reference */ } n = av_len(array); if (packtype=='f') SvGROW( work, sizeof(float)*(n+1) ); /* Pregrow for efficiency */ if (packtype=='i') SvGROW( work, sizeof(int)*(n+1) ); if (packtype=='d') SvGROW( work, sizeof(double)*(n+1) ); if (packtype=='s') SvGROW( work, sizeof(short)*(n+1) ); if (packtype=='u') SvGROW( work, sizeof(char)*(n+1) ); /* Pack array into string */ for(i=0; i<=n; i++) { work2 = av_fetch( array, i, 0 ); /* Fetch */ if (work2==NULL) nval = 0.0; /* Undefined */ else { if (SvROK(*work2)) goto errexit; /* Croak if reference [i.e. not 1D] */ nval = SvNV(*work2); } if (packtype=='f') { scalar = (float) nval; sv_catpvn( work, (char *) &scalar, sizeof(float)); } if (packtype=='i') { iscalar = (int) nval; sv_catpvn( work, (char *) &iscalar, sizeof(int)); } if (packtype=='d') { dscalar = (double) nval; sv_catpvn( work, (char *) &dscalar, sizeof(double)); } if (packtype=='s') { sscalar = (short) nval; sv_catpvn( work, (char *) &sscalar, sizeof(short)); } if (packtype=='u') { uscalar = (unsigned char) nval; sv_catpvn( work, (char *) &uscalar, sizeof(char)); } } /* Return a pointer to the byte array */ return (void *) SvPV(work, PL_na); } errexit: croak("Routine can only handle scalar values or refs to 1D arrays of scalars"); } /* ##################################################################################### pack2D - argument is perl scalar variable and one char pack type. If it is a reference to a 1D/2D array pack it and return pointer. If it is a glob pack the 1D/2D array of the same name. If it is a scalar assume it is a prepacked array and return pointer to char part of scalar. If it is a reference to a scalar then assume scalar is prepacked binary data [2Dness is checked - program croaks if any of the array elements themselves are references. Packs each row sequentially even if they are not all the same dimension - it is up to the programmer to decide if this is sensible or not.] Can be used in a typemap file (uses mortal scratch space and perl arrays know how big they are), e.g.: TYPEMAP int2D * T_INT2DP float2D * T_FLOAT2DP INPUT T_INT2DP $var = ($type)pack2D($arg,'i') T_FLOAT2DP $var = ($type)pack2D($arg,'f') [int2D/float2D would be typedef'd to int/float] */ void* pack2D ( SV* arg, char packtype ) { int iscalar; float scalar; short sscalar; double dscalar; unsigned char uscalar; AV* array; AV* array2; I32 i,j,n,m; SV* work; SV** work2; double nval; int isref; STRLEN len; if (is_scalar_ref(arg)) /* Scalar ref */ return (void*) SvPV(SvRV(arg), len); if (packtype!='f' && packtype!='i' && packtype!='d' && packtype!='s' && packtype!='u') croak("Programming error: invalid type conversion specified to pack2D"); /* Is arg a scalar? Return pointer to char part */ if (!SvROK(arg) && SvTYPE(arg)!=SVt_PVGV) { return (void *) SvPV(arg, PL_na); } /* Create a work char variable - be cunning and make it a mortal *SV which will go away automagically when we leave the current context, i.e. no need to malloc and worry about freeing - thus we can use pack2D in a typemap! */ work = sv_2mortal(newSVpv("", 0)); /* Is it a glob or reference to an array? */ if (SvTYPE(arg)==SVt_PVGV || (SvROK(arg) && SvTYPE(SvRV(arg))==SVt_PVAV)) { if (SvTYPE(arg)==SVt_PVGV) { array = GvAVn((GV*) arg); /* glob */ }else{ array = (AV *) SvRV(arg); /* reference */ } n = av_len(array); /* Pack array into string */ for(i=0; i<=n; i++) { /* Loop over 1st dimension */ work2 = av_fetch( array, i, 0 ); /* Fetch */ isref = work2!=NULL && SvROK(*work2); /* Is is a reference */ if (isref) { array2 = (AV *) SvRV(*work2); /* array of 2nd dimension */ m = av_len(array2); /* Length */ }else{ m=0; /* 1D array */ nval = SvNV(*work2); } /* Pregrow storage for efficiency on first row - note assumes array is rectangular but better than nothing */ if (i==0) { if (packtype=='f') SvGROW( work, sizeof(float)*(n+1)*(m+1) ); if (packtype=='i') SvGROW( work, sizeof(int)*(n+1)*(m+1) ); if (packtype=='s') SvGROW( work, sizeof(short)*(n+1)*(m+1) ); if (packtype=='u') SvGROW( work, sizeof(char)*(n+1)*(m+1) ); if (packtype=='d') SvGROW( work, sizeof(double)*(n+1) ); } for(j=0; j<=m; j++) { /* Loop over 2nd dimension */ if (isref) { work2 = av_fetch( array2, j, 0 ); /* Fetch element */ if (work2==NULL) nval = 0.0; /* Undefined */ else { if (SvROK(*work2)) goto errexit; /* Croak if reference [i.e. not 1D] */ nval = SvNV(*work2); } } if (packtype=='d') { dscalar = (double) nval; sv_catpvn( work, (char *) &dscalar, sizeof(double)); } if (packtype=='f') { scalar = (float) nval; sv_catpvn( work, (char *) &scalar, sizeof(float)); } if (packtype=='i') { iscalar = (int) nval; sv_catpvn( work, (char *) &iscalar, sizeof(int)); } if (packtype=='s') { sscalar = (short) nval; sv_catpvn( work, (char *) &sscalar, sizeof(short)); } if (packtype=='u') { uscalar = (unsigned char) nval; sv_catpvn( work, (char *) &uscalar, sizeof(char)); } } } /* Return a pointer to the byte array */ return (void *) SvPV(work, PL_na); } errexit: croak("Routine can only handle scalar packed char values or refs to 1D or 2D arrays"); } /* ################################################################################### packND - argument is perl scalar variable and one char pack type. arg is treated as a reference to an array of arbitrary dimensions. Pointer to packed data is returned. It is packed recursively, i.e. if an element is a scalar it is packed on the end of the string, if it is a reference the array it points to is packed on the end with further recursive traversal. For a 2D input will produce the same result as pack2D though without, obviously, dimensional checking. Since we don't know in advance how big it is we can't preallocate the storage so this may be inefficient. Note, as in other pack routines globs are handled as the equivalent 1D array. e.g. [1,[2,2,[-4,-4]]],-1,0,1, 2,3,4] is packed as 1,2,2,-4,-4,-1,0,1,2,3,4 If arg is a reference to a scalar then assume scalar is prepacked binary data. Can be used in a typemap file (uses mortal scratch space). */ void* packND ( SV* arg, char packtype ) { SV* work; STRLEN len; void pack_element(SV* work, SV** arg, char packtype); /* Called by packND */ if (is_scalar_ref(arg)) /* Scalar ref */ return (void*) SvPV(SvRV(arg), len); if (packtype!='f' && packtype!='i' && packtype!='d' && packtype!='s' && packtype!='u') croak("Programming error: invalid type conversion specified to packND"); /* Create a work char variable - be cunning and make it a mortal *SV which will go away automagically when we leave the current context, i.e. no need to malloc and worry about freeing - thus we can use packND in a typemap! */ work = sv_2mortal(newSVpv("", 0)); pack_element(work, &arg, packtype); return (void *) SvPV(work, PL_na); } /* Internal function of packND - pack an element recursively */ void pack_element(SV* work, SV** arg, char packtype) { I32 i,n; AV* array; int iscalar; float scalar; short sscalar; unsigned char uscalar; double nval; /* Pack element arg onto work recursively */ /* Is arg a scalar? Pack and return */ if (arg==NULL || (!SvROK(*arg) && SvTYPE(*arg)!=SVt_PVGV)) { if (arg==NULL) nval = 0.0; else nval = SvNV(*arg); if (packtype=='f') { scalar = (float) nval; /* Get the scalar value */ sv_catpvn(work, (char *) &scalar, sizeof(float)); /* Pack it in */ } if (packtype=='i') { iscalar = (int) nval; /* Get the scalar value */ sv_catpvn(work, (char *) &iscalar, sizeof(int)); /* Pack it in */ } if (packtype=='d') { sv_catpvn(work, (char *) &nval, sizeof(double)); /* Pack it in */ } if (packtype=='s') { sscalar = (short) nval; /* Get the scalar value */ sv_catpvn(work, (char *) &sscalar, sizeof(short)); /* Pack it in */ } if (packtype=='u') { uscalar = (unsigned char) nval; sv_catpvn(work, (char *) &uscalar, sizeof(char)); /* Pack it in */ } return; } /* Is it a glob or reference to an array? */ if (SvTYPE(*arg)==SVt_PVGV || (SvROK(*arg) && SvTYPE(SvRV(*arg))==SVt_PVAV)) { /* Dereference */ if (SvTYPE(*arg)==SVt_PVGV) { array = GvAVn((GV*)*arg); /* glob */ }else{ array = (AV *) SvRV(*arg); /* reference */ } /* Pack each array element */ n = av_len(array); for (i=0; i<=n; i++) { /* To curse is human, to recurse divine */ pack_element(work, av_fetch(array, i, 0), packtype ); } return; } errexit: croak("Routine can only handle scalars or refs to N-D arrays of scalars"); } /* ################################################################################## unpack1D - take packed string (C array) and write back into perl 1D array. If 1st argument is a reference, unpack into this array. If 1st argument is a glob, unpack into the 1D array of the same name. Can only be used in a typemap if the size of the array is known in advance or is the size of a preexisting perl array (n=0). If it is determined by another variable you may have to put in in some direct CODE: lines in the XSUB file. */ void unpack1D ( SV* arg, void * var, char packtype, int n ) { /* n is the size of array var[] (n=1 for 1 element, etc.) If n=0 take var[] as having the same dimension as array referenced by arg */ int* ivar; float* fvar; double* dvar; short* svar; unsigned char* uvar; SV* work; AV* array; I32 i,m; /* Note in ref to scalar case data is already changed */ if (is_scalar_ref(arg)) /* Do nothing */ return; if (packtype!='f' && packtype!='i' && packtype!= 'd' && packtype!='u' && packtype!='s') croak("Programming error: invalid type conversion specified to unpack1D"); m=n; array = coerce1D( arg, m ); /* Get array ref and coerce */ if (m==0) m = av_len( array )+1; if (packtype=='i') /* Cast void array var[] to appropriate type */ ivar = (int *) var; if (packtype=='f') fvar = (float *) var; if (packtype=='d') dvar = (double *) var; if (packtype=='u') uvar = (unsigned char *) var; if (packtype=='s') svar = (short *) var; /* Unpack into the array */ for(i=0; i