Category : Files from Magazines
Archive   : AWKWARD.ZIP
Filename : LISTING.2

 
Output of file : LISTING.2 contained in archive : AWKWARD.ZIP
#Listing 2. Inference engine by queries.

01 BEGIN {
02 ARGV[1] = "-";
03 printf("Enter initial condition : ");
04 getline;
05 subject = $1;
06 value = $2;
07 FS = ":";
08
09 for (;;) {
10 if ((ruleid = find_ruleid(subject, value)) != "") {
11 if ((action = find_action(ruleid)) != "") {
12 split (action, ary) ;
13 printf("%s %s : ", ary[1], ary[2]);
14 getline value;
15 subject = ary[2];
16 close("condtable");
17 close("actiontable");
18 }
19 else
20 break;
21 }
22 else
23 break;
24 }
25 }
26
27 function find_ruleid(subject, value)
28 {
29 while ((getline <"condtable") > 0) {
30 if ($1 == subject && $2 == value)
31 return $3; #return rule id
32 }
33 return "";
34 }
35
36 function find_action(ruleid)
37 {
38 while ((getline <"actiontable") > 0) {
39 if ($3 == ruleid)
40 return $1 ":" $2; # return action and subject
41 }
42 return "";
43 }


  3 Responses to “Category : Files from Magazines
Archive   : AWKWARD.ZIP
Filename : LISTING.2

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/