Fossil SCM

New pikchr.c fixes an issue with handling of the "to" phrase on a line that already has an incomplete direction add.

drh 2020-09-14 16:29 trunk
Commit 868c38e361715a81f596ec9dde2dce679c47df5114a7a6e1d9ec67de83a20c90
1 file changed +24 -7
+24 -7
--- src/pikchr.c
+++ src/pikchr.c
@@ -4065,16 +4065,18 @@
40654065
static void textInit(Pik *p, PElem *pElem){
40664066
pik_value(p, "textwid",7,0);
40674067
pik_value(p, "textht",6,0);
40684068
pElem->sw = 0.0;
40694069
}
4070
-static void textCheck(Pik *p, PElem *pElem){
4070
+static PPoint textOffset(Pik *p, PElem *pElem, int cp){
40714071
/* 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
+ */
40734075
pik_size_to_fit(p, &pElem->errTok);
4076
+ return boxOffset(p, pElem, cp);
40744077
}
4075
-
40764078
40774079
/* Methods for the "sublist" class */
40784080
static void sublistInit(Pik *p, PElem *pElem){
40794081
PEList *pList = pElem->pSublist;
40804082
int i;
@@ -4230,13 +4232,13 @@
42304232
{ /* name */ "text",
42314233
/* isline */ 0,
42324234
/* eJust */ 0,
42334235
/* xInit */ textInit,
42344236
/* xNumProp */ 0,
4235
- /* xCheck */ textCheck,
4237
+ /* xCheck */ 0,
42364238
/* xChop */ boxChop,
4237
- /* xOffset */ boxOffset,
4239
+ /* xOffset */ textOffset,
42384240
/* xFit */ boxFit,
42394241
/* xRender */ boxRender
42404242
},
42414243
};
42424244
static const PClass sublistClass =
@@ -5411,11 +5413,11 @@
54115413
}
54125414
if( pElem->bClose ){
54135415
pik_error(p, pTk, "polygon is closed");
54145416
return;
54155417
}
5416
- if( p->mTPath || p->mTPath ){
5418
+ if( p->mTPath==3 || p->thenFlag ){
54175419
n = pik_next_rpath(p, pTk);
54185420
}
54195421
p->aTPath[n] = *pPt;
54205422
p->mTPath = 3;
54215423
}
@@ -6078,10 +6080,12 @@
60786080
int i;
60796081
PPoint ofst;
60806082
PNum dx, dy;
60816083
60826084
if( p->nErr ) return;
6085
+
6086
+ /* Position block elements */
60836087
ofst = pik_elem_offset(p, pElem, pElem->eWith);
60846088
dx = (pElem->with.x - ofst.x) - pElem->ptAt.x;
60856089
dy = (pElem->with.y - ofst.y) - pElem->ptAt.y;
60866090
if( dx!=0 || dy!=0 ){
60876091
pik_elem_move(pElem, dx, dy);
@@ -6496,10 +6500,19 @@
64966500
}
64976501
}
64986502
return 0;
64996503
}
65006504
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
+
65016514
65026515
/*
65036516
** Return the length of next token. The token starts on
65046517
** the pToken->z character. Fill in other fields of the
65056518
** pToken object as appropriate.
@@ -6541,10 +6554,14 @@
65416554
return i;
65426555
}
65436556
case '#': {
65446557
for(i=1; (c = z[i])!=0 && c!='\n'; i++){}
65456558
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);
65466563
return i;
65476564
}
65486565
case '/': {
65496566
if( z[1]=='*' ){
65506567
for(i=2; z[i]!=0 && (z[i]!='*' || z[i+1]!='/'); i++){}
@@ -6972,6 +6989,6 @@
69726989
printf("</body></html>\n");
69736990
return 0;
69746991
}
69756992
#endif /* PIKCHR_SHELL */
69766993
6977
-#line 7002 "pikchr.c"
6994
+#line 7019 "pikchr.c"
69786995
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button