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

 
Output of file : LISTING.4 contained in archive : AWKWARD.ZIP
#Listing 4. Inference script using the advice tables

01 BEGIN {
02 # read advicetable into an associative array whose index is test step
03 while (getline < "advicetable" > 0)
04 rule[$1] = rule[$1] $3 ":";
05
06 for (;;) {
07 printf("Enter serial number : ");
08 if (getline > 0) {
09 if ($1 != pvsno) # if entered serial no != previous serial no
10 ctsno = $1; # initialize current serial no
11 printf("Enter test step : ");
12 if (getline > 0) {
13 if ($1 in rule) {
14 if ($1 != pvtsp) # if entered test step != previous test step
15 cttsp = $1; # initialize current test step
16 if (cttsp == pvtsp && ctsno == pvsno) {
17 # both serial no and test step are same as previous one
18 # and previous suggestion did'nt fix the problem
19 spcnt = split(rule[cttsp], ary, ":") - 1;
20 if (idxcnt < spcnt)
21 # give the next most probable suggestion
22 printf("\n\t\t**** replace %s ****\n", ary[++idxcnt]);
23 else {
24 printf("\n\t\t**** Out of suggestions ****\n");
25 pvsno = "";
26 pvtsp = "";
27 }
28 }
29 else {
30 # either serial no is different from previous one
31 # or same serial no but different test step
32 # or both serial no and test step are different
33 idxcnt = 1;
34 pvsno = ctsno;
35 pvtsp = cttsp;
36 split(rule[cttsp], ary, ":");
37 printf("\n\t\t**** Replace %s ****\n", ary[idxcnt]);
38 }
39 }
40 else {
41 printf("\n\t\t**** Missing Knowledge ****\n");
42 pvsno = "";
43 pvtsp = "";
44 }
45 }
46 }
47 }
49 }


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

  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/