Free Hero Mesh

Check-in [79b77f8924]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Some corrections of the logic of making up level tables from title strings containing data entry.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 79b77f8924736ac2f8ee2b4bcea57278bc34a2d3
User & Date: user on 2022-03-23 00:46:50
Other Links: manifest | tags
Context
2022-03-31
02:12
Implement the ,WinLevel instruction too set the score (currently not used by anything). check-in: 1ed0e6ebf4 user: user tags: trunk
2022-03-23
00:46
Some corrections of the logic of making up level tables from title strings containing data entry. check-in: 79b77f8924 user: user tags: trunk
2022-03-22
02:14
Implement TraceStack and ,TraceStack instructions. check-in: 189af944e7 user: user tags: trunk
Changes

Modified class.doc from [8111c6bd50] to [99fc2e3e3e].

2866
2867
2868
2869
2870
2871
2872
2873

2874
2875
2876
2877
2878
2879
2880
2881
2882

2883
2884
2885
2886
2887
2888
2889
        instead of just after it.
  \n   Skip until a line break of horizontal bar, and past it. If it is
        followed by any more consecutive line breaks without anything else
        in between, skips those ones too.
  \d   Follow by some text and then : and \ or just \ to skip to and find
        the data in the string that has the same text. If it contains a
        question mark then any single character is matched. Between : and \
        you can have usual other matching commands such as [ and ].

  +    Follow by one more character, skip past any number of them.
  -    Skip past any number of digits.
  _    Skip past any number of spaces and line breaks.
  <    Rewind back to the beginning.
  >    Skip to the end.
  #    Successful match; the result is a number within the slice, converted
        from a string (parsed as decimal) to a number.
  $    Successful match; the result is the matched slice.
  %    Successful match; the result is the length of the matched slice.


A "delimited string" in this block is delimited by any printable
character on both sides (except a character with code less than 32).

(The above list of pattern codes maybe it isn't explained very well;
hopefully someone else know how to improve it better.)








|
>









>







2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
        instead of just after it.
  \n   Skip until a line break of horizontal bar, and past it. If it is
        followed by any more consecutive line breaks without anything else
        in between, skips those ones too.
  \d   Follow by some text and then : and \ or just \ to skip to and find
        the data in the string that has the same text. If it contains a
        question mark then any single character is matched. Between : and \
        you can have usual other matching commands such as [ and ]. It can
        also be ; instead of : optionally.
  +    Follow by one more character, skip past any number of them.
  -    Skip past any number of digits.
  _    Skip past any number of spaces and line breaks.
  <    Rewind back to the beginning.
  >    Skip to the end.
  #    Successful match; the result is a number within the slice, converted
        from a string (parsed as decimal) to a number.
  $    Successful match; the result is the matched slice.
  %    Successful match; the result is the length of the matched slice.
  Z    Trace (if both -t and -v switches are used).

A "delimited string" in this block is delimited by any printable
character on both sides (except a character with code less than 32).

(The above list of pattern codes maybe it isn't explained very well;
hopefully someone else know how to improve it better.)

Modified function.c from [51aa9509a3] to [b17b014cc7].

1294
1295
1296
1297
1298
1299
1300
1301
1302

1303
1304
1305
1306
1307
1308
1309
1310
        while(*pt==10) pt++;
        break;
      case 30: // "\d"
        re:
        pp=pt=ll_find(pt,30);
        if(!pt) goto notfound;
        for(i=0;ps[i];i++) {
          if(ps[i]==':' || ps[i]=='\\') break;
          if(ps[i]!=pt[i] && ps[i]!='?') {

            pt+=i;
            goto re;
          }
        }
        ps+=i+1;
        pt+=i+2;
        break;
      case '+':







|
|
>
|







1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
        while(*pt==10) pt++;
        break;
      case 30: // "\d"
        re:
        pp=pt=ll_find(pt,30);
        if(!pt) goto notfound;
        for(i=0;ps[i];i++) {
          if(ps[i]==':' || ps[i]==';' || ps[i]=='\\') break;
          if(ps[i]!=pt[i+1] && ps[i]!='?') {
            if(!pt[i]) goto notfound;
            pt+=i?:1;
            goto re;
          }
        }
        ps+=i+1;
        pt+=i+2;
        break;
      case '+':
1350
1351
1352
1353
1354
1355
1356



1357
1358
1359
1360
1361
1362
1363
        stack[sp++]=NVALUE(1);
        return sp;
      case '%':
        if(!so || !eo || so>eo) break;
        stack[sp++]=NVALUE(eo-so);
        stack[sp++]=NVALUE(1);
        return sp;



      default: bad:
        if(main_options['v']) fprintf(stderr,"Invalid character (0x%02X) in string in LevelTable definition\n",ps[-1]);
        return 64;
    }
  }
  notfound: stack[sp++]=NVALUE(0); return sp;
}







>
>
>







1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
        stack[sp++]=NVALUE(1);
        return sp;
      case '%':
        if(!so || !eo || so>eo) break;
        stack[sp++]=NVALUE(eo-so);
        stack[sp++]=NVALUE(1);
        return sp;
      case 'Z':
        if(main_options['t'] && main_options['v']) printf("'' (str=%p title=%p sp=%d ps=%p pt=%p so=%p eo=%p pp=%p q=%p)\n",str,title,sp,ps,pt,so,eo,pp,q);
        break;
      default: bad:
        if(main_options['v']) fprintf(stderr,"Invalid character (0x%02X) in string in LevelTable definition\n",ps[-1]);
        return 64;
    }
  }
  notfound: stack[sp++]=NVALUE(0); return sp;
}