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
      end
WATCOM 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

Hi, after reading this remarkable article i am also delighted to share my knowledge here with colleagues.

_ quest bar coupons gnc ― 2015年10月18日 20:51

If you desire to take a good deal from this article then you have to apply such methods to your won website.

_ Pof Entrar ― 2015年10月21日 01:58

It's going to be finish of mine day, however before ending I am reading this wonderful post to increase my know-how.

_ plenty of fish dating site of free dating ― 2015年11月06日 11:44

Hello, i believe that i noticed you visited my site thus i got here to return the want?.I'm trying to in finding things to enhance my site!I suppose its adequate to use a few of your ideas!!

_ plenty of fish dating site of free dating ― 2015年11月07日 03:11

I like the valuable information you provide in your articles.
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

Hi, its fastidious post regarding media print, we all understand media is a wonderful source of information.

_ kroger digital coupons Sign In ― 2015年11月11日 19:45

Hi everyone, it's my first pay a quick visit at this site, and article
is genuinely fruitful in support of me, keep up posting these articles or reviews.

_ kroger feedback survey ― 2015年11月12日 20:27

Wow, this post is good, my younger sister is analyzing these kinds of things, therefore
I am going to tell her.

_ kroger coupons ― 2015年11月17日 15:42

It's hard to find knowledgeable people about this
topic, however, you sound like you know what you're talking about!

Thanks

_ plenty of fish ― 2015年11月26日 20:11

With havin so much content and articles do you ever run into any
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

This is a topic that is near to my heart... Cheers!
Where are your contact details though?

_ buy quest bars ― 2015年11月29日 22:20

Good information. Lucky me I came across your blog by accident (stumbleupon).
I've saved as a favorite for later!

_ krogerfeedback.com ― 2015年12月05日 01:13

My coder is trying to convince me to move to .net from PHP.

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

Thanks for one's marvelous posting! I really enjoyed reading
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

I enjoy what you guys are up too. Such clever work and reporting!
Keep up the terrific works guys I've incorporated you guys
to my own blogroll.

_ kroger feedback survey ― 2015年12月10日 21:32

An interesting discussion is worth comment.
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

I was curious if you ever considered changing the structure of your blog?

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

I blog often and I really appreciate your information. The article has really peaked
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

Hey very interesting blog!

_ instalar facebook ― 2015年12月19日 04:17

Just desire to say your article is as astonishing.
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

whoah this blog is wonderful i love reading your posts.
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

Hello, I enjoy reading all of your article. I wanted to write a little comment to
support you.

_ quest bars ― 2016年02月19日 22:26

Simply desire to say your article is as astounding.
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

Ahaa, its good conversation concerning this piece of writing
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

This is really interesting, You are a very skilled blogger.
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

I am genuinely pleased to read this website posts which includes tons of valuable facts, thanks for providing these kinds of
information.

_ plenty of fish dating site of free dating ― 2016年09月08日 09:20

Hello, i think that i noticed you visited my website so i got here to
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

What's up, this weekend is nice in favor of me, for the reason that
this occasion i am reading this impressive informative post here at my home.

_ tall man shoes ― 2016年09月14日 21:09

Hі there, just became alert to your blog through Ꮐoogle, ɑnd found
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

Hi there! Do you know if they make any plugins to help with SEO?
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

It's amazing to pay a quick visit this site and reading the views of all colleagues about this
paragraph, while I am also keen of getting familiarity.

_ quest bars ― 2016年10月06日 02:21

Appreciate the recommendation. Let me try it out.

_ minecraft ― 2016年10月11日 09:18

Hey! This is kind of off topic but I need some
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

Paragraph writing is also a fun, if you know after that you can write otherwise it is complex to write.

_ minecraft ― 2016年10月13日 21:11

Hey, I think your website might be having browser compatibility issues.
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

I have read so many posts about the blogger lovers except this piece of writing is in fact a good piece of writing, keep it up.

_ gamefly 3 month free trial ― 2016年11月16日 09:18

Excellent pieces. Keep posting such kind of information on your page.
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

Remarkable! Its really awesome post, I have got much clear idea concerning from this piece of writing.

_ tinyurl.com ― 2016年12月01日 23:39

I think this is among the most significant information for me.
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

Hi there! Would you mind if I share your blog with my zynga group?
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

hello there and thank you for your information – I have definitely picked up something new from right
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

Does your blog have a contact page? I'm having a tough time locating it but, I'd like
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

Hmm it seems like your website ate my first comment (it was extremely long) so I guess I'll just
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

I read this piece of writing fully concerning the resemblance of most recent and previous
technologies, it's remarkable article.

_ www.krogerfeedback.com ― 2016年12月25日 21:35

What i don't understood is in truth how you're not actually a lot more well-liked than you might be now.
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

Amazing! Its really remarkable article, I have got much
clear idea concerning from this post.

_ match.com usa promo code ― 2017年01月04日 05:56

I'm gone to inform my little brother, that he should also pay
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

This is a topic that is close to my heart... Best wishes!
Where are your contact details though?

_ free dating sites no fees ― 2017年01月06日 22:08

What's up, yes this paragraph is actually nice and I have learned lot of things from it concerning blogging.
thanks.

_ 100 free dating sites ― 2017年01月08日 03:04

Quality articles or reviews is the key to attract the
people to visit the website, that's what this web site is providing.

※コメントの受付件数を超えているため、この記事にコメントすることができません。

トラックバック

このエントリのトラックバックURL: http://kida.asablo.jp/blog/2015/08/09/7728822/tb