concatとxprint ― 2015年04月19日 09:16
まずは、concatから。
concatは、引数にファイルを指定します。指定したファイルをひとつながりにして標準出力に書き出します。
concat file1 file2 file2 ...
concatのメイン部分は下記の通り。引数がなくなるまで取り出し、 取り出してはファイルをオープンし標準出力に書き出します。
RATFOR版は下記の通り。
# concat.r4 -- concatenate named files onto standard output character name(NAMESIZE) integer getarg, fopen integer fin,i call initfile() for (i = 1; getarg(i,name,NAMESIZE) != EOF; i = i + 1) { fin = fopen(fin,name,READ) if (fin == ERR) call cant(name) end if call fcopy(fin,STDOUT) call fclose(fin) } stop end
WATCOM fortran77版は下記の通り。
c concat.for -- concatinate named files onto standard output program concat integer getarg,fopen integer fin,i integer*1 name(81) ! NAMESIZE(81) call initfile() i = 1 while (getarg(i,name,81) .ne. -1) do ! NAMESIZE(81) EOF(-1) if (fopen(fin,name,82) .eq. -1) then ! READ(LETR) ERR(-1) call cant(name) end if call fcopy(fin,6) ! STDOUT(6) call fclose(fin) i = i + 1 end while stop end
実際の書き出しはfcopy()が行います。fcopy()は次の通り。
まずは、RATFOR版。
# fcopy.r4 -- copy file in to file out subroutine fcopy(in,out) integer in,out character buf(MAXLINE+1) integer getlin while (getlin(buf,in) != EOF) call putlin(buf,out) return end
このように、単純に入力を出力に書き出します。
WATCOM Fortran77版。
c fcopy.for -- copy file in to file out subroutine fcopy(in,out) integer in,out integer*1 buf(81+1) ! MAXLINE(81)+1 integer getlin while (getlin(buf,in) .ne. -1) do ! EOF(-1) call putlin(buf,out) end while return end
次に、xprintです。xprintは、ファイルを、1ページに、ファイル名とページ番号を適当に書き出すものです。
引数がなかった場合は、標準入力から読み込みます。この時はヘッダー部分にファイル名を書きません。
xprintのメインは下記の通り。
まずは、RATFOR版。
# xprint (default input STDIN)-- print files with headings character name(NAMESIZE) integer getarg,fopen integer fin,i string null "" call initfile() for (i = 1; getarg(i,name,NAMESIZE) != EOF; i = i + 1) { if (fopen(fin,name,READ) == ERR) call cant(name) end if call fprint(name,fin) call fclose(fin) } if (i == 1) call fprint(null,STDIN) stop end
WATCOMFortran77版は下記の通り。
c xprint (default input STDIN)-- print files with headings program xprint integer*1 name(81) ! NAMESIZE(81) integer getarg,fopen integer fin,i integer*1 null data null/' '/ call initfile() i = 1 while(getarg(i,name,81) .ne. -1) do ! NAMESIZE(81) ERR(-1) if (fopen(fin,name,82) .eq. -1) then ! READ(LETR) ERR(-1) call cant(name) end if call fprint(name,fin) call fclose(fin) i = i + 1 end while if (i .eq. 1) then call fprint(null,5) ! STDIN(5) end if stop end
使い方は、下記の通り。
xprint file
実際の書き出しは、fprint()が行います。fprint()は下記の通り。
RATFOR版です。
# fprint.r4 -- print file name from fin subroutine fprint(name,fin) character name(NAMESIZE),line(MAXLINE+1) integer fin,lineno,pageno integer getlin lineno = 0 pageno = 0 while (getlin(line,fin) != EOF) { if (lineno == 0) { call skip(MARGIN1) pageno = pageno + 1 call head(name,pageno) call skip(MARGIN2) loneno = MARGIN1 + MARGIN2 + 1 } call putlin(line,STDOUT) lineno = lineno + 1 if (lineno >= BOTTOM) { call skip(PAGELEN-lineno) lineno = 0 } } if (lineno > 0) call skip(PAGELEN-lineno) return end
WATCOM Fortran77版は下記の通り。
c fprint.for -- print file name from fin subroutine fprint(name,fin) integer*1 name(81) ! NAMESIZE(81) integer fin integer*1 line(81+1) ! MAXLINE(81) integer getlin,lineno,pageno lineno = 0 pageno = 0 while (getlin(line,fin) .ne. -1) do ! EOF(-1) if (lineno .eq. 0) then call skip(2) ! MARGIN1(2) pageno = pageno + 1 call head(name,pageno) call skip(3) ! MARGIN2(3) loneno = 2 + 3 + 1 endif call putlin(line,6) ! STDOUT(6) lineno = lineno + 1 if (lineno .ge. 62) then ! BOTTOM(62) call skip(66-lineno) ! PAGELEN(66) lineno = 0 endif end while if (lineno .gt. 0) then call skip(66-lineno) ! PAGELEN(66) end if return end
MARGIN1,MARGIN2,BOTTOM,PAGELENはLetterサイズの用紙に合わせてありますので、 A4に書き出すときは変更が必要です。また、1行80文字で書き出すので、A4縦では はみ出してしまいますので、注意が必要です。
下請けルーチンのskip()は下記の通り。指定された分だけ改行を出力します。
RATFOR版。
# skip.r4 -- output n blank lines subroutine skip(n) integer i,n for (i = 1; i <= n; i = i + 1) call putc(NEWLINE) return end
WATCOM Fortran77版。
c skip.for -- output n blank lines subroutine skip(n) integer i,n i = 1 while (i .le. n) do call putc(10) ! NEWLINE(10) i = i + 1 end while return end
また、ヘッダーを書くhead()は下記の通り。
RATFOR版。
# head.r4 -- print top of page header subroutine head(name,pageno) character name(NAMESIZE) integer pageno string page " page " call putlin(name,STDOUT) call putlin(page,STDOUT) call putdec(pageno,1) call putc(NEWLINE) return end
WATCOMM Fortran版。
c head.for -- print top of page header subroutine head(name,pageno) integer*1 name(81) ! NAMESIZE(81) integer pageno integer*1 page(8) data page/' ',' ','p','a','g','e',' ',-2/ ! EOS(-2) call putlin(name,6) ! STDOUT(6) call putlin(page,6) ! STDOUT(6) call putdec(pageno,1) call putc(10) ! NEWLINE(10) return end
コメント
_ Plenty Of Fish Dating Site Of Free Dating ― 2015年10月18日 13:22
_ lawsuit Against quest bars ― 2015年10月19日 00:20
_ match 14 day free trial ― 2015年10月28日 14:59
Do you know how to make your site mobile friendly? My web site looks weird when browsing from
my iphone. I'm trying to find a theme or plugin that might
be able to correct this issue. If you have any recommendations,
please share. Cheers!
_ match.com free trial month ― 2015年10月31日 15:40
_ forskolin extract ― 2015年11月03日 18:10
of your post's to be precisely what I'm looking for.
can you offer guest writers to write content for yourself?
I wouldn't mind composing a post or elaborating on some of the subjects you write
about here. Again, awesome site!
_ plenty of fish dating site of free dating ― 2015年11月06日 04:07
blog. Is it hard to set up your own blog? I'm not very techincal but
I can figure things out pretty fast. I'm thinking about creating my own but I'm not sure where
to begin. Do you have any tips or suggestions? Cheers
_ plenty of fish Dating site of free dating ― 2015年11月07日 14:24
get started and create my own. Do you require any html coding expertise to
make your own blog? Any help would be really appreciated!
_ www.krogerfeedback.com ― 2015年11月12日 14:07
while I was browsing on Yahoo for something else, Regardless I am here now and would just like to say kudos for a fantastic post and
a all round exciting blog (I also love the theme/design), I don't have time to read it all at the minute but
I have book-marked it and also added your RSS feeds,
so when I have time I will be back to read a great deal more, Please do keep up the awesome work.
_ Los Angeles, CA ― 2015年11月21日 12:13
desires to be available that in detail, therefore that thing is maintained over here.
_ Walmart black friday 2015 ― 2015年11月22日 13:47
I am sending it to a few friends ans additionally sharing in delicious.
And certainly, thanks in your sweat!
_ plenty of fish ― 2015年11月26日 20:59
I've joined your rss feed and sit up for searching for more of your
magnificent post. Additionally, I have shared your site in my social networks
_ black friday quest bars ― 2015年11月27日 07:22
include almost all vital infos. I'd like to peer more posts like
this .
_ plenty of fish ― 2015年11月28日 07:31
think every one is getting more from this web site, and your views
are nice for new users.
_ quest bars ― 2015年11月29日 21:37
It seems that you're doing any unique trick. In addition, The contents are masterwork.
you've done a fantastic activity on this matter!
_ quest bars ― 2015年11月29日 21:44
Thank you for posting when you have the opportunity,
Guess I'll just book mark this site.
_ quest bars ― 2015年11月30日 16:51
But, what about this? suppose you added a little content?
I mean, I don't wish to tell you how to run your website, however what if you added a title that makes people want more?
I mean concatとxprint: アナクロなコンピューターエンジニアのつぶやき is kinda plain.
You ought to look at Yahoo's front page and see how they write post headlines to get viewers
to open the links. You might add a video or a picture or two to grab readers interested about everything've got to
say. Just my opinion, it would bring your posts a little bit more interesting.
_ plenty of fish dating Site of Free dating ― 2015年12月01日 09:23
great. I do not know who you are but definitely you're going
to a famous blogger if you are not already ;) Cheers!
_ Krogerfeedback.com ― 2015年12月05日 15:22
I have joined your rss feed and look forward to seeking more of your fantastic post.
Also, I have shared your website in my social networks!
_ www.krogerfeedback.com ― 2015年12月12日 09:45
link on your page at suitable place and other person will also do similar in support of
you.
_ www.krogerfeedback.com ― 2015年12月19日 06:22
_ quest bars ― 2016年02月09日 03:48
theme? Outstanding work!
_ quest bars ― 2016年02月09日 17:35
new users of blogging, that in fact how to do blogging and
site-building.
_ quest bars ― 2016年02月19日 13:45
searching for quest bars
_ bernie sanders ― 2016年04月01日 18:10
Anyways, I'm certainly pleased I came across it
and I'll be bookmarking it and checking back often!
_ tinder dating site ― 2017年02月25日 18:53
I do think that you should write more about this subject matter, it may not be a taboo subject but usually people don't discuss such subjects.
To the next! Best wishes!!
_ tinder dating site free ― 2017年02月27日 07:36
blog. It's simple, yet effective. A lot of times it's difficult to get
that "perfect balance" between usability and visual appeal.
I must say you've done a great job with this. Additionally,
the blog loads extremely fast for me on Internet explorer.
Outstanding Blog!
_ tinder dating site ― 2017年02月28日 08:17
I'm going to start my own blog soon but I'm having a tough time selecting
between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design and style seems different
then most blogs and I'm looking for something completely unique.
P.S Sorry for being off-topic but I had to ask!
_ tinder dating site ― 2017年02月28日 21:23
by accident, while I was browsing on Aol for something else, Anyways I am here now and would just like to
say cheers for a remarkable post and a all round enjoyable blog (I also love the theme/design), I don’t have
time to look over it all at the minute but I have saved it and also included your RSS
feeds, so when I have time I will be back to read more, Please do keep up the awesome b.
_ tinder dating site ― 2017年03月02日 15:43
Thank you a lot and I'm having a look ahead to touch you.
Will you kindly drop me a e-mail?
_ minecraft ― 2017年03月02日 22:06
Great site, keep it up!
_ minecraft ― 2017年03月03日 00:38
for your time for this fantastic read!! I definitely loved every bit of it and I have you book marked to check
out new things in your blog.
_ tinder dating site ― 2017年03月05日 04:11
Anyway I will be subscribing to your feeds and
even I achievement you access consistently rapidly.
_ tinder dating site ― 2017年03月05日 13:21
This post actually made my day. You can not imagine just how much
time I had spent for this info! Thanks!
_ Dating Lancaster California ― 2017年03月09日 04:41
definitely digg it and personally recommend to my friends.
I'm confident they'll be benefited from this site.
_ http://redondobeach.mrdrain.com ― 2017年03月09日 22:46
I'm trying to determine if its a problem on my end or
if it's the blog. Any suggestions would be greatly appreciated.
_ http://tinyurl.com/ ― 2017年03月10日 21:36
stumbleupon every day. It's always useful to read articles
from other authors and practice something from their websites.
_ http://tinyurl.com ― 2017年03月11日 14:38
while I was looking on Bing for something else, Anyhow I am here now and would just like to say thanks a lot for a remarkable
post and a all round entertaining blog (I also love the theme/design), I don't
have time to read it all at the moment but I have bookmarked it and also added your RSS
feeds, so when I have time I will be back to read more,
Please do keep up the fantastic job.
_ tinyurl.com ― 2017年03月11日 22:15
this web site is genuinely pleasant.
_ tinder dating site ― 2017年03月14日 08:21
Did you make this website yourself or did you hire someone
to do it for you? Plz answer back as I'm looking to design my own blog and would like to know where u
got this from. thanks a lot
_ tinder dating site ― 2017年03月15日 11:24
site. Keep up the good writing.
_ tinder dating site ― 2017年03月18日 13:02
wanted to say that I have truly loved browsing your blog posts.
After all I'll be subscribing in your feed and I'm hoping you write once more very soon!
_ tinder dating site ― 2017年03月20日 11:40
theme. Did you create this amazing site yourself? Please reply back as I'm planning to
create my own blog and would love to find out where
you got this from or what the theme is called.
Thank you!
_ free dating sites no fees ― 2017年03月21日 19:26
commented here, I am actually enjoying by these.
_ free dating sites online and local ― 2017年03月22日 06:59
_ free dating sites no fees ― 2017年03月23日 08:23
author. I will remember to bookmark your blog and may come back
at some point. I want to encourage continue your great posts, have a nice morning!
_ 100% free dating websites massachusetts ― 2017年03月23日 08:55
and also with the structure for your blog. Is this a paid
theme or did you modify it yourself? Either way stay up the nice quality writing, it's rare to look a great
blog like this one today..
_ minecraft demo ― 2017年03月27日 05:56
What may you recommend in regards to your put
up that you just made a few days in the past? Any sure?
_ www.krogerfeedback.com ― 2017年04月29日 07:33
guest authoring on other sites? I have a blog based upon on the same ideas you discuss and would love to have you share some
stories/information. I know my readers would appreciate your work.
If you're even remotely interested, feel free to shoot me an email.
_ manicure ― 2017年05月05日 00:54
I will bookmark your blog and check again here frequently.
I am quite sure I'll learn plenty of new stuff right here!
Best of luck for the next!
_ Minecraft ― 2017年05月19日 19:19
which i am going to deliver in school.
※コメントの受付件数を超えているため、この記事にコメントすることができません。
トラックバック
このエントリのトラックバックURL: http://kida.asablo.jp/blog/2015/04/19/7614766/tb
最近のコメント