Download (as "basic-lines.txt") basic-lines
#!/usr/bin/perl -w
# GDSII generation
use GDS2; # --- enable GDSII (GDS2) library
# strict checks variable declaration and subroutine argument consistency
use strict;
# ------------------------------------------------
# このファイルは実行可能ですが、意味のある図形は入っていません。枠だけです。
# 基本的な構造を説明するために用意しました
# ------------------------------------------------
my ($gds2File); # --- file handle
# 出力名を 「自分の名前.gds」 に設定します。ただし、もし、 .txt が付いていたら、それは先に削除します。
my $filename = $0; # --- set filename with the same as this script
$filename =~ s/\.txt$//; # --- Strip '.txt' part
# =~ は結果を左辺に戻します
# s/文字列1/文字列2/ は 文字列1 を 文字列2
# に置換します
# . は任意の一文字に一致しますが、
# ここでは本当の . の文字なので \を付けます
# $ は行末を意味します
$filename .= '.gds'; # --- Add '.gds' to (output) filename
# ------------------------------------------------
## 基本構造
# Structure (の定義) を並べる。Structure を並べる順序は任意。
# ただし、Structure の中に Structure の記述は不可 (つまり入れ子の定義は不可)
# Bgnstr ... Endstr
# Bgnstr ... Endstr
# のように書く
# 他で定義したものを Sref や Aref で参照するのは可能(良くある、それが普通)
# ------------------------------------------------
# ファイルの書出し開始
$gds2File = new GDS2(-fileName=> '>'. $filename); # --- open new GDS2 (object) to write
# ライブラリの開始、名前は何でも良い
$gds2File -> printInitLib(-name=>'LibraryName'); # --- always necessary for start
# 名前は何でも良いです
#
# -------------------------------------------------
$gds2File -> printBgnstr( -name=> 'first'); # --- Structure first の開始
# ここに structure (first) の中身
$gds2File -> printEndstr(); # --- Structure の終了
# -------------------------------------------------
$gds2File -> printBgnstr( -name=> 'second'); # --- Structure second の開始
# ここに structure (second) の中身
$gds2File -> printEndstr(); # --- Structure の終了
# -------------------------------------------------
# ....
# ....
# ....
# -------------------------------------------------
$gds2File -> printBgnstr( -name=> 'top'); # --- Structure top の開始
# ここに structure (top) の中身
$gds2File -> printEndstr(); # --- Structure の終了
# -------------------------------------------------
$gds2File -> printEndlib(); # --- close library
__END__
|