#!/usr/local/bin/perl
use strict;

package Gaps;
sub box($$$$){
    my ($width) = shift;
    my ($x)     = shift;
    my ($H)     = shift;
    my ($gds2File) = shift;

    my ($y) = 0;
    my ($offset) = 0;
    my ($w) = $width;

    $gds2File -> printBoundary(
	-layer=> 0,
	-xy=>[ $x,      $y, 
	       $x + $w, $y,
	       $x + $w, $y + $H,
	       $x,      $y + $H,
	       $x,      $y,]
	);
    return $x + $w + 10;
}

sub Gaps($){
    my ($gds2File) = shift;

    my ($location) = 0;
    my @set = qw(100 150 220 330 470 680 1000 2200);
    my ($H) = 4000;
    my (@CHARs);
    my ($vertical) = 0;
    
    $gds2File -> printBgnstr(-name=> 'Gaps');

    my ($X, $Y);
    foreach my $i (0..$#set) {
	if ($set[$i] < 200 ) {
	    $vertical = 1;
	    $X = $location + 100;
	} else {
	    $vertical = 0;
	    $X = $location;
	}
	push (@CHARs, common::place_text($set[$i], $X, $H + 10.0,   70, 500, $vertical, $gds2File));
	$location =    box($set[$i], $location,     $H,                 $gds2File);
    }
    $gds2File -> printEndstr;

    return 'Gaps', @CHARs;
}
    
1;
