Fossil SCM
New pikchr.c fixes an issue with handling of the "to" phrase on a line that already has an incomplete direction add.
Commit
868c38e361715a81f596ec9dde2dce679c47df5114a7a6e1d9ec67de83a20c90
Parent
c17f5fe24697f48…
1 file changed
+24
-7
+24
-7
| --- src/pikchr.c | ||
| +++ src/pikchr.c | ||
| @@ -4065,16 +4065,18 @@ | ||
| 4065 | 4065 | static void textInit(Pik *p, PElem *pElem){ |
| 4066 | 4066 | pik_value(p, "textwid",7,0); |
| 4067 | 4067 | pik_value(p, "textht",6,0); |
| 4068 | 4068 | pElem->sw = 0.0; |
| 4069 | 4069 | } |
| 4070 | -static void textCheck(Pik *p, PElem *pElem){ | |
| 4070 | +static PPoint textOffset(Pik *p, PElem *pElem, int cp){ | |
| 4071 | 4071 | /* Automatically slim-down the width and height of text |
| 4072 | - ** elements so that the bounding box tightly encloses the text */ | |
| 4072 | + ** elements so that the bounding box tightly encloses the text, | |
| 4073 | + ** then get boxOffset() to do the offset computation. | |
| 4074 | + */ | |
| 4073 | 4075 | pik_size_to_fit(p, &pElem->errTok); |
| 4076 | + return boxOffset(p, pElem, cp); | |
| 4074 | 4077 | } |
| 4075 | - | |
| 4076 | 4078 | |
| 4077 | 4079 | /* Methods for the "sublist" class */ |
| 4078 | 4080 | static void sublistInit(Pik *p, PElem *pElem){ |
| 4079 | 4081 | PEList *pList = pElem->pSublist; |
| 4080 | 4082 | int i; |
| @@ -4230,13 +4232,13 @@ | ||
| 4230 | 4232 | { /* name */ "text", |
| 4231 | 4233 | /* isline */ 0, |
| 4232 | 4234 | /* eJust */ 0, |
| 4233 | 4235 | /* xInit */ textInit, |
| 4234 | 4236 | /* xNumProp */ 0, |
| 4235 | - /* xCheck */ textCheck, | |
| 4237 | + /* xCheck */ 0, | |
| 4236 | 4238 | /* xChop */ boxChop, |
| 4237 | - /* xOffset */ boxOffset, | |
| 4239 | + /* xOffset */ textOffset, | |
| 4238 | 4240 | /* xFit */ boxFit, |
| 4239 | 4241 | /* xRender */ boxRender |
| 4240 | 4242 | }, |
| 4241 | 4243 | }; |
| 4242 | 4244 | static const PClass sublistClass = |
| @@ -5411,11 +5413,11 @@ | ||
| 5411 | 5413 | } |
| 5412 | 5414 | if( pElem->bClose ){ |
| 5413 | 5415 | pik_error(p, pTk, "polygon is closed"); |
| 5414 | 5416 | return; |
| 5415 | 5417 | } |
| 5416 | - if( p->mTPath || p->mTPath ){ | |
| 5418 | + if( p->mTPath==3 || p->thenFlag ){ | |
| 5417 | 5419 | n = pik_next_rpath(p, pTk); |
| 5418 | 5420 | } |
| 5419 | 5421 | p->aTPath[n] = *pPt; |
| 5420 | 5422 | p->mTPath = 3; |
| 5421 | 5423 | } |
| @@ -6078,10 +6080,12 @@ | ||
| 6078 | 6080 | int i; |
| 6079 | 6081 | PPoint ofst; |
| 6080 | 6082 | PNum dx, dy; |
| 6081 | 6083 | |
| 6082 | 6084 | if( p->nErr ) return; |
| 6085 | + | |
| 6086 | + /* Position block elements */ | |
| 6083 | 6087 | ofst = pik_elem_offset(p, pElem, pElem->eWith); |
| 6084 | 6088 | dx = (pElem->with.x - ofst.x) - pElem->ptAt.x; |
| 6085 | 6089 | dy = (pElem->with.y - ofst.y) - pElem->ptAt.y; |
| 6086 | 6090 | if( dx!=0 || dy!=0 ){ |
| 6087 | 6091 | pik_elem_move(pElem, dx, dy); |
| @@ -6496,10 +6500,19 @@ | ||
| 6496 | 6500 | } |
| 6497 | 6501 | } |
| 6498 | 6502 | return 0; |
| 6499 | 6503 | } |
| 6500 | 6504 | |
| 6505 | +/* | |
| 6506 | +** Set a symbolic debugger breakpoint on this routine to receive a | |
| 6507 | +** breakpoint when the "#breakpoint" token is parsed. | |
| 6508 | +*/ | |
| 6509 | +static void pik_breakpoint(const unsigned char *z){ | |
| 6510 | + /* Prevent C compilers from optimizing out this routine. */ | |
| 6511 | + if( z[2]=='X' ) exit(1); | |
| 6512 | +} | |
| 6513 | + | |
| 6501 | 6514 | |
| 6502 | 6515 | /* |
| 6503 | 6516 | ** Return the length of next token. The token starts on |
| 6504 | 6517 | ** the pToken->z character. Fill in other fields of the |
| 6505 | 6518 | ** pToken object as appropriate. |
| @@ -6541,10 +6554,14 @@ | ||
| 6541 | 6554 | return i; |
| 6542 | 6555 | } |
| 6543 | 6556 | case '#': { |
| 6544 | 6557 | for(i=1; (c = z[i])!=0 && c!='\n'; i++){} |
| 6545 | 6558 | pToken->eType = T_WHITESPACE; |
| 6559 | + /* If the comment is "#breakpoint" then invoke the pik_breakpoint() | |
| 6560 | + ** routine. The pik_breakpoint() routie is a no-op that serves as | |
| 6561 | + ** a convenient place to set a gdb breakpoint when debugging. */ | |
| 6562 | + if( strncmp((const char*)z,"#breakpoint",11)==0 ) pik_breakpoint(z); | |
| 6546 | 6563 | return i; |
| 6547 | 6564 | } |
| 6548 | 6565 | case '/': { |
| 6549 | 6566 | if( z[1]=='*' ){ |
| 6550 | 6567 | for(i=2; z[i]!=0 && (z[i]!='*' || z[i+1]!='/'); i++){} |
| @@ -6972,6 +6989,6 @@ | ||
| 6972 | 6989 | printf("</body></html>\n"); |
| 6973 | 6990 | return 0; |
| 6974 | 6991 | } |
| 6975 | 6992 | #endif /* PIKCHR_SHELL */ |
| 6976 | 6993 | |
| 6977 | -#line 7002 "pikchr.c" | |
| 6994 | +#line 7019 "pikchr.c" | |
| 6978 | 6995 |
| --- src/pikchr.c | |
| +++ src/pikchr.c | |
| @@ -4065,16 +4065,18 @@ | |
| 4065 | static void textInit(Pik *p, PElem *pElem){ |
| 4066 | pik_value(p, "textwid",7,0); |
| 4067 | pik_value(p, "textht",6,0); |
| 4068 | pElem->sw = 0.0; |
| 4069 | } |
| 4070 | static void textCheck(Pik *p, PElem *pElem){ |
| 4071 | /* Automatically slim-down the width and height of text |
| 4072 | ** elements so that the bounding box tightly encloses the text */ |
| 4073 | pik_size_to_fit(p, &pElem->errTok); |
| 4074 | } |
| 4075 | |
| 4076 | |
| 4077 | /* Methods for the "sublist" class */ |
| 4078 | static void sublistInit(Pik *p, PElem *pElem){ |
| 4079 | PEList *pList = pElem->pSublist; |
| 4080 | int i; |
| @@ -4230,13 +4232,13 @@ | |
| 4230 | { /* name */ "text", |
| 4231 | /* isline */ 0, |
| 4232 | /* eJust */ 0, |
| 4233 | /* xInit */ textInit, |
| 4234 | /* xNumProp */ 0, |
| 4235 | /* xCheck */ textCheck, |
| 4236 | /* xChop */ boxChop, |
| 4237 | /* xOffset */ boxOffset, |
| 4238 | /* xFit */ boxFit, |
| 4239 | /* xRender */ boxRender |
| 4240 | }, |
| 4241 | }; |
| 4242 | static const PClass sublistClass = |
| @@ -5411,11 +5413,11 @@ | |
| 5411 | } |
| 5412 | if( pElem->bClose ){ |
| 5413 | pik_error(p, pTk, "polygon is closed"); |
| 5414 | return; |
| 5415 | } |
| 5416 | if( p->mTPath || p->mTPath ){ |
| 5417 | n = pik_next_rpath(p, pTk); |
| 5418 | } |
| 5419 | p->aTPath[n] = *pPt; |
| 5420 | p->mTPath = 3; |
| 5421 | } |
| @@ -6078,10 +6080,12 @@ | |
| 6078 | int i; |
| 6079 | PPoint ofst; |
| 6080 | PNum dx, dy; |
| 6081 | |
| 6082 | if( p->nErr ) return; |
| 6083 | ofst = pik_elem_offset(p, pElem, pElem->eWith); |
| 6084 | dx = (pElem->with.x - ofst.x) - pElem->ptAt.x; |
| 6085 | dy = (pElem->with.y - ofst.y) - pElem->ptAt.y; |
| 6086 | if( dx!=0 || dy!=0 ){ |
| 6087 | pik_elem_move(pElem, dx, dy); |
| @@ -6496,10 +6500,19 @@ | |
| 6496 | } |
| 6497 | } |
| 6498 | return 0; |
| 6499 | } |
| 6500 | |
| 6501 | |
| 6502 | /* |
| 6503 | ** Return the length of next token. The token starts on |
| 6504 | ** the pToken->z character. Fill in other fields of the |
| 6505 | ** pToken object as appropriate. |
| @@ -6541,10 +6554,14 @@ | |
| 6541 | return i; |
| 6542 | } |
| 6543 | case '#': { |
| 6544 | for(i=1; (c = z[i])!=0 && c!='\n'; i++){} |
| 6545 | pToken->eType = T_WHITESPACE; |
| 6546 | return i; |
| 6547 | } |
| 6548 | case '/': { |
| 6549 | if( z[1]=='*' ){ |
| 6550 | for(i=2; z[i]!=0 && (z[i]!='*' || z[i+1]!='/'); i++){} |
| @@ -6972,6 +6989,6 @@ | |
| 6972 | printf("</body></html>\n"); |
| 6973 | return 0; |
| 6974 | } |
| 6975 | #endif /* PIKCHR_SHELL */ |
| 6976 | |
| 6977 | #line 7002 "pikchr.c" |
| 6978 |
| --- src/pikchr.c | |
| +++ src/pikchr.c | |
| @@ -4065,16 +4065,18 @@ | |
| 4065 | static void textInit(Pik *p, PElem *pElem){ |
| 4066 | pik_value(p, "textwid",7,0); |
| 4067 | pik_value(p, "textht",6,0); |
| 4068 | pElem->sw = 0.0; |
| 4069 | } |
| 4070 | static PPoint textOffset(Pik *p, PElem *pElem, int cp){ |
| 4071 | /* Automatically slim-down the width and height of text |
| 4072 | ** elements so that the bounding box tightly encloses the text, |
| 4073 | ** then get boxOffset() to do the offset computation. |
| 4074 | */ |
| 4075 | pik_size_to_fit(p, &pElem->errTok); |
| 4076 | return boxOffset(p, pElem, cp); |
| 4077 | } |
| 4078 | |
| 4079 | /* Methods for the "sublist" class */ |
| 4080 | static void sublistInit(Pik *p, PElem *pElem){ |
| 4081 | PEList *pList = pElem->pSublist; |
| 4082 | int i; |
| @@ -4230,13 +4232,13 @@ | |
| 4232 | { /* name */ "text", |
| 4233 | /* isline */ 0, |
| 4234 | /* eJust */ 0, |
| 4235 | /* xInit */ textInit, |
| 4236 | /* xNumProp */ 0, |
| 4237 | /* xCheck */ 0, |
| 4238 | /* xChop */ boxChop, |
| 4239 | /* xOffset */ textOffset, |
| 4240 | /* xFit */ boxFit, |
| 4241 | /* xRender */ boxRender |
| 4242 | }, |
| 4243 | }; |
| 4244 | static const PClass sublistClass = |
| @@ -5411,11 +5413,11 @@ | |
| 5413 | } |
| 5414 | if( pElem->bClose ){ |
| 5415 | pik_error(p, pTk, "polygon is closed"); |
| 5416 | return; |
| 5417 | } |
| 5418 | if( p->mTPath==3 || p->thenFlag ){ |
| 5419 | n = pik_next_rpath(p, pTk); |
| 5420 | } |
| 5421 | p->aTPath[n] = *pPt; |
| 5422 | p->mTPath = 3; |
| 5423 | } |
| @@ -6078,10 +6080,12 @@ | |
| 6080 | int i; |
| 6081 | PPoint ofst; |
| 6082 | PNum dx, dy; |
| 6083 | |
| 6084 | if( p->nErr ) return; |
| 6085 | |
| 6086 | /* Position block elements */ |
| 6087 | ofst = pik_elem_offset(p, pElem, pElem->eWith); |
| 6088 | dx = (pElem->with.x - ofst.x) - pElem->ptAt.x; |
| 6089 | dy = (pElem->with.y - ofst.y) - pElem->ptAt.y; |
| 6090 | if( dx!=0 || dy!=0 ){ |
| 6091 | pik_elem_move(pElem, dx, dy); |
| @@ -6496,10 +6500,19 @@ | |
| 6500 | } |
| 6501 | } |
| 6502 | return 0; |
| 6503 | } |
| 6504 | |
| 6505 | /* |
| 6506 | ** Set a symbolic debugger breakpoint on this routine to receive a |
| 6507 | ** breakpoint when the "#breakpoint" token is parsed. |
| 6508 | */ |
| 6509 | static void pik_breakpoint(const unsigned char *z){ |
| 6510 | /* Prevent C compilers from optimizing out this routine. */ |
| 6511 | if( z[2]=='X' ) exit(1); |
| 6512 | } |
| 6513 | |
| 6514 | |
| 6515 | /* |
| 6516 | ** Return the length of next token. The token starts on |
| 6517 | ** the pToken->z character. Fill in other fields of the |
| 6518 | ** pToken object as appropriate. |
| @@ -6541,10 +6554,14 @@ | |
| 6554 | return i; |
| 6555 | } |
| 6556 | case '#': { |
| 6557 | for(i=1; (c = z[i])!=0 && c!='\n'; i++){} |
| 6558 | pToken->eType = T_WHITESPACE; |
| 6559 | /* If the comment is "#breakpoint" then invoke the pik_breakpoint() |
| 6560 | ** routine. The pik_breakpoint() routie is a no-op that serves as |
| 6561 | ** a convenient place to set a gdb breakpoint when debugging. */ |
| 6562 | if( strncmp((const char*)z,"#breakpoint",11)==0 ) pik_breakpoint(z); |
| 6563 | return i; |
| 6564 | } |
| 6565 | case '/': { |
| 6566 | if( z[1]=='*' ){ |
| 6567 | for(i=2; z[i]!=0 && (z[i]!='*' || z[i+1]!='/'); i++){} |
| @@ -6972,6 +6989,6 @@ | |
| 6989 | printf("</body></html>\n"); |
| 6990 | return 0; |
| 6991 | } |
| 6992 | #endif /* PIKCHR_SHELL */ |
| 6993 | |
| 6994 | #line 7019 "pikchr.c" |
| 6995 |