find -- 文型の照合 その2 照合パターンの作りこみ ― 2015年08月09日 07:36
照合パターンを作りこみは、 getpat()で行います。実際には、makpat()が照合パターンの作成を行う。
findでは、この文型照合パターンpatに特別な記号を挿入し、管理します。
getpat()は、findとmakpat()のつなぎこみをするだけである。
RATFOR版は、下記の通り。
# getpat.r4 -- convert arguments into pattern integer function getpat(arg,pat) character arg(MAXARG),pat(MAXPAT) integer makpat getpat = makpat(arg,1,EOS,pat) return endWATCOM Fortran 77版は下記の通り。
c getpat.for -- convert arguments into pattern integer function getpat(arg,pat) integer*1 arg(81),pat(81) ! MAXARG(81) MAXPAT(81) integer makpat getpat = makpat(arg,1,-2,pat) ! EOS(-2) return end
makpat()では、照合パターンの先頭以外に出てきた"%"は、そのものを表すことにします。 同様に、文型の末尾以外に出現した"$"、文型の先頭に出てきた"*"を特別扱いしないで、 その文字そのものとして扱う ようにします。そうすれば、エスケープ"@"を使って文字そのものの意味にする必要がなくなり、 使い勝手が向上します。
makpat()では、patに照合パターンをaddset()を使って設定していきます。 これを使うことでpatからあふれ出すことなく 安全に照合パターンを作りことができます。
文字の類が出現した場合、getccl()使って文字の類の符号化をします。 また、stclos()を使って閉包の処理に必要な情報をセットします。 これを使うことにより閉包の情報構造を隠ぺいすることができます。
RATFOR版は下記の通り。
# makpat.r4 -- make pattern from arg(from), teminate delim integer function makpat(arg,from,delim,pat) character arg(MAXARG),delim,pat(MAXPAT) integer from character esc integer stclos,addset,getccl integer i,j,junk,lastcl,lastj,lj j = 1 lastj = 1 lastcl = 0 for (i = from; arg(i) != delim & arg(i) != EOS; i = i + 1) { lj = j if (arg(i) == ANY) junk = addset(ANY,pat,j,MAXPAT) else if (arg(i) == BOL & i == from) junk = addset(BOL,pat,j,MAXPAT) else if (arg(i) == EOL & arg(i+1) == delim) junk = addset(EOL,pat,j,MAXPAT) else if (arg(i) == CCL) { if (getccl(arg,i,pat,j) == ERR) then exit end if junk = addset(COLEND,pat,j,MAXPAT) } else if (arg(i) == CLOSURE & i > from) { lj = lastj if (pat(lj) == BOL | pat(lj) == EOL | pat(lj) == CLOSURE) break lastcl = stclos(pat,j,lastj,lastcl) } else { junk = addset(CHAR,pat,j,MAXPAT) junk = addset(esc(arg,i),pat,j,MAXPAT) } lastj = lj } if (arg(i) .ne. delim) then # terminated erarly makpat = ERR else if (addset(EOS,pat,j,MAXPAT) == NO) # no room makpat = ERR else makpat = i end if return end
WATCOM Fortran77版は下記の通り。
c makpat.for -- make pattern from arg(from), teminate delim integer function makpat(arg,from,delim,pat) integer*1 arg(81),pat(81),delim ! MAXARG(81) MAXPAT(81) integer from integer*1 esc integer stclos,addset,getccl integer i,j,junk,lastcl,lastj,lj j = 1 lastj = 1 lastcl = 0 i = from while ((arg(i) .ne. delim) .and. (arg(i) .ne. -2)) do ! EOS(-2) lj = j if (arg(i) .eq. 63) then ! ANY(63 '?') junk = addset(63,pat,j,81) ! ANY(63 '?') MAXPAT(81) else if ((arg(i) .eq. 37) ! BOL(37 '%') 1 .and. (i .eq. from)) then junk = addset(37,pat,j,81) ! BOL(37 '%') MAXPAT(81) else if ((arg(i) .eq. 36) .and. (arg(i+1) .eq. delim)) then ! EOL(36 '$') junk = addset(36,pat,j,81) ! EOL(36 '%') MAXPAT(81) else if (arg(i) .eq. 91) then ! CCL(91 '[') if (getccl(arg,i,pat,j) .eq. 0) then ! NO(0) exit end if ! junk = addset(93,pat,j,81) ! COLEND(93 ']') MAXPAT(81) else if ((arg(i) .eq. 42) .and. (i .gt. from)) then ! CLOSURE(42 '*') lj = lastj if ((pat(lj) .eq. 37) ! BOL(37 '%') 1 .or. (pat(lj) .eq. 36) ! EOL(36 '$') 2 .or. (pat(lj) .eq. 42)) then ! CLOSURE(42 '*') exit end if lastcl = stclos(pat,j,lastj,lastcl) else junk = addset(97,pat,j,81) ! CHAR(97 'a') MAXPAT(81) junk = addset(esc(arg,i),pat,j,81) ! MAXPAT(81) end if lastj = lj i = i + 1 end while if (arg(i) .ne. delim) then ! terminated erarly makpat = -1 ! ERR(-1) else if (addset(-2,pat,j,81) .eq. 0) then ! no room EOS(-2) MAXPAT(81) NO(0) makpat = -1 ! ERR(-1) else makpat = i end if return end
getccl()のRATFOR版は下記の通り。
# getccl.r4 -- expand char class at atg(i) into pat(j) integer function getccl(arg,i,pat,j) character arg(MAXARG),pat(MAXPAT) integer i,j integer addset,junk,jstart i = i + 1 if (arg(i) == NOT) { junk = addset(NCCL,pat,j,MAXPAT) i = i + 1 } else junk = addset(CCL,pat,j,MAXPAT) jstart = j junk = addset(0,pat,j,MAXPAT) # leave room for count call filset(CCLEND,arg,i,pat,j,MAXPAT) pat(jstart) = j - jstart - 1 if (arg(i) == CCLEND) getccl = OK else getccl = ERR return end
WATCOM Fortran77版は下記の通り。
c getccl.for -- expand char class at atg(i) into pat(j) integer function getccl(arg,i,pat,j) integer*1 arg(81),pat(81) ! MAXARG(81) MAXPAT(81) integer i,j integer addset,junk,jstart i = i + 1 if (arg(i) .eq. 33) then ! NOT(33 '!') junk = addset(110,pat,j,81) ! NCCL(110, 'n') MAXPAT(81) i = i + 1 else junk = addset(91,pat,j,81) ! CCL(91, '[') MAXPAT(81) end if jstart = j junk = addset(0,pat,j,81) ! leave room for count MAXPAT(81) call filset(93,arg,i,pat,j,81) ! COLEND(93 ']') MAXPAT(81) pat(jstart) = j - jstart - 1 ! save count if (arg(i) .eq. 93) then ! COLEND(93 ']') getccl = 1 ! OK(1) else getccl = -1 ! ERR(-1) end if return end
stclos()のRATFOR版は下記の通り。
# stclos.r4 -- insert closure entry at pat(j) integer function stclos(pat,j,lastj,lastcl) character pat(MAXPAT) integer j,junk,jp,jt,lastj,lastcl integer addset, for (jp = j - 1; jp >= lastj; jp = jp - 1) { make a hole jt = jp + COLSIZE junk = addset(pat(jp),pat,jt,MAXPAT) } j = j + CLOSIZE stclos = lastj junk = addset(CLOSURE,pat,lastj,MAXPAT) # put closure in it junk = addset(0,pat,lastj,MAXPAT) # COUNT junk = addset(lastcl,pat,lastj,MAXPAT) # PREVCL junk = addset(0,pat,lastj,MAXPAT) # START return end
WATCOM Fortran77版は下記の通り。
c stclos.for -- insert closure entry at pat(j) integer function stclos(pat,j,lastj,lastcl) integer*1 pat(81) ! MAXPAT(81) integer j,lastj,lastcl integer addset,junk,jp,jt jp = j - 1 ! make a hole while (jp .ge. lastj) do jt = jp + 4 ! COLSIZE(4) junk = addset(pat(jp),pat,jt,81) ! MAXPAT(81) jp = jp - 1 end while j = j + 4 ! CLOSIZE(4) stclos = lastj junk = addset(42,pat,lastj,81) ! CLOSURE(42 '*') MAXPAT(81) junk = addset(0,pat,lastj,81) ! COUNT MAXPAT(81) junk = addset(lastcl,pat,lastj,81) ! PREVCL MAXPAT(81) junk = addset(0,pat,lastj,81) ! START MAXPAT(81) return end
コメント
_ Pof.com Free Online Dating Service ― 2015年10月18日 05:06
_ quest bar coupons gnc ― 2015年10月18日 20:51
_ Pof Entrar ― 2015年10月21日 01:58
_ plenty of fish dating site of free dating ― 2015年11月06日 11:44
_ plenty of fish dating site of free dating ― 2015年11月07日 03:11
I will bookmark your weblog and check again here frequently.
I'm quite certain I will learn lots of new stuff right here!
Good luck for the next!
_ plenty of fish dating site of Free dating ― 2015年11月07日 05:44
_ kroger digital coupons Sign In ― 2015年11月11日 19:45
is genuinely fruitful in support of me, keep up posting these articles or reviews.
_ kroger feedback survey ― 2015年11月12日 20:27
I am going to tell her.
_ kroger coupons ― 2015年11月17日 15:42
topic, however, you sound like you know what you're talking about!
Thanks
_ plenty of fish ― 2015年11月26日 20:11
issues of plagorism or copyright violation? My blog has a lot of exclusive content I've either
authored myself or outsourced but it looks like a lot
of it is popping it up all over the web without my
agreement. Do you know any methods to help reduce content
from being stolen? I'd definitely appreciate it.
_ Quest bars ― 2015年11月29日 21:36
Where are your contact details though?
_ buy quest bars ― 2015年11月29日 22:20
I've saved as a favorite for later!
_ krogerfeedback.com ― 2015年12月05日 01:13
I have always disliked the idea because of the expenses.
But he's tryiong none the less. I've been using Movable-type on numerous websites for
about a year and am worried about switching to another
platform. I have heard very good things about blogengine.net.
Is there a way I can transfer all my wordpress content into it?
Any help would be really appreciated!
_ plenty of fish dating site of free dating plenty of fish dating site of free dating ― 2015年12月08日 10:11
it, you may be a great author. I will make certain to bookmark your blog and may come back later in life.
I want to encourage you continue your great posts, have a nice holiday
weekend!
_ kroger feedback ― 2015年12月09日 01:49
Keep up the terrific works guys I've incorporated you guys
to my own blogroll.
_ kroger feedback survey ― 2015年12月10日 21:32
I believe that you should write more on this issue,
it might not be a taboo matter but generally people don't speak
about these issues. To the next! Best wishes!!
_ Plenty of Fish Dating Site of Free Dating ― 2015年12月15日 08:01
Its very well written; I love what youve got to
say. But maybe you could a little more in the
way of content so people could connect with it better.
Youve got an awful lot of text for only having 1 or two pictures.
Maybe you could space it out better?
_ Plenty of Fish Dating Site of Free Dating ― 2015年12月16日 03:47
my interest. I am going to bookmark your website
and keep checking for new details about once a week.
I opted in for your RSS feed too.
_ Plenty of Fish Dating Site of Free Dating ― 2015年12月16日 04:10
_ instalar facebook ― 2015年12月19日 04:17
The clarity for your put up is just great and that i could suppose you're knowledgeable in this subject.
Well with your permission let me to seize your feed to stay up to date with imminent post.
Thanks a million and please continue the rewarding work.
_ quest bars ― 2016年02月09日 10:04
Keep up the great work! You recognize, many persons are looking around for this info,
you can aid them greatly.
_ quest bars ― 2016年02月10日 03:54
support you.
_ quest bars ― 2016年02月19日 22:26
The clarity to your submit is just great and i can assume you are an expert in this subject.
Well along with your permission allow me to grasp your
RSS feed to keep updated with impending post. Thanks a million and please keep
up the enjoyable work.
_ plenty of fish Dating site of free dating ― 2016年02月23日 13:16
at this place at this web site, I have read all that, so now me also commenting at this place.
_ Limewire Free Music Downloads ― 2016年03月07日 21:32
I have joined your feed and look forward to seeking more of your great post.
Also, I've shared your website in my social networks!
_ bernie sanders ― 2016年03月31日 21:50
information.
_ plenty of fish dating site of free dating ― 2016年09月08日 09:20
return the favor?.I'm attempting to find things to enhance my web site!I assume its
good enough to use a few of your concepts!!
_ plenty of fish dating site of free dating ― 2016年09月12日 01:59
this occasion i am reading this impressive informative post here at my home.
_ tall man shoes ― 2016年09月14日 21:09
that it's really informative. I am ging tο watch ouut for brussels.
I'll be ǥrateful if you continue this in future.
Many ρeople will Ьe benefited from your wrіting. Cheers!
_ quest bars ― 2016年09月25日 03:02
I'm trying to get my blog to rank for some targeted
keywords but I'm not seeing very good results. If you know of any
please share. Thanks!
_ plenty of fish dating site of free dating ― 2016年10月05日 14:12
paragraph, while I am also keen of getting familiarity.
_ quest bars ― 2016年10月06日 02:21
_ minecraft ― 2016年10月11日 09:18
guidance from an established blog. Is it difficult to set up your
own blog? I'm not very techincal but I can figure things out pretty quick.
I'm thinking about creating my own but I'm not sure where to begin. Do
you have any ideas or suggestions? Thank you
_ minecraft ― 2016年10月12日 14:36
_ minecraft ― 2016年10月13日 21:11
When I look at your blog in Firefox, it looks fine but when opening in Internet Explorer, it has some overlapping.
I just wanted to give you a quick heads up!
Other then that, fantastic blog!
_ juegos de minecraft ― 2016年10月15日 05:46
_ gamefly 3 month free trial ― 2016年11月16日 09:18
Im really impressed by your site.
Hey there, You've done a great job. I'll definitely digg it and individually recommend
to my friends. I am sure they'll be benefited from this web site.
Gamefly 3 month free trial
_ quest power bar ― 2016年11月20日 03:18
_ tinyurl.com ― 2016年12月01日 23:39
And i'm glad reading your article. But should remark on some general things, The web site
style is great, the articles is really great : D. Good job, cheers
_ Gamefly ― 2016年12月18日 05:48
There's a lot of folks that I think would really appreciate your
content. Please let me know. Thank you
_ Gamefly Free Trial ― 2016年12月19日 02:56
here. I did however expertise some technical issues using this site, as I experienced to reload the web site many times
previous to I could get it to load properly.
I had been wondering if your web hosting is OK?
Not that I'm complaining, but sluggish loading instances times will often affect your placement in google and can damage your
quality score if advertising and marketing with Adwords.
Well I'm adding this RSS to my email and could look out for much more of your respective intriguing content.
Make sure you update this again soon.
_ Gamefly Free Trial ― 2016年12月21日 13:24
to send you an e-mail. I've got some suggestions for your blog you might be interested in hearing.
Either way, great blog and I look forward to seeing it develop over time.
_ www.krogerfeedback.com ― 2016年12月25日 07:34
sum it up what I submitted and say, I'm thoroughly enjoying your blog.
I as well am an aspiring blog blogger but I'm still new to the whole thing.
Do you have any tips for first-time blog writers?
I'd really appreciate it.
_ www.krogerfeedback.com ― 2016年12月25日 07:47
technologies, it's remarkable article.
_ www.krogerfeedback.com ― 2016年12月25日 21:35
You are very intelligent. You recognize thus considerably in the case of this topic,
made me in my view consider it from so many various angles.
Its like men and women aren't involved except it is one thing to accomplish with Woman gaga!
Your own stuffs great. At all times handle it up!
_ www.krogerfeedback.com ― 2016年12月26日 00:33
clear idea concerning from this post.
_ match.com usa promo code ― 2017年01月04日 05:56
a quick visit this website on regular basis to take updated from most recent news update.
_ free dating sites no fees ― 2017年01月06日 16:09
Where are your contact details though?
_ free dating sites no fees ― 2017年01月06日 22:08
thanks.
_ 100 free dating sites ― 2017年01月08日 03:04
people to visit the website, that's what this web site is providing.
※コメントの受付件数を超えているため、この記事にコメントすることができません。
トラックバック
このエントリのトラックバックURL: http://kida.asablo.jp/blog/2015/08/09/7728822/tb
最近のコメント