Free Hero Mesh

Check-in [a800f290bf]
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:Correct the implementation of "else" in pattern blocks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a800f290bf1f43424b4980d0c933b746808f4ded
User & Date: user on 2021-06-04 20:54:40
Other Links: manifest | tags
Context
2021-06-10
02:24
Add a document describing the code page file and code page numbers. check-in: fc010bde3f user: user tags: trunk
2021-06-04
20:54
Correct the implementation of "else" in pattern blocks check-in: a800f290bf user: user tags: trunk
2021-06-03
21:06
Some corrections to the picture editor check-in: d941198b8b user: user tags: trunk
Changes

Modified class.c from [85b9587edc] to [8f8b65d78b].

1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164

1165
1166
1167
1168
1169
1170
1171
          nest0[depth]=nest[depth]=ptr;
          cl->codes[ptr++]=tokenv;
          cl->codes[ptr++]=0;
          depth++;
          break;
        case OP_ELSE:
          if(!depth) ParseError("Premature end of subpattern\n");
          cl->codes[nest[depth-1]+1]=ptr;
          cl->codes[ptr++]=OP_ELSE;
          cl->codes[ptr++]=cl->codes[nest[depth-1]];
          cl->codes[nest[depth-1]]=OP_IF;
          cl->codes[ptr++]=0;

          break;
        case OP_THEN:
          if(!depth) ParseError("Premature end of subpattern\n");
          cl->codes[nest[--depth]+1]=ptr;
          cl->codes[ptr++]=OP_THEN;
          break;
        case OP_AGAIN:







|




>







1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
          nest0[depth]=nest[depth]=ptr;
          cl->codes[ptr++]=tokenv;
          cl->codes[ptr++]=0;
          depth++;
          break;
        case OP_ELSE:
          if(!depth) ParseError("Premature end of subpattern\n");
          cl->codes[nest[depth-1]+1]=ptr+1;
          cl->codes[ptr++]=OP_ELSE;
          cl->codes[ptr++]=cl->codes[nest[depth-1]];
          cl->codes[nest[depth-1]]=OP_IF;
          cl->codes[ptr++]=0;
          nest[depth-1]=ptr-2;
          break;
        case OP_THEN:
          if(!depth) ParseError("Premature end of subpattern\n");
          cl->codes[nest[--depth]+1]=ptr;
          cl->codes[ptr++]=OP_THEN;
          break;
        case OP_AGAIN:

Modified exec.c from [867f705250] to [57a0eefbcc].

1862
1863
1864
1865
1866
1867
1868


1869
1870
1871
1872
1873
1874
1875
1876
      break;
    case OP_TRACE:
      if(main_options['t']) {
        printf("ptr=%d cpi=%d x=%d y=%d dir=%d obj=%lu ",ptr,cpi,x,y,d,(long)n);
        printf("[ptr=%d x=%d y=%d dir=%d]\n",cp[cpi].ptr,cp[cpi].x,cp[cpi].y,cp[cpi].dir);
      }
      break;


    default: Throw("Unimplemented opcode in pattern");
  }
  goto again;
  fail:
  if(!all) {
    if(vstackptr<cp->depth) Throw("Stack underflow in pattern matching");
    vstackptr=cp[cpi].depth;
  }







>
>
|







1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
      break;
    case OP_TRACE:
      if(main_options['t']) {
        printf("ptr=%d cpi=%d x=%d y=%d dir=%d obj=%lu ",ptr,cpi,x,y,d,(long)n);
        printf("[ptr=%d x=%d y=%d dir=%d]\n",cp[cpi].ptr,cp[cpi].x,cp[cpi].y,cp[cpi].dir);
      }
      break;
    default:
      fprintf(stderr,"Unrecognized opcode 0x%04X at 0x%04X in pattern\n",code[ptr-1],ptr-1);
      Throw("Internal error: Unimplemented opcode in pattern");
  }
  goto again;
  fail:
  if(!all) {
    if(vstackptr<cp->depth) Throw("Stack underflow in pattern matching");
    vstackptr=cp[cpi].depth;
  }