@@ -1,5 +1,9 @@
Revision history for Perl extension GDS2 releases
+3.33 Tweaks
+3.32 Better GDT
+3.31 Added GDT test to t/
+3.30 Try to help test problems on Linux machines.
3.29 Try to help test problems on Linux machines.
3.28 Try to help test problems on Linux machines.
@@ -0,0 +1 @@
+http://opensource.org/licenses/artistic-license-1.0
@@ -13,15 +13,21 @@ Examples/testgdt
Examples/textfile.xpm
INSTALL
lib/GDS2.pm
+LICENSE
Makefile.PL
MANIFEST
+MANIFEST.SKIP
META.yml
-README
+README.md
SIGNATURE
+t/00signature.t
t/01load.t
t/02create.t
t/03dump.t
-t/04dump.t
-t/05close2048.t
-t/pod.t
+t/04dumpGdt.t
+t/05dump.t
+t/06close2048.t
+t/09pod.t
TEST.dump
+TEST.gdt
+META.json
@@ -0,0 +1,10 @@
+#defaults
+^Makefile$
+^Makefile.old$
+^blib/
+^pm_to_blib
+^blibdirs
+MYMETA.*
+.*~$
+.*.bak$
+.*.gz$
@@ -0,0 +1,50 @@
+{
+ "abstract" : "unknown",
+ "author" : [
+ "SCHUMACK Ken Schumack"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.140640",
+ "license" : [
+ "unknown"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "GDS2",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc",
+ "t"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {}
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.3"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "perl" : "5.008001"
+ "Config" : "0"
+ "IO::File" : "0"
+ "Fcntl" : "0"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "homepage" : "https://metacpan.org/module/GDS2",
+ "license" : [
+ "http://opensource.org/licenses/artistic-license-2.0"
+ ]
+ "repository" : "https://github.com/Coolwater357/GDS2"
+ },
+ "version" : "3.33"
+}
@@ -1,21 +1,24 @@
---
+abstract: GDS2 stream module
+author: [SCHUMACK Ken Schumack]
build_requires: {}
dynamic_config: 0
name: GDS2
-version: 3.29
-author: [SCHUMACK Ken Schumack]
-abstract: GDS2 stream module
-license: artistic
+version: 3.33
resources:
- license: http://opensource.org/licenses/artistic-license-1.0
+ license: http://opensource.org/licenses/artistic-license-2.0
homepage: https://metacpan.org/module/GDS2
+ repository: https://github.com/Coolwater357/GDS2
requires:
- perl: 5.008001
+ perl: '5.008001'
+ Config: 0
+ IO::File: 0
+ Fcntl: 0
configure_requires:
ExtUtils::MakeMaker: 6.3
distribution_type: module
provides:
GDS2:
file: lib/GDS2.pm
- version: 3.29
+ version: '3.33'
@@ -1,17 +0,0 @@
-This is GDS2, a module for creating programs to read,
-write, and manipulate GDS2 (GDSII) stream files.
-
-GDS2 should be able to handle any size gdsii file but
-I would consider it too slow for anything larger
-than a few megabytes in size. If your files are are
-closer to the gigabyte range please check out my
-gdt programs at: http://sourceforge.net/projects/gds2/
-which you can use to open and process GDS2 files
-as a pipe from Perl.
-
-2014: after 15 years I'm opening up this module for anyone
-to take over in PAUSE (https://pause.perl.org/pause/).
-Peace,
-Ken Schumack
-perl -le '$_=q(Zpbhgnpe@pvnt.uxa);$_=~tr/n-sa-gt-zh-mZ/a-zS/;print;'
-
@@ -0,0 +1,21 @@
+GDS2
+====
+
+This is GDS2, a module for creating programs to read,
+write, and manipulate GDS2 (GDSII) stream files.
+
+GDS2 should be able to handle any size gdsii file but
+I would consider it too slow for anything larger
+than a few megabytes in size. If your files are are
+closer to the gigabyte range please check out my
+gdt programs at: http://sourceforge.net/projects/gds2/
+which you can use to open and process GDS2 files
+as a pipe from Perl.
+
+2014: after 15 years I'm opening up this module for anyone
+to take over in PAUSE (https://pause.perl.org/pause/).
+Peace,
+Ken Schumack
+
+perl -le '$_=q(Zpbhgnpe@pvnt.uxa);$_=~tr/n-sa-gt-zh-mZ/a-zS/;print;'
+
@@ -14,7 +14,7 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 f125849dd977a83b93a21a058892146171cdc38d Changes
+SHA1 85b75ac24ff321748d7636739e40a6a6e3c3f1a3 Changes
SHA1 333263c693790878e4f248b58a22fb84a9b4e4f4 Examples/README
SHA1 a5c80b9b4dc4e2f9d89d5440ddcfce94bf4a7b8b Examples/act_folder.xpm
SHA1 24fecfaa097d2b9c827b6a2e97bc2b48622b08b3 Examples/file.xpm
@@ -28,22 +28,28 @@ SHA1 837331fb7c6b15d605dc9b1d30eb0dda31b74ff6 Examples/testgds2
SHA1 9363d7e84e78dfd6039497698734b4d27ad1c85e Examples/testgdt
SHA1 0f924bde4e6b4ae9928d7ec39324dc0a76791815 Examples/textfile.xpm
SHA1 41aacb1486572bf9d361a1d3b04cd4d3404022bd INSTALL
-SHA1 d9b31cc5888d2cf3a910e281a63eec8a146d3269 MANIFEST
-SHA1 892f6c964554626391c78a72578941c344a19806 META.yml
+SHA1 4b8788c6f031c54021b348dd6ee00f6c1ed1380f LICENSE
+SHA1 8278bbb3536af559a070c4376f666401d5329dd4 MANIFEST
+SHA1 df2bfabf94c51d8a91d3779a99236bd99fd819ce MANIFEST.SKIP
+SHA1 2f31feae89a9560c28c07191d0908cd3a0e4df0d META.json
+SHA1 aca43da9e44ebf03401bd26bbf4805566f7d8bab META.yml
SHA1 ad40c33def87691653d4bc861128387cf4105112 Makefile.PL
-SHA1 ba7c626ff46cf9ebe657c24c25a4688909f9264c README
+SHA1 1557add55b6b1ddfe9c3adbf50c005c0e56d05d6 README.md
SHA1 58426bb60eefa0aee21731d1561bcf96193dcc1f TEST.dump
-SHA1 7dedaac37dcc2f9f442af4bf105fc89a8165dbe1 lib/GDS2.pm
+SHA1 45c6a2566acf72fdd4a77fe57e070c3b2bc956be TEST.gdt
+SHA1 cc0e5b59e238c628de0fffec6c4ac2448f0fedaf lib/GDS2.pm
+SHA1 10433aa1074b8ed12195d806a06ac52c1b7d93c4 t/00signature.t
SHA1 054dbd146baf0d4df0bcd74a41a2c691f89325e0 t/01load.t
-SHA1 7f583bf4fe2ba3b7c38459060e5b2a6cc6d3602d t/02create.t
-SHA1 787756215a643e895449c8e4ba85af497d6f123e t/03dump.t
-SHA1 b33a7117b77c30f6afc72028ded05eefb7c341bd t/04dump.t
-SHA1 67ce3487f28b7883732bbe2f816e125b09a9b8cc t/05close2048.t
-SHA1 62c46c14ffe571d3c20867e6891e41606a778078 t/pod.t
+SHA1 991862b5131e4fe16c1cc3d5b9946161b2f563c1 t/02create.t
+SHA1 90bbd7649034e7fe7ec811c0a6e0fec4f771997c t/03dump.t
+SHA1 bf34339c4e93e6740b113850880e0466f166f7c8 t/04dumpGdt.t
+SHA1 aae31340ba908c6468fbe9596f24495c8f9b1258 t/05dump.t
+SHA1 ca8d9f90031eab4896114896783770f7a3671213 t/06close2048.t
+SHA1 bb0da54f2b3f2d7955baa41ee458cb3d1887f475 t/09pod.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
-iEYEARECAAYFAlQWWwUACgkQHfVihNMxk4zaSwCdETs+a9tMvYracXpfzqp/RVPp
-iNoAni4JxcYcZLgN6c1Vx7rPS1D7JrUC
-=L7fX
+iEYEARECAAYFAlQns7MACgkQHfVihNMxk4yCqACdGwa7i6becuztV5ZtdsbLrqRE
+qNMAnRJ/ES5/VpgAqdtS6B2dn/FrP0UC
+=Rcse
-----END PGP SIGNATURE-----
@@ -0,0 +1,73 @@
+gds2{600
+m=1999-08-11 13:09:15 a=1999-09-15 11:34:10
+lib 'testlib' 0.001 1e-9
+# lines above need to stay as is (read by other tools)
+# http://sourceforge.net/projects/gds2/
+# Key: <required> [optional]
+# File format:
+# gds2{<ver>
+# m=<modificationTimeStamp> a=<accessTimeStamp>
+# lib '<libName>' <userUnits> <dataUnits>
+# <cellDefine>
+# }
+# - - - - -
+# cellDefine is one of more of:
+# cell {c=<creationTimeStamp> m=<modificationTimeStamp> '<cellName>'
+# <cellStuff>*
+# }
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+## <cellStuff>
+# cellStuff is one or more of:
+# boundary:
+# b{<layer> [dt<dataType>] xy(<xyList>) [property]*}
+#
+# path:
+# p{<layer> [dt<dataType>] [pt<pathType>] [w<real>] [bx<real>] [ex<real>] xy(<xyList>) [property]*}
+#
+# text:
+# t{<layer> [tt<textType>] [f<fontType>] [<textJust>] [pt<pathType>] [fx] [w<real>] [m<magification>] [a<angle>] xy(<xyList>) <'text'> [property]*}
+#
+# sref:
+# s{<'cellName'> [fx] [a<angle>] xy(<xyList>) [property]*}
+#
+# aref:
+# a{<'cellName'> [fx] [a<angle>] cr(<columns> <rows>) xy(<xyList>) [property]*}
+# aref xyList: 1st coord: origin, 2nd coord: X of col * xSpacing + origin, 3rd coord: Y of row * ySpacing + origin
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# property : pr{<propAttr> <'propValue'>}
+# <text> : ASCII String
+# <textJust> : two letter combination of bmt (bottom,middle,top) and rcl (right,center,left) e.g. bl (default is tl)
+# <propAttr> : a 2 byte (small) integer
+# <propValue> : ASCII String
+#
+# _____
+# | a0 x_________ a180 | x a270
+# |-- | | | |
+# | | --| |___|______
+# x | a90 _____| x
+#
+# fx a90 _____ __________x
+# x | fx | | | |
+# | ______|___| --| |
+# |-- x fx a180 | fx a270
+# |_____ | x
+#
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# # as first character on a line is a comment
+cell{c=1998-08-17 14:31:10 m=1998-08-17 14:33:47 'test'
+b{6 xy(1.1 4.2 1.1 1.15 3.9 1.15 3.9 4.2)}
+s{'testcell' xy(2.5 37.125)}
+s{'testcell' fx xy(12.5 37.125)}
+s{'testcell2' xy(112.5 37.125)}
+}
+cell{c=1999-04-20 14:41:04 m=1999-04-22 16:50:39 'testcell'
+b{40 xy(0.9 0.9 0 0.9 0 0 0.9 0)}
+}
+cell{c=1999-08-11 13:00:49 m=1999-08-11 13:00:49 'testcell2'
+b{18 xy(-0.3 -0.3 4.7 -0.3 4.7 0.3 -0.3 0.3)}
+p{16 pt2 xy(-0.425 -0.1 -0.425 -0.425 4.825 -0.425 4.825 0.425 -0.425 0.425 -0.425 0.1)}
+t{59 bl m0.1 xy(89.1 0.9) 'VDD:P'}
+t{59 bl m0.1 xy(84.6 0.9) 'IREF'}
+t{59 br fx m0.1 a90 xy(80.1 0.9) 'IBIAS'}
+}
+}
@@ -1,9 +1,9 @@
package GDS2;
{
require 5.008001;
-$GDS2::VERSION = '3.29';
+$GDS2::VERSION = '3.33';
## Note: '@ ( # )' used by the what command E.g. what GDS2.pm
-$GDS2::revision = '@(#) $Id: GDS2.pm,v $ $Revision: 3.29 $ $Date: 2014-09-14 03:27:57-06 $';
+$GDS2::revision = '@(#) $Id: GDS2.pm,v $ $Revision: 3.33 $ $Date: 2014-09-15 03:27:57-06 $';
#
=pod
@@ -26,7 +26,6 @@ This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License.
( see http://www.perl.com/pub/a/language/misc/Artistic.html )
Have fun, Ken
- perl -le '$_=q(Zpbhgnpe@pvnt.uxa);$_=~tr/n-sa-gt-zh-mZ/a-zS/;print;'
=head1 DESCRIPTION
@@ -47,9 +46,6 @@ http://sourceforge.net/projects/gds2/
# parameterized gds2 data with perl. -Years later Andreas Pawlak
# pointed out a endian problem that needed to be addressed.
#
-# 2014-02-08 modified 02create.t after learning that Joe Walsh was
-# using the test program (gasp) to learn how to use module.
-#
# POD documentation is sprinkled throughout the file in an
# attempt at Literate Programming style (which Perl partly supports ...
# see http://www.literateprogramming.com/ )
@@ -425,6 +421,7 @@ my %RecordTypeData=(
# This is the default class for the GDS2 object to use when all else fails.
$GDS2::DefaultClass = 'GDS2' unless defined $GDS2::DefaultClass;
+my $G_gdtString="";
my $G_epsilon="0.001"; ## to take care of floating point representation problems
my $G_fltLen=3;
{ #it's own name space...
@@ -439,6 +436,88 @@ $G_epsilon *= 1; #ensure it's a number
################################################################################
+=head1 Examples
+
+ Layer change:
+ here's a bare bones script to change all layer 59 to 66 given a file to
+ read and a new file to create.
+ #!/usr/bin/perl -w
+ use strict;
+ use GDS2;
+ my $fileName1 = $ARGV[0];
+ my $fileName2 = $ARGV[1];
+ my $gds2File1 = new GDS2(-fileName => $fileName1);
+ my $gds2File2 = new GDS2(-fileName => ">$fileName2");
+ while (my $record = $gds2File1 -> readGds2Record)
+ {
+ if ($gds2File1 -> returnLayer == 59)
+ {
+ $gds2File2 -> printLayer(-num=>66);
+ }
+ else
+ {
+ $gds2File2 -> printRecord(-data=>$record);
+ }
+ }
+
+
+ Gds2 dump:
+ here's a complete program to dump the contents of a stream file.
+ #!/usr/bin/perl -w
+ use GDS2;
+ $\="\n";
+ my $gds2File = new GDS2(-fileName=>$ARGV[0]);
+ while ($gds2File -> readGds2Record)
+ {
+ print $gds2File -> returnRecordAsString;
+ }
+
+
+ Gds2 dump in GDT format: which is smaller and easier to parse - http://sourceforge.net/projects/gds2/
+ #!/usr/bin/perl -w
+ use GDS2;
+ my $gds2File = new GDS2(-fileName=>$ARGV[0]);
+ while ($gds2File -> readGds2Record)
+ {
+ print $gds2File -> returnRecordAsString(-compact=>1);
+ }
+
+ Dump from the command line of a bzip2 compressed file:
+ perl -MGDS2 -MFileHandle -MIPC::Open3 -e '$f1=new FileHandle;$f0=new FileHandle;open3($f0,$f1,$f1,"bzcat test.gds.bz2");$gds=new GDS2(-fileHandle=>$f1);while($gds->readGds2Record){print $gds->returnRecordAsString(-compact=>1)}'
+
+ Create a complete GDS2 stream file from scratch:
+ #!/usr/bin/perl -w
+ use GDS2;
+ my $gds2File = new GDS2(-fileName=>'>test.gds');
+ $gds2File -> printInitLib(-name=>'testlib');
+ $gds2File -> printBgnstr(-name=>'test');
+ $gds2File -> printPath(
+ -layer=>6,
+ -pathType=>0,
+ -width=>2.4,
+ -xy=>[0,0, 10.5,0, 10.5,3.3],
+ );
+ $gds2File -> printSref(
+ -name=>'contact',
+ -xy=>[4,5.5],
+ );
+ $gds2File -> printAref(
+ -name=>'contact',
+ -columns=>2,
+ -rows=>3,
+ -xy=>[0,0, 10,0, 0,15],
+ );
+ $gds2File -> printEndstr;
+ $gds2File -> printBgnstr(-name => 'contact');
+ $gds2File -> printBoundary(
+ -layer=>10,
+ -xy=>[0,0, 1,0, 1,1, 0,1],
+ );
+ $gds2File -> printEndstr;
+ $gds2File -> printEndlib();
+
+################################################################################
+
=head1 METHODS
=head2 new - open gds2 file
@@ -447,6 +526,9 @@ $G_epsilon *= 1; #ensure it's a number
my $gds2File = new GDS2(-fileName => "filename.gds2"); ## to read
my $gds2File2 = new GDS2(-fileName => ">filename.gds2"); ## to write
+ -or- provide your own fileHandle:
+
+ my $gds2File = new GDS2(-fileHandle => $fh); ## e.g. to attach to a compression/decompression pipe
=cut
@@ -455,45 +537,58 @@ sub new
my($class,%arg) = @_;
my $self = {};
bless $self,$class || ref $class || $GDS2::DefaultClass;
+
my $fileName = $arg{'-fileName'};
- unless (defined $fileName)
+ $fileName = "" unless (defined $fileName);
+
+ my $fileHandle = $arg{'-fileHandle'};
+ $fileHandle = "" unless (defined $fileHandle);
+
+ if ($fileName && $fileHandle)
{
- die "new expects a gds2 file name. Missing -fileName => 'name' $!";
+ die "new expects a gds2 file name -OR- a file handle. Do not give both.";
}
- my $resolution = $arg{'-resolution'};
- unless (defined $resolution)
+ unless ($fileName || $fileHandle)
{
- $resolution=1000;
+ die "new expects a -fileName => 'name' OR and -fileHandle => fh $!";
}
- die "new expects a positive integer resolution. ($resolution) $!" if (($resolution <= 0) || ($resolution !~ m|^\d+$|));
my $lockMode = LOCK_SH; ## default
- my $openModStr = substr($fileName,0,2); ### looking for > or >>
- $openModStr =~ s|^\s+||;
- $openModStr =~ s|[^\+>]+||g;
- my $openModeNum = O_RDONLY;
- if ($openModStr =~ m|^\+|)
+ if ($fileName)
{
- warn("Ignoring '+' in open mode"); ## not handling this yet...
- $openModStr =~ s|\++||;
- }
- if ($openModStr eq '>')
- {
- $openModeNum = O_WRONLY|O_CREAT;
- $lockMode = LOCK_EX;
- $fileName =~ s|^$openModStr||;
- }
- elsif ($openModStr eq '>>')
- {
- $openModeNum = O_WRONLY|O_APPEND;
- $lockMode = LOCK_EX;
- $fileName =~ s|^$openModStr||;
+ my $openModStr = substr($fileName,0,2); ### looking for > or >>
+ $openModStr =~ s|^\s+||;
+ $openModStr =~ s|[^\+>]+||g;
+ my $openModeNum = O_RDONLY;
+ if ($openModStr =~ m|^\+|)
+ {
+ warn("Ignoring '+' in open mode"); ## not handling this yet...
+ $openModStr =~ s|\++||;
+ }
+ if ($openModStr eq '>')
+ {
+ $openModeNum = O_WRONLY|O_CREAT;
+ $lockMode = LOCK_EX;
+ $fileName =~ s|^$openModStr||;
+ }
+ elsif ($openModStr eq '>>')
+ {
+ $openModeNum = O_WRONLY|O_APPEND;
+ $lockMode = LOCK_EX;
+ $fileName =~ s|^$openModStr||;
+ }
+ $fileHandle = new IO::File;
+ $fileHandle -> open("$fileName",$openModeNum) or die "Unable to open $fileName because $!";
+ if (HAVE_FLOCK)
+ {
+ flock($fileHandle,$lockMode) or die "File lock on $fileName failed because $!";
+ }
}
- my $fileHandle = new IO::File;
- $fileHandle -> open("$fileName",$openModeNum) or die "Unable to open $fileName because $!";
- if (HAVE_FLOCK)
+ my $resolution = $arg{'-resolution'};
+ unless (defined $resolution)
{
- flock($fileHandle,$lockMode) or die "File lock on $fileName failed because $!";
+ $resolution=1000;
}
+ die "new expects a positive integer resolution. ($resolution) $!" if (($resolution <= 0) || ($resolution !~ m|^\d+$|));
binmode $fileHandle,':raw';
$self -> {'Fd'} = $fileHandle -> fileno;
$self -> {'FileHandle'} = $fileHandle;
@@ -504,8 +599,8 @@ sub new
$self -> {'INDATA'} = FALSE; ## in data? flag TRUE | FALSE
$self -> {'Length'} = 0; ## length of data
$self -> {'DataType'} = UNKNOWN; ## one of 7 gds datatypes
- $self -> {'UUnits'} = -1.0; ## for gds2 file
- $self -> {'DBUnits'} = -1.0; ## for gds2 file
+ $self -> {'UUnits'} = -1.0; ## for gds2 file e.g. 0.001
+ $self -> {'DBUnits'} = -1.0; ## for gds2 file e.g. 1e-9
$self -> {'Record'} = ''; ## the whole record as found in gds2 file
$self -> {'RecordType'} = UNKNOWN;
$self -> {'DataIndex'} = 0;
@@ -549,15 +644,27 @@ sub endianness
#######
#private method to clean up number
+sub cleanExpNum($)
+{
+ my $num = shift;
+ $num = sprintf("%0.${G_fltLen}e",$num);
+ $num =~ s/([1-9])0+e/$1e/;
+ $num =~ s/(\d)\.0+e/$1e/;
+ $num;
+}
+################################################################################
+
+#######
+#private method to clean up number
sub cleanFloatNum($)
{
my $num = shift;
$num = sprintf("%0.${G_fltLen}f",$num);
- $num =~ s/([1-9])0+$/$1/;
- $num =~ s/0\.0+$/0/;
+ $num =~ s/([1-9])0+$/$1/;
+ $num =~ s/(\d)\.0+$/$1/;
$num;
}
-################################################################################
+################################################################################
=head2 fileNum - file number...
@@ -757,7 +864,9 @@ sub printBgnstr
-pathType=>#,
-width=>#.#,
-unitWidth=>#, ## (optional) directly specify width in data base units (vs -width which is multipled by resolution)
+
-xy=>\@array, ## array of reals
+ # -or-
-xyInt=>\@array, ## array of internal ints (optional -wks better if you are modifying an existing GDS2 file)
);
@@ -913,7 +1022,9 @@ sub printPath
$gds2File -> printBoundary(
-layer=>#,
-dataType=>#,
+
-xy=>\@array, ## ref to array of reals
+ # -or-
-xyInt=>\@array, ## ref to array of internal ints (optional -wks better if you are modifying an existing GDS2 file)
);
@@ -976,8 +1087,11 @@ sub printBoundary
usage:
$gds2File -> printSref(
-name=>string, ## Name of structure
+
-xy=>\@array, ## ref to array of reals
+ # -or-
-xyInt=>\@array, ## ref to array of internal ints (optional -wks better than -xy if you are modifying an existing GDS2 file)
+
-angle=>#.#, ## (optional) Default is 0.0
-mag=>#.#, ## (optional) Default is 1.0
-reflect=>0|1 ## (optional)
@@ -1038,7 +1152,7 @@ sub printSref
my $angle = $arg{'-angle'};
if (! defined $angle)
{
- $angle=0;
+ $angle = -1; #not really... just means not specified
}
else
{
@@ -1050,7 +1164,7 @@ sub printSref
my $data=$reflect.'0'x15; ## 16 'bit' string
$self -> printGds2Record(-type => 'STRANS',-data => $data);
$self -> printGds2Record(-type => 'MAG',-data => $mag) if ($mag);
- $self -> printGds2Record(-type => 'ANGLE',-data => $angle) if ($angle);
+ $self -> printGds2Record(-type => 'ANGLE',-data => $angle) if ($angle >= 0);
}
my @xyTmp=(); ##don't pollute array passed in
for(my $i=0;$i<=$#$xy;$i++) ## e.g. 3.4 in -> 3400 out
@@ -1070,8 +1184,11 @@ sub printSref
-name=>string, ## Name of structure
-columns=>#, ## Default is 1
-rows=>#, ## Default is 1
+
-xy=>\@array, ## ref to array of reals
+ # -or-
-xyInt=>\@array, ## ref to array of internal ints (optional -wks better if you are modifying an existing GDS2 file)
+
-angle=>#.#, ## (optional) Default is 0.0
-mag=>#.#, ## (optional) Default is 1.0
-reflect=>0|1 ## (optional)
@@ -1133,7 +1250,7 @@ sub printAref
my $angle = $arg{'-angle'};
if (! defined $angle)
{
- $angle=0;
+ $angle = -1; #not really... just means not specified
}
else
{
@@ -1145,7 +1262,7 @@ sub printAref
my $data=$reflect.'0'x15; ## 16 'bit' string
$self -> printGds2Record(-type => 'STRANS',-data => $data);
$self -> printGds2Record(-type => 'MAG',-data => $mag) if ($mag);
- $self -> printGds2Record(-type => 'ANGLE',-data => $angle) if ($angle);
+ $self -> printGds2Record(-type => 'ANGLE',-data => $angle) if ($angle >= 0);
}
my $columns = $arg{'-columns'};
if ((! defined $columns)||($columns <= 0))
@@ -1187,8 +1304,11 @@ sub printAref
-font=>#, ## 0-3
-top, or -middle, -bottom, ##optional vertical presentation
-left, or -center, or -right, ##optional horizontal presentation
+
-xy=>\@array, ## ref to array of reals
+ # -or-
-xyInt=>\@array, ## ref to array of internal ints (optional -wks better if you are modifying an existing GDS2 file)
+
-x=>#.#, ## optional way of passing in x value
-y=>#.#, ## optional way of passing in y value
-angle=>#.#, ## (optional) Default is 0.0
@@ -1306,7 +1426,7 @@ sub printText
my $angle = $arg{'-angle'};
if (! defined $angle)
{
- $angle=0;
+ $angle = -1; #not really... just means not specified
}
else
{
@@ -1322,7 +1442,7 @@ sub printText
$self -> printGds2Record(-type=>'STRANS',-data=>$data);
}
$self -> printGds2Record(-type=>'MAG',-data=>$mag) if ($mag);
- $self -> printGds2Record(-type=>'ANGLE',-data=>$angle) if ($angle);
+ $self -> printGds2Record(-type=>'ANGLE',-data=>$angle) if ($angle >= 0);
$self -> printGds2Record(-type=>'XY',-data=>[$x,$y]);
$self -> printGds2Record(-type=>'STRING',-data=>$string);
$self -> printGds2Record(-type=>'ENDEL');
@@ -1596,7 +1716,7 @@ sub printGds2Record
my ($self,%arg) = @_;
my $type = $arg{'-type'};
- if (! defined $type)
+ unless (defined $type)
{
die "printGds2Record expects a type name. Missing -type => 'name' $!";
}
@@ -2118,7 +2238,7 @@ sub readGds2RecordData
{
die "4-byte reals are not supported $!";
}
- elsif ($self -> {'DataType'} == REAL_8) ## 8 byte real
+ elsif ($self -> {'DataType'} == REAL_8) ## 8 byte real - UNITS, MAG, ANGLE
{
my $resolution = $self -> {'Resolution'};
my $tmpListString = '';
@@ -2234,7 +2354,7 @@ sub returnRecordTypeString
usage:
while ($gds2File -> readGds2Record)
{
- print $gds2File -> returnRecordAsString;
+ print $gds2File -> returnRecordAsString(-compact=>1);
}
=cut
@@ -2303,10 +2423,7 @@ sub returnRecordAsString()
$string .= ' '.$bitString;
}
}
- elsif (
- ($self -> {'DataType'} == INTEGER_2) ||
- ($self -> {'DataType'} == REAL_8)
- )
+ elsif ($self -> {'DataType'} == INTEGER_2)
{
if ($compact)
{
@@ -2360,7 +2477,7 @@ sub returnRecordAsString()
if ($recordType eq 'UNITS')
{
$string =~ s|(\d)\.e|$1e|; ## perl on Cygwin prints "1.e-9" others "1e-9"
- $string =~ s|(\d)e\-0+|$1e-|; ## different perls print 1e-9 1e-09 1e-009 etc... change to 1e-9
+ $string =~ s|(\d)e\-0+|$1e-|; ## different perls print 1e-9 1e-09 1e-009 etc... standardize to 1e-9
}
}
elsif ($self -> {'DataType'} == INTEGER_4)
@@ -2380,6 +2497,32 @@ sub returnRecordAsString()
$string .= ')';
}
}
+ elsif ($self -> {'DataType'} == REAL_8)
+ {
+ if ($compact)
+ {
+ $string .= ' ' unless ($string =~ m/ (a|m|pt|dt|tt)$/i);
+ }
+ else
+ {
+ $string .= ' ';
+ }
+ my $num = $self -> {'RecordData'}[$i];
+ if ($num =~ m/e/i)
+ {
+ $num = cleanExpNum($num);
+ }
+ else
+ {
+ $num = cleanFloatNum($num);
+ }
+ $string .= $num;
+ if ($recordType eq 'UNITS')
+ {
+ $string =~ s|(\d)\.e|$1e|; ## perl on Cygwin prints "1.e-9" others "1e-9"
+ $string =~ s|(\d)e\-0+|$1e-|; ## different perls print 1e-9 1e-09 1e-009 etc... standardize to shorter 1e-9
+ }
+ }
elsif ($self -> {'DataType'} == ACSII_STRING)
{
$string .= ' ' if (! $compact);
@@ -2389,6 +2532,22 @@ sub returnRecordAsString()
$dateFld++ if ($dateFld);
}
+ if ($compact)
+ {
+ $G_gdtString .= $string;
+ if (($G_gdtString =~ m/}$/ || $G_gdtString =~ m/^(gds2|lib|m).*\d$/) || ($G_gdtString =~ m/^cell.*'$/))
+ {
+ $string = "$G_gdtString\n";
+ $string =~ s/{ /{/; #a little more compact
+ $string =~ s/(dt0|pt0|tt0|m1|w0|f0) //g; #these are all default in true GDT format
+ $G_gdtString = "";
+ }
+ else
+ {
+ $string = "";
+ }
+ }
+
$string;
}
################################################################################
@@ -2415,15 +2574,9 @@ sub returnXyAsArray()
{
my($self,%arg) = @_;
my $asInteger = $arg{'-asInteger'};
- if (! defined $asInteger)
- {
- $asInteger = TRUE;
- }
+ $asInteger = TRUE unless (defined $asInteger);
my $withClosure = $arg{'-withClosure'};
- if (! defined $withClosure)
- {
- $withClosure = TRUE;
- }
+ $withClosure = TRUE unless (defined $withClosure);
my @xys=();
if ($self -> isXy)
{
@@ -2473,16 +2626,13 @@ sub returnXyAsArray()
sub returnRecordAsPerl()
{
my($self,%arg) = @_;
+
my $gds2File = $arg{'-gds2File'};
- if (! defined $gds2File)
- {
- $gds2File = '$gds2File';
- }
+ $gds2File = '$gds2File' unless (defined $gds2File);
+
my $PGR = $arg{'-printGds2Record'};
- if (! defined $PGR)
- {
- $PGR = 'printGds2Record';
- }
+ $PGR = 'printGds2Record' unless (defined $PGR);
+
my $string = '';
$self -> {'UsingPrettyPrint'} = TRUE;
$string .= getStrSpace() if ($self -> {'RecordType'} != BGNSTR);
@@ -2568,9 +2718,15 @@ sub printAngle
{
my($self,%arg) = @_;
my $angle = $arg{'-num'};
- $angle=0 unless (defined $angle);
- $angle=posAngle($angle);
- $self -> printGds2Record(-type => 'ANGLE',-data => $angle) if ($angle);
+ if (defined $angle)
+ {
+ $angle=posAngle($angle);
+ }
+ else
+ {
+ $angle = -1; #not really... just means not specified
+ }
+ $self -> printGds2Record(-type => 'ANGLE',-data => $angle) if ($angle >= 0);
}
################################################################################
@@ -2719,10 +2875,7 @@ sub printDatatype
{
my($self,%arg) = @_;
my $dataType = $arg{'-num'};
- unless (defined $dataType)
- {
- $dataType=0;
- }
+ $dataType=0 unless (defined $dataType);
$self -> printGds2Record(-type => 'DATATYPE',-data => $dataType);
}
################################################################################
@@ -4596,88 +4749,6 @@ sub putStrSpace
__END__
-=head1 Examples
-
- Layer change:
- here's a bare bones script to change all layer 59 to 66 given a file to
- read and a new file to create.
- #!/usr/bin/perl -w
- use strict;
- use GDS2;
- my $fileName1 = $ARGV[0];
- my $fileName2 = $ARGV[1];
-
- my $gds2File1 = new GDS2(-fileName => $fileName1);
- my $gds2File2 = new GDS2(-fileName => ">$fileName2");
-
- while (my $record = $gds2File1 -> readGds2Record)
- {
- if ($gds2File1 -> returnLayer == 59)
- {
- $gds2File2 -> printLayer(-num=>66);
- }
- else
- {
- $gds2File2 -> printRecord(-data=>$record);
- }
- }
-
-
- Gds2 dump:
- here's a program to dump the contents of a stream file.
- #!/usr/bin/perl -w
- use GDS2;
- $\="\n";
-
- my $gds2File = new GDS2(-fileName=>$ARGV[0]);
- while ($gds2File -> readGds2Record)
- {
- print $gds2File -> returnRecordAsString;
- }
-
- Gds2 dump in GDT format (http://sourceforge.net/projects/gds2/) which is easier to parse
- #!/usr/bin/perl -w
- use GDS2;
- $\="\n";
-
- my $gds2File = new GDS2(-fileName=>$ARGV[0]);
- while ($gds2File -> readGds2Record)
- {
- print $gds2File -> returnRecordAsString(-compact);
- }
-
-
- Create a complete GDS2 stream file from scratch:
- #!/usr/bin/perl -w
- use GDS2;
- my $gds2File = new GDS2(-fileName=>'>test.gds');
- $gds2File -> printInitLib(-name=>'testlib');
- $gds2File -> printBgnstr(-name=>'test');
- $gds2File -> printPath(
- -layer=>6,
- -pathType=>0,
- -width=>2.4,
- -xy=>[0,0, 10.5,0, 10.5,3.3],
- );
- $gds2File -> printSref(
- -name=>'contact',
- -xy=>[4,5.5],
- );
- $gds2File -> printAref(
- -name=>'contact',
- -columns=>2,
- -rows=>3,
- -xy=>[0,0, 10,0, 0,15],
- );
- $gds2File -> printEndstr;
- $gds2File -> printBgnstr(-name => 'contact');
- $gds2File -> printBoundary(
- -layer=>10,
- -xy=>[0,0, 1,0, 1,1, 0,1],
- );
- $gds2File -> printEndstr;
- $gds2File -> printEndlib();
-
=head1 GDS2 Stream Format
#########################################################################################
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+print "1..1\n";
+
+if (! $ENV{TEST_SIGNATURE})
+{
+ print "ok 1 # skip Set the environment variable TEST_SIGNATURE to enable this test\n";
+}
+elsif (! -s 'SIGNATURE')
+{
+ print "ok 1 # skip No signature file found\n";
+}
+elsif (! eval { require Module::Signature; 1 })
+{
+ print "ok 1 # skip ",
+ "Next time around, consider install Module::Signature, ",
+ "so you can verify the integrity of this distribution.\n";
+}
+elsif (! eval { require Socket; Socket::inet_aton('pool.sks-keyservers.net') })
+{
+ print "ok 1 # skip ", "Cannot connect to the keyserver\n";
+}
+else
+{
+ (Module::Signature::verify() == Module::Signature::SIGNATURE_OK()) or print "not ";
+ print "ok 1 # Valid signature\n";
+}
+
+__END__
+
@@ -1,11 +1,4 @@
-# Before `Build install' is performed this script should be runnable with
-# `Build test'. After `Build install' it should work as `perl t/02create.t'
-
-######################### We start with some black magic to print on failure.
-
# Change 1..1 below to 1..last_test_to_print .
-# (It may become useful if the test is moved to ./t subdirectory.)
-
BEGIN { $| = 1; print "1..2\n"; }
END {print "not ok 2\n" unless $loaded;}
use GDS2;
@@ -44,6 +44,7 @@ close DUMPIN;
my $gds2File = new GDS2(-fileName => 'testdump.gds');
my $G_epsilon = $gds2File -> getG_epsilon;
+my $G_fltLen = $gds2File -> getG_fltLen;
open(DUMPOUT,">dump.out") or die "Unable to create dump.out $!";
while ($gds2File -> readGds2Record)
{
@@ -65,7 +66,7 @@ while (<DUMPIN>)
if ($line1 ne $line2)
{
$good = 0;
- print STDERR "\nline $lineCnt> old:$line1 != new:$line2 -> Check your Perl - maybe you only need to adjust your LD_LIBRARY_PATH, but your Perl can not do math very accurately. Developer note: G_epsilon==$G_epsilon\n";
+ print STDERR "\nline $lineCnt> old:$line1 != new:$line2 -> DeveloperNote: G_epsilon==$G_epsilon G_fltLen=$G_fltLen\n";
}
}
close DUMPIN;
@@ -1,82 +0,0 @@
-my $loaded;
-BEGIN { $| = 1; $loaded = 0; print "1..2\n"; }
-use GDS2;
-sub ok
-{
- my ($n, $result, @info) = @_;
- if ($result) {
- print "ok $n\n";
- }
- else {
- print "not ok $n\n";
- print "# @info\n" if @info;
- }
-}
-
-$loaded = 1;
-ok(1,$loaded,'problem with GDS2 load.');
-
-open(DUMPIN,"TEST.dump") or die "Unable to read TEST.dump because $!";
-my $gds2FileOut = new GDS2(-fileName => ">testdump.gds");
-my $G_epsilon = $gds2FileOut -> getG_epsilon;
-my $isLittleEndian = $gds2FileOut -> endianness;
-my $dataString;
-while (<DUMPIN>)
-{
- my $line=$_;
- $line=~s|^\s+||; ## make following comparisions easier...
- next if (m|^#|); ## see # as here-to-line-end comment
- chomp $line;
- $line=~s|#.*||;
- $line=~s|$| |g; ## for match below
- $dataString='';
- if ($line =~ m|^([a-z]+) (.*)|i)
- {
- my $type=$1;
- $dataString=$2 if (defined $2);
- $gds2FileOut -> printGds2Record(-type=>$type,-asciiData=>$dataString)
- }
- else
- {
- print STDERR "\nWARNING: Unable to parse '$line'\n";
- }
-}
-$gds2FileOut -> close;
-close DUMPIN;
-
-my $gds2File = new GDS2(-fileName => 'testdump.gds');
-open(DUMPOUT,">dump.out") or die "Unable to create dump.out $!";
-while ($gds2File -> readGds2RecordHeader)
-{
- $gds2File -> readGds2RecordData();
- print DUMPOUT $gds2File -> returnRecordAsString."\n";
-}
-close DUMPOUT;
-
-my $good=1;
-open(DUMPOUT,"dump.out") or die "Unable to read dump.out $!";
-open(DUMPIN,"TEST.dump") or die "Unable to read TEST.dump because $!";
-my $lineCnt=0;
-while (<DUMPIN>)
-{
- $lineCnt++;
- chomp;
- my $line1=$_;
- my $line2 = <DUMPOUT>;
- chomp $line2;
- if ($line1 ne $line2)
- {
- $good = 0;
- print STDERR "\nline $lineCnt> old:$line1 != new:$line2 -> Check your Perl - maybe you only need to adjust your LD_LIBRARY_PATH, but your Perl can not do math very accurately. Developer note: G_epsilon==$G_epsilon isLittleEndian==$isLittleEndian\n";
- }
-}
-close DUMPIN;
-close DUMPOUT;
-if ($good)
-{
- unlink"testdump.gds";
- unlink "dump.out";
-}
-ok(2,$good,'problem with ascii dump 2.');
-0;
-
@@ -0,0 +1,81 @@
+my $loaded;
+BEGIN { $| = 1; $loaded = 0; print "1..2\n"; }
+use GDS2;
+sub ok
+{
+ my ($n, $result, @info) = @_;
+ if ($result) {
+ print "ok $n\n";
+ }
+ else {
+ print "not ok $n\n";
+ print "# @info\n" if @info;
+ }
+}
+
+$loaded = 1;
+ok(1,$loaded,'problem with GDS2 load.');
+
+open(DUMPIN,"TEST.dump") or die "Unable to read TEST.dump because $!";
+my $gds2FileOut = new GDS2(-fileName => ">testdump.gds");
+my $dataString;
+while (<DUMPIN>)
+{
+ my $line=$_;
+ $line=~s|^\s+||; ## make following comparisions easier...
+ next if (m|^#|); ## see # as here-to-line-end comment
+ chomp $line;
+ $line=~s|#.*||;
+ $line=~s|$| |g; ## for match below
+ $dataString='';
+ if ($line =~ m|^([a-z]+) (.*)|i)
+ {
+ my $type=$1;
+ $dataString=$2 if (defined $2);
+ $gds2FileOut -> printGds2Record(-type=>$type,-asciiData=>$dataString)
+ }
+ else
+ {
+ print STDERR "\nWARNING: Unable to parse '$line'\n";
+ }
+}
+$gds2FileOut -> close;
+close DUMPIN;
+
+my $gds2File = new GDS2(-fileName => 'testdump.gds');
+my $G_epsilon = $gds2File -> getG_epsilon;
+my $G_fltLen = $gds2File -> getG_fltLen;
+open(DUMPOUT,">dump.gdt") or die "Unable to create dump.gdt $!";
+my $printLine = "";
+while ($gds2File -> readGds2Record)
+{
+ my $line = $gds2File -> returnRecordAsString(-compact => 1);
+ print DUMPOUT "$line";
+}
+close DUMPOUT;
+
+my $good=1;
+open(DUMPNEW,"dump.gdt") or die "Unable to read dump.gdt $!";
+open(DUMPOLD,"TEST.gdt") or die "Unable to read TEST.gdt because $!";
+READGDT: while (my $line1 = <DUMPOLD>)
+{
+ next READGDT if ($line1 =~ m/^#/); #comment
+ chomp $line1;
+ my $line2 = <DUMPNEW>;
+ chomp $line2;
+ if ($line1 ne $line2)
+ {
+ $good = 0;
+ print STDERR "\nold:$line1 != new:$line2 -> DeveloperNote: G_epsilon==$G_epsilon G_fltLen=$G_fltLen\n";
+ }
+}
+close DUMPOLD;
+close DUMPNEW;
+if ($good)
+{
+ unlink"testdump.gds";
+ unlink "dump.gdt";
+}
+ok(2,$good,'problem with ascii dump.');
+0;
+
@@ -1,64 +0,0 @@
-# Before `Build install' is performed this script should be runnable with
-# `Build test'. After `Build install' it should work as `perl t/02create.t'
-
-######################### We start with some black magic to print on failure.
-
-# Change 1..1 below to 1..last_test_to_print .
-# (It may become useful if the test is moved to ./t subdirectory.)
-
-BEGIN { $| = 1; print "1..2\n"; }
-END {print "not ok 2\n" unless $loaded;}
-use GDS2;
-$loaded = 1;
-print "ok 1\n";
-
-######################### End of black magic.
-
-# Insert your test code below (better if it prints "ok 13"
-# (correspondingly "not ok 13") depending on the success of chunk 13
-# of the test code):
-
-use strict;
-sub ok
-{
- my ($n, $result, @info) = @_;
- if ($result) {
- print "ok $n\n";
- unlink "test.gds";
- }
- else {
- print "not ok $n\n";
- print "# @info\n" if @info;
- }
-}
-
-my $gds2File = new GDS2(-fileName=>'>test.gds');
-$gds2File -> printInitLib(-name=>'testlib');
-$gds2File -> printBgnstr(-name=>'test');
-$gds2File -> printPath(
- -layer=>6,
- -pathType=>0,
- -width=>2.4,
- -xy=>[0,0, 10.5,0, 10.5,3.3],
- );
-$gds2File -> printSref(
- -name=>'contact',
- -xy=>[4,5.5],
- );
-$gds2File -> printAref(
- -name=>'contact',
- -columns=>2,
- -rows=>3,
- -xy=>[0,0],
- );
-$gds2File -> printEndstr;
-$gds2File -> printBgnstr(-name => 'contact');
-$gds2File -> printBoundary(
- -layer=>10,
- -xy=>[0,0, 1,0, 1,1, 0,1],
- );
-$gds2File -> printEndstr;
-$gds2File -> printEndlib();
-$gds2File -> close(-pad=>2048);
-ok 2,(stat("test.gds"))[7] == 2048, 'Size of test.gds looks wrong.';
-
@@ -0,0 +1,83 @@
+my $loaded;
+BEGIN { $| = 1; $loaded = 0; print "1..2\n"; }
+use GDS2;
+sub ok
+{
+ my ($n, $result, @info) = @_;
+ if ($result) {
+ print "ok $n\n";
+ }
+ else {
+ print "not ok $n\n";
+ print "# @info\n" if @info;
+ }
+}
+
+$loaded = 1;
+ok(1,$loaded,'problem with GDS2 load.');
+
+open(DUMPIN,"TEST.dump") or die "Unable to read TEST.dump because $!";
+my $gds2FileOut = new GDS2(-fileName => ">testdump.gds");
+my $G_epsilon = $gds2FileOut -> getG_epsilon;
+my $G_fltLen = $gds2FileOut -> getG_fltLen;
+my $isLittleEndian = $gds2FileOut -> endianness;
+my $dataString;
+while (<DUMPIN>)
+{
+ my $line=$_;
+ $line=~s|^\s+||; ## make following comparisions easier...
+ next if (m|^#|); ## see # as here-to-line-end comment
+ chomp $line;
+ $line=~s|#.*||;
+ $line=~s|$| |g; ## for match below
+ $dataString='';
+ if ($line =~ m|^([a-z]+) (.*)|i)
+ {
+ my $type=$1;
+ $dataString=$2 if (defined $2);
+ $gds2FileOut -> printGds2Record(-type=>$type,-asciiData=>$dataString)
+ }
+ else
+ {
+ print STDERR "\nWARNING: Unable to parse '$line'\n";
+ }
+}
+$gds2FileOut -> close;
+close DUMPIN;
+
+my $gds2File = new GDS2(-fileName => 'testdump.gds');
+open(DUMPOUT,">dump.out") or die "Unable to create dump.out $!";
+while ($gds2File -> readGds2RecordHeader)
+{
+ $gds2File -> readGds2RecordData();
+ print DUMPOUT $gds2File -> returnRecordAsString."\n";
+}
+close DUMPOUT;
+
+my $good=1;
+open(DUMPOUT,"dump.out") or die "Unable to read dump.out $!";
+open(DUMPIN,"TEST.dump") or die "Unable to read TEST.dump because $!";
+my $lineCnt=0;
+while (<DUMPIN>)
+{
+ $lineCnt++;
+ chomp;
+ my $line1=$_;
+ my $line2 = <DUMPOUT>;
+ chomp $line2;
+ if ($line1 ne $line2)
+ {
+ $good = 0;
+ print STDERR "\nline $lineCnt> old:$line1 != new:$line2 -> DeveloperNote: G_epsilon==$G_epsilon G_fltLen=$G_fltLen isLittleEndian==$isLittleEndian\n";
+ }
+}
+close DUMPIN;
+close DUMPOUT;
+if ($good)
+{
+ unlink"testdump.gds";
+ unlink "dump.out";
+}
+ok(2,$good,'problem with ascii dump 2.');
+0;
+
@@ -0,0 +1,57 @@
+# Change 1..1 below to 1..last_test_to_print .
+BEGIN { $| = 1; print "1..2\n"; }
+END {print "not ok 2\n" unless $loaded;}
+use GDS2;
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
+use strict;
+sub ok
+{
+ my ($n, $result, @info) = @_;
+ if ($result) {
+ print "ok $n\n";
+ unlink "test.gds";
+ }
+ else {
+ print "not ok $n\n";
+ print "# @info\n" if @info;
+ }
+}
+
+my $gds2File = new GDS2(-fileName=>'>test.gds');
+$gds2File -> printInitLib(-name=>'testlib');
+$gds2File -> printBgnstr(-name=>'test');
+$gds2File -> printPath(
+ -layer=>6,
+ -pathType=>0,
+ -width=>2.4,
+ -xy=>[0,0, 10.5,0, 10.5,3.3],
+ );
+$gds2File -> printSref(
+ -name=>'contact',
+ -xy=>[4,5.5],
+ );
+$gds2File -> printAref(
+ -name=>'contact',
+ -columns=>2,
+ -rows=>3,
+ -xy=>[0,0],
+ );
+$gds2File -> printEndstr;
+$gds2File -> printBgnstr(-name => 'contact');
+$gds2File -> printBoundary(
+ -layer=>10,
+ -xy=>[0,0, 1,0, 1,1, 0,1],
+ );
+$gds2File -> printEndstr;
+$gds2File -> printEndlib();
+$gds2File -> close(-pad=>2048);
+ok 2,(stat("test.gds"))[7] == 2048, 'Size of test.gds looks wrong.';
+
@@ -0,0 +1,5 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
+
@@ -1,8 +0,0 @@
-# Before `Build install' is performed this script should be runnable with
-# `Build test'. After `Build install' it should work as `perl t/01load.t'
-# (It may become useful if the test is moved to ./t subdirectory.)
-use Test::More;
-eval "use Test::Pod 1.00";
-plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
-all_pod_files_ok();
-