Fossil SCM

Merged in trunk.

stephan 2022-04-08 08:46 markdown-tagrefs merge
Commit e8a1382fc30ad19bea60f099f875ae74a1eee2d2193629f7ddd2402e31828578
+243 -229
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -124,10 +124,19 @@
124124
#include <assert.h>
125125
#define count(X) (sizeof(X)/sizeof(X[0]))
126126
#ifndef M_PI
127127
# define M_PI 3.1415926535897932385
128128
#endif
129
+
130
+/* Limit the number of tokens in a single script to avoid run-away
131
+** macro expansion attacks. See forum post
132
+** https://pikchr.org/home/forumpost/ef8684c6955a411a
133
+*/
134
+#ifndef PIKCHR_TOKEN_LIMIT
135
+# define PIKCHR_TOKEN_LIMIT 100000
136
+#endif
137
+
129138
130139
/* Tag intentionally unused parameters with this macro to prevent
131140
** compiler warnings with -Wextra */
132141
#define UNUSED_PARAMETER(X) (void)(X)
133142
@@ -341,10 +350,11 @@
341350
/* Each call to the pikchr() subroutine uses an instance of the following
342351
** object to pass around context to all of its subroutines.
343352
*/
344353
struct Pik {
345354
unsigned nErr; /* Number of errors seen */
355
+ unsigned nToken; /* Number of tokens parsed */
346356
PToken sIn; /* Input Pikchr-language text */
347357
char *zOut; /* Result accumulates here */
348358
unsigned int nOut; /* Bytes written to zOut[] so far */
349359
unsigned int nOutAlloc; /* Space allocated to zOut[] */
350360
unsigned char eDir; /* Current direction */
@@ -479,11 +489,11 @@
479489
static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*);
480490
static PNum pik_dist(PPoint*,PPoint*);
481491
static void pik_add_macro(Pik*,PToken *pId,PToken *pCode);
482492
483493
484
-#line 510 "pikchr.c"
494
+#line 520 "pikchr.c"
485495
/**************** End of %include directives **********************************/
486496
/* These constants specify the various numeric values for terminal symbols.
487497
***************** Begin token definitions *************************************/
488498
#ifndef T_ID
489499
#define T_ID 1
@@ -1708,22 +1718,22 @@
17081718
** inside the C code.
17091719
*/
17101720
/********* Begin destructor definitions ***************************************/
17111721
case 99: /* statement_list */
17121722
{
1713
-#line 499 "pikchr.y"
1723
+#line 509 "pikchr.y"
17141724
pik_elist_free(p,(yypminor->yy227));
1715
-#line 1740 "pikchr.c"
1725
+#line 1750 "pikchr.c"
17161726
}
17171727
break;
17181728
case 100: /* statement */
17191729
case 101: /* unnamed_statement */
17201730
case 102: /* basetype */
17211731
{
1722
-#line 501 "pikchr.y"
1732
+#line 511 "pikchr.y"
17231733
pik_elem_free(p,(yypminor->yy36));
1724
-#line 1749 "pikchr.c"
1734
+#line 1759 "pikchr.c"
17251735
}
17261736
break;
17271737
/********* End destructor definitions *****************************************/
17281738
default: break; /* If no destructor action specified: do nothing */
17291739
}
@@ -1937,14 +1947,14 @@
19371947
#endif
19381948
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
19391949
/* Here code is inserted which will execute if the parser
19401950
** stack every overflows */
19411951
/******** Begin %stack_overflow code ******************************************/
1942
-#line 533 "pikchr.y"
1952
+#line 543 "pikchr.y"
19431953
19441954
pik_error(p, 0, "parser stack overflow");
1945
-#line 1970 "pikchr.c"
1955
+#line 1980 "pikchr.c"
19461956
/******** End %stack_overflow code ********************************************/
19471957
pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
19481958
pik_parserCTX_STORE
19491959
}
19501960
@@ -2420,619 +2430,619 @@
24202430
** break;
24212431
*/
24222432
/********** Begin reduce actions **********************************************/
24232433
YYMINORTYPE yylhsminor;
24242434
case 0: /* document ::= statement_list */
2425
-#line 537 "pikchr.y"
2435
+#line 547 "pikchr.y"
24262436
{pik_render(p,yymsp[0].minor.yy227);}
2427
-#line 2452 "pikchr.c"
2437
+#line 2462 "pikchr.c"
24282438
break;
24292439
case 1: /* statement_list ::= statement */
2430
-#line 540 "pikchr.y"
2440
+#line 550 "pikchr.y"
24312441
{ yylhsminor.yy227 = pik_elist_append(p,0,yymsp[0].minor.yy36); }
2432
-#line 2457 "pikchr.c"
2442
+#line 2467 "pikchr.c"
24332443
yymsp[0].minor.yy227 = yylhsminor.yy227;
24342444
break;
24352445
case 2: /* statement_list ::= statement_list EOL statement */
2436
-#line 542 "pikchr.y"
2446
+#line 552 "pikchr.y"
24372447
{ yylhsminor.yy227 = pik_elist_append(p,yymsp[-2].minor.yy227,yymsp[0].minor.yy36); }
2438
-#line 2463 "pikchr.c"
2448
+#line 2473 "pikchr.c"
24392449
yymsp[-2].minor.yy227 = yylhsminor.yy227;
24402450
break;
24412451
case 3: /* statement ::= */
2442
-#line 545 "pikchr.y"
2452
+#line 555 "pikchr.y"
24432453
{ yymsp[1].minor.yy36 = 0; }
2444
-#line 2469 "pikchr.c"
2454
+#line 2479 "pikchr.c"
24452455
break;
24462456
case 4: /* statement ::= direction */
2447
-#line 546 "pikchr.y"
2457
+#line 556 "pikchr.y"
24482458
{ pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy36=0; }
2449
-#line 2474 "pikchr.c"
2459
+#line 2484 "pikchr.c"
24502460
yymsp[0].minor.yy36 = yylhsminor.yy36;
24512461
break;
24522462
case 5: /* statement ::= lvalue ASSIGN rvalue */
2453
-#line 547 "pikchr.y"
2463
+#line 557 "pikchr.y"
24542464
{pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy153,&yymsp[-1].minor.yy0); yylhsminor.yy36=0;}
2455
-#line 2480 "pikchr.c"
2465
+#line 2490 "pikchr.c"
24562466
yymsp[-2].minor.yy36 = yylhsminor.yy36;
24572467
break;
24582468
case 6: /* statement ::= PLACENAME COLON unnamed_statement */
2459
-#line 549 "pikchr.y"
2469
+#line 559 "pikchr.y"
24602470
{ yylhsminor.yy36 = yymsp[0].minor.yy36; pik_elem_setname(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0); }
2461
-#line 2486 "pikchr.c"
2471
+#line 2496 "pikchr.c"
24622472
yymsp[-2].minor.yy36 = yylhsminor.yy36;
24632473
break;
24642474
case 7: /* statement ::= PLACENAME COLON position */
2465
-#line 551 "pikchr.y"
2475
+#line 561 "pikchr.y"
24662476
{ yylhsminor.yy36 = pik_elem_new(p,0,0,0);
24672477
if(yylhsminor.yy36){ yylhsminor.yy36->ptAt = yymsp[0].minor.yy79; pik_elem_setname(p,yylhsminor.yy36,&yymsp[-2].minor.yy0); }}
2468
-#line 2493 "pikchr.c"
2478
+#line 2503 "pikchr.c"
24692479
yymsp[-2].minor.yy36 = yylhsminor.yy36;
24702480
break;
24712481
case 8: /* statement ::= unnamed_statement */
2472
-#line 553 "pikchr.y"
2482
+#line 563 "pikchr.y"
24732483
{yylhsminor.yy36 = yymsp[0].minor.yy36;}
2474
-#line 2499 "pikchr.c"
2484
+#line 2509 "pikchr.c"
24752485
yymsp[0].minor.yy36 = yylhsminor.yy36;
24762486
break;
24772487
case 9: /* statement ::= print prlist */
2478
-#line 554 "pikchr.y"
2488
+#line 564 "pikchr.y"
24792489
{pik_append(p,"<br>\n",5); yymsp[-1].minor.yy36=0;}
2480
-#line 2505 "pikchr.c"
2490
+#line 2515 "pikchr.c"
24812491
break;
24822492
case 10: /* statement ::= ASSERT LP expr EQ expr RP */
2483
-#line 559 "pikchr.y"
2493
+#line 569 "pikchr.y"
24842494
{yymsp[-5].minor.yy36=pik_assert(p,yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy153);}
2485
-#line 2510 "pikchr.c"
2495
+#line 2520 "pikchr.c"
24862496
break;
24872497
case 11: /* statement ::= ASSERT LP position EQ position RP */
2488
-#line 561 "pikchr.y"
2498
+#line 571 "pikchr.y"
24892499
{yymsp[-5].minor.yy36=pik_position_assert(p,&yymsp[-3].minor.yy79,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy79);}
2490
-#line 2515 "pikchr.c"
2500
+#line 2525 "pikchr.c"
24912501
break;
24922502
case 12: /* statement ::= DEFINE ID CODEBLOCK */
2493
-#line 562 "pikchr.y"
2503
+#line 572 "pikchr.y"
24942504
{yymsp[-2].minor.yy36=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
2495
-#line 2520 "pikchr.c"
2505
+#line 2530 "pikchr.c"
24962506
break;
24972507
case 13: /* rvalue ::= PLACENAME */
2498
-#line 573 "pikchr.y"
2508
+#line 583 "pikchr.y"
24992509
{yylhsminor.yy153 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2500
-#line 2525 "pikchr.c"
2510
+#line 2535 "pikchr.c"
25012511
yymsp[0].minor.yy153 = yylhsminor.yy153;
25022512
break;
25032513
case 14: /* pritem ::= FILL */
25042514
case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
25052515
case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
2506
-#line 578 "pikchr.y"
2516
+#line 588 "pikchr.y"
25072517
{pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2508
-#line 2533 "pikchr.c"
2518
+#line 2543 "pikchr.c"
25092519
break;
25102520
case 17: /* pritem ::= rvalue */
2511
-#line 581 "pikchr.y"
2521
+#line 591 "pikchr.y"
25122522
{pik_append_num(p,"",yymsp[0].minor.yy153);}
2513
-#line 2538 "pikchr.c"
2523
+#line 2548 "pikchr.c"
25142524
break;
25152525
case 18: /* pritem ::= STRING */
2516
-#line 582 "pikchr.y"
2526
+#line 592 "pikchr.y"
25172527
{pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2518
-#line 2543 "pikchr.c"
2528
+#line 2553 "pikchr.c"
25192529
break;
25202530
case 19: /* prsep ::= COMMA */
2521
-#line 583 "pikchr.y"
2531
+#line 593 "pikchr.y"
25222532
{pik_append(p, " ", 1);}
2523
-#line 2548 "pikchr.c"
2533
+#line 2558 "pikchr.c"
25242534
break;
25252535
case 20: /* unnamed_statement ::= basetype attribute_list */
2526
-#line 586 "pikchr.y"
2536
+#line 596 "pikchr.y"
25272537
{yylhsminor.yy36 = yymsp[-1].minor.yy36; pik_after_adding_attributes(p,yylhsminor.yy36);}
2528
-#line 2553 "pikchr.c"
2538
+#line 2563 "pikchr.c"
25292539
yymsp[-1].minor.yy36 = yylhsminor.yy36;
25302540
break;
25312541
case 21: /* basetype ::= CLASSNAME */
2532
-#line 588 "pikchr.y"
2542
+#line 598 "pikchr.y"
25332543
{yylhsminor.yy36 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2534
-#line 2559 "pikchr.c"
2544
+#line 2569 "pikchr.c"
25352545
yymsp[0].minor.yy36 = yylhsminor.yy36;
25362546
break;
25372547
case 22: /* basetype ::= STRING textposition */
2538
-#line 590 "pikchr.y"
2548
+#line 600 "pikchr.y"
25392549
{yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy164; yylhsminor.yy36 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2540
-#line 2565 "pikchr.c"
2550
+#line 2575 "pikchr.c"
25412551
yymsp[-1].minor.yy36 = yylhsminor.yy36;
25422552
break;
25432553
case 23: /* basetype ::= LB savelist statement_list RB */
2544
-#line 592 "pikchr.y"
2554
+#line 602 "pikchr.y"
25452555
{ p->list = yymsp[-2].minor.yy227; yymsp[-3].minor.yy36 = pik_elem_new(p,0,0,yymsp[-1].minor.yy227); if(yymsp[-3].minor.yy36) yymsp[-3].minor.yy36->errTok = yymsp[0].minor.yy0; }
2546
-#line 2571 "pikchr.c"
2556
+#line 2581 "pikchr.c"
25472557
break;
25482558
case 24: /* savelist ::= */
2549
-#line 597 "pikchr.y"
2559
+#line 607 "pikchr.y"
25502560
{yymsp[1].minor.yy227 = p->list; p->list = 0;}
2551
-#line 2576 "pikchr.c"
2561
+#line 2586 "pikchr.c"
25522562
break;
25532563
case 25: /* relexpr ::= expr */
2554
-#line 604 "pikchr.y"
2564
+#line 614 "pikchr.y"
25552565
{yylhsminor.yy10.rAbs = yymsp[0].minor.yy153; yylhsminor.yy10.rRel = 0;}
2556
-#line 2581 "pikchr.c"
2566
+#line 2591 "pikchr.c"
25572567
yymsp[0].minor.yy10 = yylhsminor.yy10;
25582568
break;
25592569
case 26: /* relexpr ::= expr PERCENT */
2560
-#line 605 "pikchr.y"
2570
+#line 615 "pikchr.y"
25612571
{yylhsminor.yy10.rAbs = 0; yylhsminor.yy10.rRel = yymsp[-1].minor.yy153/100;}
2562
-#line 2587 "pikchr.c"
2572
+#line 2597 "pikchr.c"
25632573
yymsp[-1].minor.yy10 = yylhsminor.yy10;
25642574
break;
25652575
case 27: /* optrelexpr ::= */
2566
-#line 607 "pikchr.y"
2576
+#line 617 "pikchr.y"
25672577
{yymsp[1].minor.yy10.rAbs = 0; yymsp[1].minor.yy10.rRel = 1.0;}
2568
-#line 2593 "pikchr.c"
2578
+#line 2603 "pikchr.c"
25692579
break;
25702580
case 28: /* attribute_list ::= relexpr alist */
2571
-#line 609 "pikchr.y"
2581
+#line 619 "pikchr.y"
25722582
{pik_add_direction(p,0,&yymsp[-1].minor.yy10);}
2573
-#line 2598 "pikchr.c"
2583
+#line 2608 "pikchr.c"
25742584
break;
25752585
case 29: /* attribute ::= numproperty relexpr */
2576
-#line 613 "pikchr.y"
2586
+#line 623 "pikchr.y"
25772587
{ pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10); }
2578
-#line 2603 "pikchr.c"
2588
+#line 2613 "pikchr.c"
25792589
break;
25802590
case 30: /* attribute ::= dashproperty expr */
2581
-#line 614 "pikchr.y"
2591
+#line 624 "pikchr.y"
25822592
{ pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy153); }
2583
-#line 2608 "pikchr.c"
2593
+#line 2618 "pikchr.c"
25842594
break;
25852595
case 31: /* attribute ::= dashproperty */
2586
-#line 615 "pikchr.y"
2596
+#line 625 "pikchr.y"
25872597
{ pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2588
-#line 2613 "pikchr.c"
2598
+#line 2623 "pikchr.c"
25892599
break;
25902600
case 32: /* attribute ::= colorproperty rvalue */
2591
-#line 616 "pikchr.y"
2601
+#line 626 "pikchr.y"
25922602
{ pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153); }
2593
-#line 2618 "pikchr.c"
2603
+#line 2628 "pikchr.c"
25942604
break;
25952605
case 33: /* attribute ::= go direction optrelexpr */
2596
-#line 617 "pikchr.y"
2606
+#line 627 "pikchr.y"
25972607
{ pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10);}
2598
-#line 2623 "pikchr.c"
2608
+#line 2633 "pikchr.c"
25992609
break;
26002610
case 34: /* attribute ::= go direction even position */
2601
-#line 618 "pikchr.y"
2611
+#line 628 "pikchr.y"
26022612
{pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79);}
2603
-#line 2628 "pikchr.c"
2613
+#line 2638 "pikchr.c"
26042614
break;
26052615
case 35: /* attribute ::= CLOSE */
2606
-#line 619 "pikchr.y"
2616
+#line 629 "pikchr.y"
26072617
{ pik_close_path(p,&yymsp[0].minor.yy0); }
2608
-#line 2633 "pikchr.c"
2618
+#line 2643 "pikchr.c"
26092619
break;
26102620
case 36: /* attribute ::= CHOP */
2611
-#line 620 "pikchr.y"
2621
+#line 630 "pikchr.y"
26122622
{ p->cur->bChop = 1; }
2613
-#line 2638 "pikchr.c"
2623
+#line 2648 "pikchr.c"
26142624
break;
26152625
case 37: /* attribute ::= FROM position */
2616
-#line 621 "pikchr.y"
2626
+#line 631 "pikchr.y"
26172627
{ pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2618
-#line 2643 "pikchr.c"
2628
+#line 2653 "pikchr.c"
26192629
break;
26202630
case 38: /* attribute ::= TO position */
2621
-#line 622 "pikchr.y"
2631
+#line 632 "pikchr.y"
26222632
{ pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2623
-#line 2648 "pikchr.c"
2633
+#line 2658 "pikchr.c"
26242634
break;
26252635
case 39: /* attribute ::= THEN */
2626
-#line 623 "pikchr.y"
2636
+#line 633 "pikchr.y"
26272637
{ pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2628
-#line 2653 "pikchr.c"
2638
+#line 2663 "pikchr.c"
26292639
break;
26302640
case 40: /* attribute ::= THEN optrelexpr HEADING expr */
26312641
case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
2632
-#line 625 "pikchr.y"
2642
+#line 635 "pikchr.y"
26332643
{pik_move_hdg(p,&yymsp[-2].minor.yy10,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153,0,&yymsp[-3].minor.yy0);}
2634
-#line 2659 "pikchr.c"
2644
+#line 2669 "pikchr.c"
26352645
break;
26362646
case 41: /* attribute ::= THEN optrelexpr EDGEPT */
26372647
case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
2638
-#line 626 "pikchr.y"
2648
+#line 636 "pikchr.y"
26392649
{pik_move_hdg(p,&yymsp[-1].minor.yy10,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2640
-#line 2665 "pikchr.c"
2650
+#line 2675 "pikchr.c"
26412651
break;
26422652
case 44: /* attribute ::= AT position */
2643
-#line 631 "pikchr.y"
2653
+#line 641 "pikchr.y"
26442654
{ pik_set_at(p,0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2645
-#line 2670 "pikchr.c"
2655
+#line 2680 "pikchr.c"
26462656
break;
26472657
case 45: /* attribute ::= SAME */
2648
-#line 633 "pikchr.y"
2658
+#line 643 "pikchr.y"
26492659
{pik_same(p,0,&yymsp[0].minor.yy0);}
2650
-#line 2675 "pikchr.c"
2660
+#line 2685 "pikchr.c"
26512661
break;
26522662
case 46: /* attribute ::= SAME AS object */
2653
-#line 634 "pikchr.y"
2663
+#line 644 "pikchr.y"
26542664
{pik_same(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2655
-#line 2680 "pikchr.c"
2665
+#line 2690 "pikchr.c"
26562666
break;
26572667
case 47: /* attribute ::= STRING textposition */
2658
-#line 635 "pikchr.y"
2668
+#line 645 "pikchr.y"
26592669
{pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy164);}
2660
-#line 2685 "pikchr.c"
2670
+#line 2695 "pikchr.c"
26612671
break;
26622672
case 48: /* attribute ::= FIT */
2663
-#line 636 "pikchr.y"
2673
+#line 646 "pikchr.y"
26642674
{pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
2665
-#line 2690 "pikchr.c"
2675
+#line 2700 "pikchr.c"
26662676
break;
26672677
case 49: /* attribute ::= BEHIND object */
2668
-#line 637 "pikchr.y"
2678
+#line 647 "pikchr.y"
26692679
{pik_behind(p,yymsp[0].minor.yy36);}
2670
-#line 2695 "pikchr.c"
2680
+#line 2705 "pikchr.c"
26712681
break;
26722682
case 50: /* withclause ::= DOT_E edge AT position */
26732683
case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
2674
-#line 645 "pikchr.y"
2684
+#line 655 "pikchr.y"
26752685
{ pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2676
-#line 2701 "pikchr.c"
2686
+#line 2711 "pikchr.c"
26772687
break;
26782688
case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2679
-#line 649 "pikchr.y"
2689
+#line 659 "pikchr.y"
26802690
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
2681
-#line 2706 "pikchr.c"
2691
+#line 2716 "pikchr.c"
26822692
yymsp[0].minor.yy0 = yylhsminor.yy0;
26832693
break;
26842694
case 53: /* boolproperty ::= CW */
2685
-#line 660 "pikchr.y"
2695
+#line 670 "pikchr.y"
26862696
{p->cur->cw = 1;}
2687
-#line 2712 "pikchr.c"
2697
+#line 2722 "pikchr.c"
26882698
break;
26892699
case 54: /* boolproperty ::= CCW */
2690
-#line 661 "pikchr.y"
2700
+#line 671 "pikchr.y"
26912701
{p->cur->cw = 0;}
2692
-#line 2717 "pikchr.c"
2702
+#line 2727 "pikchr.c"
26932703
break;
26942704
case 55: /* boolproperty ::= LARROW */
2695
-#line 662 "pikchr.y"
2705
+#line 672 "pikchr.y"
26962706
{p->cur->larrow=1; p->cur->rarrow=0; }
2697
-#line 2722 "pikchr.c"
2707
+#line 2732 "pikchr.c"
26982708
break;
26992709
case 56: /* boolproperty ::= RARROW */
2700
-#line 663 "pikchr.y"
2710
+#line 673 "pikchr.y"
27012711
{p->cur->larrow=0; p->cur->rarrow=1; }
2702
-#line 2727 "pikchr.c"
2712
+#line 2737 "pikchr.c"
27032713
break;
27042714
case 57: /* boolproperty ::= LRARROW */
2705
-#line 664 "pikchr.y"
2715
+#line 674 "pikchr.y"
27062716
{p->cur->larrow=1; p->cur->rarrow=1; }
2707
-#line 2732 "pikchr.c"
2717
+#line 2742 "pikchr.c"
27082718
break;
27092719
case 58: /* boolproperty ::= INVIS */
2710
-#line 665 "pikchr.y"
2720
+#line 675 "pikchr.y"
27112721
{p->cur->sw = 0.0;}
2712
-#line 2737 "pikchr.c"
2722
+#line 2747 "pikchr.c"
27132723
break;
27142724
case 59: /* boolproperty ::= THICK */
2715
-#line 666 "pikchr.y"
2725
+#line 676 "pikchr.y"
27162726
{p->cur->sw *= 1.5;}
2717
-#line 2742 "pikchr.c"
2727
+#line 2752 "pikchr.c"
27182728
break;
27192729
case 60: /* boolproperty ::= THIN */
2720
-#line 667 "pikchr.y"
2730
+#line 677 "pikchr.y"
27212731
{p->cur->sw *= 0.67;}
2722
-#line 2747 "pikchr.c"
2732
+#line 2757 "pikchr.c"
27232733
break;
27242734
case 61: /* boolproperty ::= SOLID */
2725
-#line 668 "pikchr.y"
2735
+#line 678 "pikchr.y"
27262736
{p->cur->sw = pik_value(p,"thickness",9,0);
27272737
p->cur->dotted = p->cur->dashed = 0.0;}
2728
-#line 2753 "pikchr.c"
2738
+#line 2763 "pikchr.c"
27292739
break;
27302740
case 62: /* textposition ::= */
2731
-#line 671 "pikchr.y"
2741
+#line 681 "pikchr.y"
27322742
{yymsp[1].minor.yy164 = 0;}
2733
-#line 2758 "pikchr.c"
2743
+#line 2768 "pikchr.c"
27342744
break;
27352745
case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2736
-#line 674 "pikchr.y"
2746
+#line 684 "pikchr.y"
27372747
{yylhsminor.yy164 = (short int)pik_text_position(yymsp[-1].minor.yy164,&yymsp[0].minor.yy0);}
2738
-#line 2763 "pikchr.c"
2748
+#line 2773 "pikchr.c"
27392749
yymsp[-1].minor.yy164 = yylhsminor.yy164;
27402750
break;
27412751
case 64: /* position ::= expr COMMA expr */
2742
-#line 677 "pikchr.y"
2752
+#line 687 "pikchr.y"
27432753
{yylhsminor.yy79.x=yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[0].minor.yy153;}
2744
-#line 2769 "pikchr.c"
2754
+#line 2779 "pikchr.c"
27452755
yymsp[-2].minor.yy79 = yylhsminor.yy79;
27462756
break;
27472757
case 65: /* position ::= place PLUS expr COMMA expr */
2748
-#line 679 "pikchr.y"
2758
+#line 689 "pikchr.y"
27492759
{yylhsminor.yy79.x=yymsp[-4].minor.yy79.x+yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y+yymsp[0].minor.yy153;}
2750
-#line 2775 "pikchr.c"
2760
+#line 2785 "pikchr.c"
27512761
yymsp[-4].minor.yy79 = yylhsminor.yy79;
27522762
break;
27532763
case 66: /* position ::= place MINUS expr COMMA expr */
2754
-#line 680 "pikchr.y"
2764
+#line 690 "pikchr.y"
27552765
{yylhsminor.yy79.x=yymsp[-4].minor.yy79.x-yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y-yymsp[0].minor.yy153;}
2756
-#line 2781 "pikchr.c"
2766
+#line 2791 "pikchr.c"
27572767
yymsp[-4].minor.yy79 = yylhsminor.yy79;
27582768
break;
27592769
case 67: /* position ::= place PLUS LP expr COMMA expr RP */
2760
-#line 682 "pikchr.y"
2770
+#line 692 "pikchr.y"
27612771
{yylhsminor.yy79.x=yymsp[-6].minor.yy79.x+yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y+yymsp[-1].minor.yy153;}
2762
-#line 2787 "pikchr.c"
2772
+#line 2797 "pikchr.c"
27632773
yymsp[-6].minor.yy79 = yylhsminor.yy79;
27642774
break;
27652775
case 68: /* position ::= place MINUS LP expr COMMA expr RP */
2766
-#line 684 "pikchr.y"
2776
+#line 694 "pikchr.y"
27672777
{yylhsminor.yy79.x=yymsp[-6].minor.yy79.x-yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y-yymsp[-1].minor.yy153;}
2768
-#line 2793 "pikchr.c"
2778
+#line 2803 "pikchr.c"
27692779
yymsp[-6].minor.yy79 = yylhsminor.yy79;
27702780
break;
27712781
case 69: /* position ::= LP position COMMA position RP */
2772
-#line 685 "pikchr.y"
2782
+#line 695 "pikchr.y"
27732783
{yymsp[-4].minor.yy79.x=yymsp[-3].minor.yy79.x; yymsp[-4].minor.yy79.y=yymsp[-1].minor.yy79.y;}
2774
-#line 2799 "pikchr.c"
2784
+#line 2809 "pikchr.c"
27752785
break;
27762786
case 70: /* position ::= LP position RP */
2777
-#line 686 "pikchr.y"
2787
+#line 696 "pikchr.y"
27782788
{yymsp[-2].minor.yy79=yymsp[-1].minor.yy79;}
2779
-#line 2804 "pikchr.c"
2789
+#line 2814 "pikchr.c"
27802790
break;
27812791
case 71: /* position ::= expr between position AND position */
2782
-#line 688 "pikchr.y"
2792
+#line 698 "pikchr.y"
27832793
{yylhsminor.yy79 = pik_position_between(yymsp[-4].minor.yy153,yymsp[-2].minor.yy79,yymsp[0].minor.yy79);}
2784
-#line 2809 "pikchr.c"
2794
+#line 2819 "pikchr.c"
27852795
yymsp[-4].minor.yy79 = yylhsminor.yy79;
27862796
break;
27872797
case 72: /* position ::= expr LT position COMMA position GT */
2788
-#line 690 "pikchr.y"
2798
+#line 700 "pikchr.y"
27892799
{yylhsminor.yy79 = pik_position_between(yymsp[-5].minor.yy153,yymsp[-3].minor.yy79,yymsp[-1].minor.yy79);}
2790
-#line 2815 "pikchr.c"
2800
+#line 2825 "pikchr.c"
27912801
yymsp[-5].minor.yy79 = yylhsminor.yy79;
27922802
break;
27932803
case 73: /* position ::= expr ABOVE position */
2794
-#line 691 "pikchr.y"
2804
+#line 701 "pikchr.y"
27952805
{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y += yymsp[-2].minor.yy153;}
2796
-#line 2821 "pikchr.c"
2806
+#line 2831 "pikchr.c"
27972807
yymsp[-2].minor.yy79 = yylhsminor.yy79;
27982808
break;
27992809
case 74: /* position ::= expr BELOW position */
2800
-#line 692 "pikchr.y"
2810
+#line 702 "pikchr.y"
28012811
{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y -= yymsp[-2].minor.yy153;}
2802
-#line 2827 "pikchr.c"
2812
+#line 2837 "pikchr.c"
28032813
yymsp[-2].minor.yy79 = yylhsminor.yy79;
28042814
break;
28052815
case 75: /* position ::= expr LEFT OF position */
2806
-#line 693 "pikchr.y"
2816
+#line 703 "pikchr.y"
28072817
{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x -= yymsp[-3].minor.yy153;}
2808
-#line 2833 "pikchr.c"
2818
+#line 2843 "pikchr.c"
28092819
yymsp[-3].minor.yy79 = yylhsminor.yy79;
28102820
break;
28112821
case 76: /* position ::= expr RIGHT OF position */
2812
-#line 694 "pikchr.y"
2822
+#line 704 "pikchr.y"
28132823
{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x += yymsp[-3].minor.yy153;}
2814
-#line 2839 "pikchr.c"
2824
+#line 2849 "pikchr.c"
28152825
yymsp[-3].minor.yy79 = yylhsminor.yy79;
28162826
break;
28172827
case 77: /* position ::= expr ON HEADING EDGEPT OF position */
2818
-#line 696 "pikchr.y"
2828
+#line 706 "pikchr.y"
28192829
{yylhsminor.yy79 = pik_position_at_hdg(yymsp[-5].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2820
-#line 2845 "pikchr.c"
2830
+#line 2855 "pikchr.c"
28212831
yymsp[-5].minor.yy79 = yylhsminor.yy79;
28222832
break;
28232833
case 78: /* position ::= expr HEADING EDGEPT OF position */
2824
-#line 698 "pikchr.y"
2834
+#line 708 "pikchr.y"
28252835
{yylhsminor.yy79 = pik_position_at_hdg(yymsp[-4].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2826
-#line 2851 "pikchr.c"
2836
+#line 2861 "pikchr.c"
28272837
yymsp[-4].minor.yy79 = yylhsminor.yy79;
28282838
break;
28292839
case 79: /* position ::= expr EDGEPT OF position */
2830
-#line 700 "pikchr.y"
2840
+#line 710 "pikchr.y"
28312841
{yylhsminor.yy79 = pik_position_at_hdg(yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2832
-#line 2857 "pikchr.c"
2842
+#line 2867 "pikchr.c"
28332843
yymsp[-3].minor.yy79 = yylhsminor.yy79;
28342844
break;
28352845
case 80: /* position ::= expr ON HEADING expr FROM position */
2836
-#line 702 "pikchr.y"
2846
+#line 712 "pikchr.y"
28372847
{yylhsminor.yy79 = pik_position_at_angle(yymsp[-5].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2838
-#line 2863 "pikchr.c"
2848
+#line 2873 "pikchr.c"
28392849
yymsp[-5].minor.yy79 = yylhsminor.yy79;
28402850
break;
28412851
case 81: /* position ::= expr HEADING expr FROM position */
2842
-#line 704 "pikchr.y"
2852
+#line 714 "pikchr.y"
28432853
{yylhsminor.yy79 = pik_position_at_angle(yymsp[-4].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2844
-#line 2869 "pikchr.c"
2854
+#line 2879 "pikchr.c"
28452855
yymsp[-4].minor.yy79 = yylhsminor.yy79;
28462856
break;
28472857
case 82: /* place ::= edge OF object */
2848
-#line 716 "pikchr.y"
2858
+#line 726 "pikchr.y"
28492859
{yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2850
-#line 2875 "pikchr.c"
2860
+#line 2885 "pikchr.c"
28512861
yymsp[-2].minor.yy79 = yylhsminor.yy79;
28522862
break;
28532863
case 83: /* place2 ::= object */
2854
-#line 717 "pikchr.y"
2864
+#line 727 "pikchr.y"
28552865
{yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,0);}
2856
-#line 2881 "pikchr.c"
2866
+#line 2891 "pikchr.c"
28572867
yymsp[0].minor.yy79 = yylhsminor.yy79;
28582868
break;
28592869
case 84: /* place2 ::= object DOT_E edge */
2860
-#line 718 "pikchr.y"
2870
+#line 728 "pikchr.y"
28612871
{yylhsminor.yy79 = pik_place_of_elem(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2862
-#line 2887 "pikchr.c"
2872
+#line 2897 "pikchr.c"
28632873
yymsp[-2].minor.yy79 = yylhsminor.yy79;
28642874
break;
28652875
case 85: /* place2 ::= NTH VERTEX OF object */
2866
-#line 719 "pikchr.y"
2876
+#line 729 "pikchr.y"
28672877
{yylhsminor.yy79 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy36);}
2868
-#line 2893 "pikchr.c"
2878
+#line 2903 "pikchr.c"
28692879
yymsp[-3].minor.yy79 = yylhsminor.yy79;
28702880
break;
28712881
case 86: /* object ::= nth */
2872
-#line 731 "pikchr.y"
2882
+#line 741 "pikchr.y"
28732883
{yylhsminor.yy36 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2874
-#line 2899 "pikchr.c"
2884
+#line 2909 "pikchr.c"
28752885
yymsp[0].minor.yy36 = yylhsminor.yy36;
28762886
break;
28772887
case 87: /* object ::= nth OF|IN object */
2878
-#line 732 "pikchr.y"
2888
+#line 742 "pikchr.y"
28792889
{yylhsminor.yy36 = pik_find_nth(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2880
-#line 2905 "pikchr.c"
2890
+#line 2915 "pikchr.c"
28812891
yymsp[-2].minor.yy36 = yylhsminor.yy36;
28822892
break;
28832893
case 88: /* objectname ::= THIS */
2884
-#line 734 "pikchr.y"
2894
+#line 744 "pikchr.y"
28852895
{yymsp[0].minor.yy36 = p->cur;}
2886
-#line 2911 "pikchr.c"
2896
+#line 2921 "pikchr.c"
28872897
break;
28882898
case 89: /* objectname ::= PLACENAME */
2889
-#line 735 "pikchr.y"
2899
+#line 745 "pikchr.y"
28902900
{yylhsminor.yy36 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2891
-#line 2916 "pikchr.c"
2901
+#line 2926 "pikchr.c"
28922902
yymsp[0].minor.yy36 = yylhsminor.yy36;
28932903
break;
28942904
case 90: /* objectname ::= objectname DOT_U PLACENAME */
2895
-#line 737 "pikchr.y"
2905
+#line 747 "pikchr.y"
28962906
{yylhsminor.yy36 = pik_find_byname(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2897
-#line 2922 "pikchr.c"
2907
+#line 2932 "pikchr.c"
28982908
yymsp[-2].minor.yy36 = yylhsminor.yy36;
28992909
break;
29002910
case 91: /* nth ::= NTH CLASSNAME */
2901
-#line 739 "pikchr.y"
2911
+#line 749 "pikchr.y"
29022912
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2903
-#line 2928 "pikchr.c"
2913
+#line 2938 "pikchr.c"
29042914
yymsp[-1].minor.yy0 = yylhsminor.yy0;
29052915
break;
29062916
case 92: /* nth ::= NTH LAST CLASSNAME */
2907
-#line 740 "pikchr.y"
2917
+#line 750 "pikchr.y"
29082918
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2909
-#line 2934 "pikchr.c"
2919
+#line 2944 "pikchr.c"
29102920
yymsp[-2].minor.yy0 = yylhsminor.yy0;
29112921
break;
29122922
case 93: /* nth ::= LAST CLASSNAME */
2913
-#line 741 "pikchr.y"
2923
+#line 751 "pikchr.y"
29142924
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2915
-#line 2940 "pikchr.c"
2925
+#line 2950 "pikchr.c"
29162926
break;
29172927
case 94: /* nth ::= LAST */
2918
-#line 742 "pikchr.y"
2928
+#line 752 "pikchr.y"
29192929
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2920
-#line 2945 "pikchr.c"
2930
+#line 2955 "pikchr.c"
29212931
yymsp[0].minor.yy0 = yylhsminor.yy0;
29222932
break;
29232933
case 95: /* nth ::= NTH LB RB */
2924
-#line 743 "pikchr.y"
2934
+#line 753 "pikchr.y"
29252935
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2926
-#line 2951 "pikchr.c"
2936
+#line 2961 "pikchr.c"
29272937
yymsp[-2].minor.yy0 = yylhsminor.yy0;
29282938
break;
29292939
case 96: /* nth ::= NTH LAST LB RB */
2930
-#line 744 "pikchr.y"
2940
+#line 754 "pikchr.y"
29312941
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2932
-#line 2957 "pikchr.c"
2942
+#line 2967 "pikchr.c"
29332943
yymsp[-3].minor.yy0 = yylhsminor.yy0;
29342944
break;
29352945
case 97: /* nth ::= LAST LB RB */
2936
-#line 745 "pikchr.y"
2946
+#line 755 "pikchr.y"
29372947
{yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2938
-#line 2963 "pikchr.c"
2948
+#line 2973 "pikchr.c"
29392949
break;
29402950
case 98: /* expr ::= expr PLUS expr */
2941
-#line 747 "pikchr.y"
2951
+#line 757 "pikchr.y"
29422952
{yylhsminor.yy153=yymsp[-2].minor.yy153+yymsp[0].minor.yy153;}
2943
-#line 2968 "pikchr.c"
2953
+#line 2978 "pikchr.c"
29442954
yymsp[-2].minor.yy153 = yylhsminor.yy153;
29452955
break;
29462956
case 99: /* expr ::= expr MINUS expr */
2947
-#line 748 "pikchr.y"
2957
+#line 758 "pikchr.y"
29482958
{yylhsminor.yy153=yymsp[-2].minor.yy153-yymsp[0].minor.yy153;}
2949
-#line 2974 "pikchr.c"
2959
+#line 2984 "pikchr.c"
29502960
yymsp[-2].minor.yy153 = yylhsminor.yy153;
29512961
break;
29522962
case 100: /* expr ::= expr STAR expr */
2953
-#line 749 "pikchr.y"
2963
+#line 759 "pikchr.y"
29542964
{yylhsminor.yy153=yymsp[-2].minor.yy153*yymsp[0].minor.yy153;}
2955
-#line 2980 "pikchr.c"
2965
+#line 2990 "pikchr.c"
29562966
yymsp[-2].minor.yy153 = yylhsminor.yy153;
29572967
break;
29582968
case 101: /* expr ::= expr SLASH expr */
2959
-#line 750 "pikchr.y"
2969
+#line 760 "pikchr.y"
29602970
{
29612971
if( yymsp[0].minor.yy153==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy153 = 0.0; }
29622972
else{ yylhsminor.yy153 = yymsp[-2].minor.yy153/yymsp[0].minor.yy153; }
29632973
}
2964
-#line 2989 "pikchr.c"
2974
+#line 2999 "pikchr.c"
29652975
yymsp[-2].minor.yy153 = yylhsminor.yy153;
29662976
break;
29672977
case 102: /* expr ::= MINUS expr */
2968
-#line 754 "pikchr.y"
2978
+#line 764 "pikchr.y"
29692979
{yymsp[-1].minor.yy153=-yymsp[0].minor.yy153;}
2970
-#line 2995 "pikchr.c"
2980
+#line 3005 "pikchr.c"
29712981
break;
29722982
case 103: /* expr ::= PLUS expr */
2973
-#line 755 "pikchr.y"
2983
+#line 765 "pikchr.y"
29742984
{yymsp[-1].minor.yy153=yymsp[0].minor.yy153;}
2975
-#line 3000 "pikchr.c"
2985
+#line 3010 "pikchr.c"
29762986
break;
29772987
case 104: /* expr ::= LP expr RP */
2978
-#line 756 "pikchr.y"
2988
+#line 766 "pikchr.y"
29792989
{yymsp[-2].minor.yy153=yymsp[-1].minor.yy153;}
2980
-#line 3005 "pikchr.c"
2990
+#line 3015 "pikchr.c"
29812991
break;
29822992
case 105: /* expr ::= LP FILL|COLOR|THICKNESS RP */
2983
-#line 757 "pikchr.y"
2993
+#line 767 "pikchr.y"
29842994
{yymsp[-2].minor.yy153=pik_get_var(p,&yymsp[-1].minor.yy0);}
2985
-#line 3010 "pikchr.c"
2995
+#line 3020 "pikchr.c"
29862996
break;
29872997
case 106: /* expr ::= NUMBER */
2988
-#line 758 "pikchr.y"
2998
+#line 768 "pikchr.y"
29892999
{yylhsminor.yy153=pik_atof(&yymsp[0].minor.yy0);}
2990
-#line 3015 "pikchr.c"
3000
+#line 3025 "pikchr.c"
29913001
yymsp[0].minor.yy153 = yylhsminor.yy153;
29923002
break;
29933003
case 107: /* expr ::= ID */
2994
-#line 759 "pikchr.y"
3004
+#line 769 "pikchr.y"
29953005
{yylhsminor.yy153=pik_get_var(p,&yymsp[0].minor.yy0);}
2996
-#line 3021 "pikchr.c"
3006
+#line 3031 "pikchr.c"
29973007
yymsp[0].minor.yy153 = yylhsminor.yy153;
29983008
break;
29993009
case 108: /* expr ::= FUNC1 LP expr RP */
3000
-#line 760 "pikchr.y"
3010
+#line 770 "pikchr.y"
30013011
{yylhsminor.yy153 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy153,0.0);}
3002
-#line 3027 "pikchr.c"
3012
+#line 3037 "pikchr.c"
30033013
yymsp[-3].minor.yy153 = yylhsminor.yy153;
30043014
break;
30053015
case 109: /* expr ::= FUNC2 LP expr COMMA expr RP */
3006
-#line 761 "pikchr.y"
3016
+#line 771 "pikchr.y"
30073017
{yylhsminor.yy153 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy153,yymsp[-1].minor.yy153);}
3008
-#line 3033 "pikchr.c"
3018
+#line 3043 "pikchr.c"
30093019
yymsp[-5].minor.yy153 = yylhsminor.yy153;
30103020
break;
30113021
case 110: /* expr ::= DIST LP position COMMA position RP */
3012
-#line 762 "pikchr.y"
3022
+#line 772 "pikchr.y"
30133023
{yymsp[-5].minor.yy153 = pik_dist(&yymsp[-3].minor.yy79,&yymsp[-1].minor.yy79);}
3014
-#line 3039 "pikchr.c"
3024
+#line 3049 "pikchr.c"
30153025
break;
30163026
case 111: /* expr ::= place2 DOT_XY X */
3017
-#line 763 "pikchr.y"
3027
+#line 773 "pikchr.y"
30183028
{yylhsminor.yy153 = yymsp[-2].minor.yy79.x;}
3019
-#line 3044 "pikchr.c"
3029
+#line 3054 "pikchr.c"
30203030
yymsp[-2].minor.yy153 = yylhsminor.yy153;
30213031
break;
30223032
case 112: /* expr ::= place2 DOT_XY Y */
3023
-#line 764 "pikchr.y"
3033
+#line 774 "pikchr.y"
30243034
{yylhsminor.yy153 = yymsp[-2].minor.yy79.y;}
3025
-#line 3050 "pikchr.c"
3035
+#line 3060 "pikchr.c"
30263036
yymsp[-2].minor.yy153 = yylhsminor.yy153;
30273037
break;
30283038
case 113: /* expr ::= object DOT_L numproperty */
30293039
case 114: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==114);
30303040
case 115: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==115);
3031
-#line 765 "pikchr.y"
3041
+#line 775 "pikchr.y"
30323042
{yylhsminor.yy153=pik_property_of(yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
3033
-#line 3058 "pikchr.c"
3043
+#line 3068 "pikchr.c"
30343044
yymsp[-2].minor.yy153 = yylhsminor.yy153;
30353045
break;
30363046
default:
30373047
/* (116) lvalue ::= ID */ yytestcase(yyruleno==116);
30383048
/* (117) lvalue ::= FILL */ yytestcase(yyruleno==117);
@@ -3131,19 +3141,19 @@
31313141
){
31323142
pik_parserARG_FETCH
31333143
pik_parserCTX_FETCH
31343144
#define TOKEN yyminor
31353145
/************ Begin %syntax_error code ****************************************/
3136
-#line 525 "pikchr.y"
3146
+#line 535 "pikchr.y"
31373147
31383148
if( TOKEN.z && TOKEN.z[0] ){
31393149
pik_error(p, &TOKEN, "syntax error");
31403150
}else{
31413151
pik_error(p, 0, "syntax error");
31423152
}
31433153
UNUSED_PARAMETER(yymajor);
3144
-#line 3169 "pikchr.c"
3154
+#line 3179 "pikchr.c"
31453155
/************ End %syntax_error code ******************************************/
31463156
pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
31473157
pik_parserCTX_STORE
31483158
}
31493159
@@ -3372,11 +3382,11 @@
33723382
#else
33733383
(void)iToken;
33743384
return 0;
33753385
#endif
33763386
}
3377
-#line 770 "pikchr.y"
3387
+#line 780 "pikchr.y"
33783388
33793389
33803390
33813391
/* Chart of the 148 official CSS color names with their
33823392
** corresponding RGB values thru Color Module Level 4:
@@ -7744,10 +7754,14 @@
77447754
printf("******** Token %s (%d): \"%.*s\" **************\n",
77457755
yyTokenName[token.eType], token.eType,
77467756
(int)(isspace(token.z[0]) ? 0 : sz), token.z);
77477757
#endif
77487758
token.n = (unsigned short)(sz & 0xffff);
7759
+ if( p->nToken++ > PIKCHR_TOKEN_LIMIT ){
7760
+ pik_error(p, &token, "script is too complex");
7761
+ break;
7762
+ }
77497763
pik_parser(pParser, token.eType, token);
77507764
}
77517765
}
77527766
}
77537767
@@ -8081,6 +8095,6 @@
80818095
80828096
80838097
#endif /* PIKCHR_TCL */
80848098
80858099
8086
-#line 8111 "pikchr.c"
8100
+#line 8125 "pikchr.c"
80878101
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -124,10 +124,19 @@
124 #include <assert.h>
125 #define count(X) (sizeof(X)/sizeof(X[0]))
126 #ifndef M_PI
127 # define M_PI 3.1415926535897932385
128 #endif
 
 
 
 
 
 
 
 
 
129
130 /* Tag intentionally unused parameters with this macro to prevent
131 ** compiler warnings with -Wextra */
132 #define UNUSED_PARAMETER(X) (void)(X)
133
@@ -341,10 +350,11 @@
341 /* Each call to the pikchr() subroutine uses an instance of the following
342 ** object to pass around context to all of its subroutines.
343 */
344 struct Pik {
345 unsigned nErr; /* Number of errors seen */
 
346 PToken sIn; /* Input Pikchr-language text */
347 char *zOut; /* Result accumulates here */
348 unsigned int nOut; /* Bytes written to zOut[] so far */
349 unsigned int nOutAlloc; /* Space allocated to zOut[] */
350 unsigned char eDir; /* Current direction */
@@ -479,11 +489,11 @@
479 static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*);
480 static PNum pik_dist(PPoint*,PPoint*);
481 static void pik_add_macro(Pik*,PToken *pId,PToken *pCode);
482
483
484 #line 510 "pikchr.c"
485 /**************** End of %include directives **********************************/
486 /* These constants specify the various numeric values for terminal symbols.
487 ***************** Begin token definitions *************************************/
488 #ifndef T_ID
489 #define T_ID 1
@@ -1708,22 +1718,22 @@
1708 ** inside the C code.
1709 */
1710 /********* Begin destructor definitions ***************************************/
1711 case 99: /* statement_list */
1712 {
1713 #line 499 "pikchr.y"
1714 pik_elist_free(p,(yypminor->yy227));
1715 #line 1740 "pikchr.c"
1716 }
1717 break;
1718 case 100: /* statement */
1719 case 101: /* unnamed_statement */
1720 case 102: /* basetype */
1721 {
1722 #line 501 "pikchr.y"
1723 pik_elem_free(p,(yypminor->yy36));
1724 #line 1749 "pikchr.c"
1725 }
1726 break;
1727 /********* End destructor definitions *****************************************/
1728 default: break; /* If no destructor action specified: do nothing */
1729 }
@@ -1937,14 +1947,14 @@
1937 #endif
1938 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1939 /* Here code is inserted which will execute if the parser
1940 ** stack every overflows */
1941 /******** Begin %stack_overflow code ******************************************/
1942 #line 533 "pikchr.y"
1943
1944 pik_error(p, 0, "parser stack overflow");
1945 #line 1970 "pikchr.c"
1946 /******** End %stack_overflow code ********************************************/
1947 pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
1948 pik_parserCTX_STORE
1949 }
1950
@@ -2420,619 +2430,619 @@
2420 ** break;
2421 */
2422 /********** Begin reduce actions **********************************************/
2423 YYMINORTYPE yylhsminor;
2424 case 0: /* document ::= statement_list */
2425 #line 537 "pikchr.y"
2426 {pik_render(p,yymsp[0].minor.yy227);}
2427 #line 2452 "pikchr.c"
2428 break;
2429 case 1: /* statement_list ::= statement */
2430 #line 540 "pikchr.y"
2431 { yylhsminor.yy227 = pik_elist_append(p,0,yymsp[0].minor.yy36); }
2432 #line 2457 "pikchr.c"
2433 yymsp[0].minor.yy227 = yylhsminor.yy227;
2434 break;
2435 case 2: /* statement_list ::= statement_list EOL statement */
2436 #line 542 "pikchr.y"
2437 { yylhsminor.yy227 = pik_elist_append(p,yymsp[-2].minor.yy227,yymsp[0].minor.yy36); }
2438 #line 2463 "pikchr.c"
2439 yymsp[-2].minor.yy227 = yylhsminor.yy227;
2440 break;
2441 case 3: /* statement ::= */
2442 #line 545 "pikchr.y"
2443 { yymsp[1].minor.yy36 = 0; }
2444 #line 2469 "pikchr.c"
2445 break;
2446 case 4: /* statement ::= direction */
2447 #line 546 "pikchr.y"
2448 { pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy36=0; }
2449 #line 2474 "pikchr.c"
2450 yymsp[0].minor.yy36 = yylhsminor.yy36;
2451 break;
2452 case 5: /* statement ::= lvalue ASSIGN rvalue */
2453 #line 547 "pikchr.y"
2454 {pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy153,&yymsp[-1].minor.yy0); yylhsminor.yy36=0;}
2455 #line 2480 "pikchr.c"
2456 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2457 break;
2458 case 6: /* statement ::= PLACENAME COLON unnamed_statement */
2459 #line 549 "pikchr.y"
2460 { yylhsminor.yy36 = yymsp[0].minor.yy36; pik_elem_setname(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0); }
2461 #line 2486 "pikchr.c"
2462 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2463 break;
2464 case 7: /* statement ::= PLACENAME COLON position */
2465 #line 551 "pikchr.y"
2466 { yylhsminor.yy36 = pik_elem_new(p,0,0,0);
2467 if(yylhsminor.yy36){ yylhsminor.yy36->ptAt = yymsp[0].minor.yy79; pik_elem_setname(p,yylhsminor.yy36,&yymsp[-2].minor.yy0); }}
2468 #line 2493 "pikchr.c"
2469 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2470 break;
2471 case 8: /* statement ::= unnamed_statement */
2472 #line 553 "pikchr.y"
2473 {yylhsminor.yy36 = yymsp[0].minor.yy36;}
2474 #line 2499 "pikchr.c"
2475 yymsp[0].minor.yy36 = yylhsminor.yy36;
2476 break;
2477 case 9: /* statement ::= print prlist */
2478 #line 554 "pikchr.y"
2479 {pik_append(p,"<br>\n",5); yymsp[-1].minor.yy36=0;}
2480 #line 2505 "pikchr.c"
2481 break;
2482 case 10: /* statement ::= ASSERT LP expr EQ expr RP */
2483 #line 559 "pikchr.y"
2484 {yymsp[-5].minor.yy36=pik_assert(p,yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy153);}
2485 #line 2510 "pikchr.c"
2486 break;
2487 case 11: /* statement ::= ASSERT LP position EQ position RP */
2488 #line 561 "pikchr.y"
2489 {yymsp[-5].minor.yy36=pik_position_assert(p,&yymsp[-3].minor.yy79,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy79);}
2490 #line 2515 "pikchr.c"
2491 break;
2492 case 12: /* statement ::= DEFINE ID CODEBLOCK */
2493 #line 562 "pikchr.y"
2494 {yymsp[-2].minor.yy36=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
2495 #line 2520 "pikchr.c"
2496 break;
2497 case 13: /* rvalue ::= PLACENAME */
2498 #line 573 "pikchr.y"
2499 {yylhsminor.yy153 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2500 #line 2525 "pikchr.c"
2501 yymsp[0].minor.yy153 = yylhsminor.yy153;
2502 break;
2503 case 14: /* pritem ::= FILL */
2504 case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
2505 case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
2506 #line 578 "pikchr.y"
2507 {pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2508 #line 2533 "pikchr.c"
2509 break;
2510 case 17: /* pritem ::= rvalue */
2511 #line 581 "pikchr.y"
2512 {pik_append_num(p,"",yymsp[0].minor.yy153);}
2513 #line 2538 "pikchr.c"
2514 break;
2515 case 18: /* pritem ::= STRING */
2516 #line 582 "pikchr.y"
2517 {pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2518 #line 2543 "pikchr.c"
2519 break;
2520 case 19: /* prsep ::= COMMA */
2521 #line 583 "pikchr.y"
2522 {pik_append(p, " ", 1);}
2523 #line 2548 "pikchr.c"
2524 break;
2525 case 20: /* unnamed_statement ::= basetype attribute_list */
2526 #line 586 "pikchr.y"
2527 {yylhsminor.yy36 = yymsp[-1].minor.yy36; pik_after_adding_attributes(p,yylhsminor.yy36);}
2528 #line 2553 "pikchr.c"
2529 yymsp[-1].minor.yy36 = yylhsminor.yy36;
2530 break;
2531 case 21: /* basetype ::= CLASSNAME */
2532 #line 588 "pikchr.y"
2533 {yylhsminor.yy36 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2534 #line 2559 "pikchr.c"
2535 yymsp[0].minor.yy36 = yylhsminor.yy36;
2536 break;
2537 case 22: /* basetype ::= STRING textposition */
2538 #line 590 "pikchr.y"
2539 {yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy164; yylhsminor.yy36 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2540 #line 2565 "pikchr.c"
2541 yymsp[-1].minor.yy36 = yylhsminor.yy36;
2542 break;
2543 case 23: /* basetype ::= LB savelist statement_list RB */
2544 #line 592 "pikchr.y"
2545 { p->list = yymsp[-2].minor.yy227; yymsp[-3].minor.yy36 = pik_elem_new(p,0,0,yymsp[-1].minor.yy227); if(yymsp[-3].minor.yy36) yymsp[-3].minor.yy36->errTok = yymsp[0].minor.yy0; }
2546 #line 2571 "pikchr.c"
2547 break;
2548 case 24: /* savelist ::= */
2549 #line 597 "pikchr.y"
2550 {yymsp[1].minor.yy227 = p->list; p->list = 0;}
2551 #line 2576 "pikchr.c"
2552 break;
2553 case 25: /* relexpr ::= expr */
2554 #line 604 "pikchr.y"
2555 {yylhsminor.yy10.rAbs = yymsp[0].minor.yy153; yylhsminor.yy10.rRel = 0;}
2556 #line 2581 "pikchr.c"
2557 yymsp[0].minor.yy10 = yylhsminor.yy10;
2558 break;
2559 case 26: /* relexpr ::= expr PERCENT */
2560 #line 605 "pikchr.y"
2561 {yylhsminor.yy10.rAbs = 0; yylhsminor.yy10.rRel = yymsp[-1].minor.yy153/100;}
2562 #line 2587 "pikchr.c"
2563 yymsp[-1].minor.yy10 = yylhsminor.yy10;
2564 break;
2565 case 27: /* optrelexpr ::= */
2566 #line 607 "pikchr.y"
2567 {yymsp[1].minor.yy10.rAbs = 0; yymsp[1].minor.yy10.rRel = 1.0;}
2568 #line 2593 "pikchr.c"
2569 break;
2570 case 28: /* attribute_list ::= relexpr alist */
2571 #line 609 "pikchr.y"
2572 {pik_add_direction(p,0,&yymsp[-1].minor.yy10);}
2573 #line 2598 "pikchr.c"
2574 break;
2575 case 29: /* attribute ::= numproperty relexpr */
2576 #line 613 "pikchr.y"
2577 { pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10); }
2578 #line 2603 "pikchr.c"
2579 break;
2580 case 30: /* attribute ::= dashproperty expr */
2581 #line 614 "pikchr.y"
2582 { pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy153); }
2583 #line 2608 "pikchr.c"
2584 break;
2585 case 31: /* attribute ::= dashproperty */
2586 #line 615 "pikchr.y"
2587 { pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2588 #line 2613 "pikchr.c"
2589 break;
2590 case 32: /* attribute ::= colorproperty rvalue */
2591 #line 616 "pikchr.y"
2592 { pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153); }
2593 #line 2618 "pikchr.c"
2594 break;
2595 case 33: /* attribute ::= go direction optrelexpr */
2596 #line 617 "pikchr.y"
2597 { pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10);}
2598 #line 2623 "pikchr.c"
2599 break;
2600 case 34: /* attribute ::= go direction even position */
2601 #line 618 "pikchr.y"
2602 {pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79);}
2603 #line 2628 "pikchr.c"
2604 break;
2605 case 35: /* attribute ::= CLOSE */
2606 #line 619 "pikchr.y"
2607 { pik_close_path(p,&yymsp[0].minor.yy0); }
2608 #line 2633 "pikchr.c"
2609 break;
2610 case 36: /* attribute ::= CHOP */
2611 #line 620 "pikchr.y"
2612 { p->cur->bChop = 1; }
2613 #line 2638 "pikchr.c"
2614 break;
2615 case 37: /* attribute ::= FROM position */
2616 #line 621 "pikchr.y"
2617 { pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2618 #line 2643 "pikchr.c"
2619 break;
2620 case 38: /* attribute ::= TO position */
2621 #line 622 "pikchr.y"
2622 { pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2623 #line 2648 "pikchr.c"
2624 break;
2625 case 39: /* attribute ::= THEN */
2626 #line 623 "pikchr.y"
2627 { pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2628 #line 2653 "pikchr.c"
2629 break;
2630 case 40: /* attribute ::= THEN optrelexpr HEADING expr */
2631 case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
2632 #line 625 "pikchr.y"
2633 {pik_move_hdg(p,&yymsp[-2].minor.yy10,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153,0,&yymsp[-3].minor.yy0);}
2634 #line 2659 "pikchr.c"
2635 break;
2636 case 41: /* attribute ::= THEN optrelexpr EDGEPT */
2637 case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
2638 #line 626 "pikchr.y"
2639 {pik_move_hdg(p,&yymsp[-1].minor.yy10,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2640 #line 2665 "pikchr.c"
2641 break;
2642 case 44: /* attribute ::= AT position */
2643 #line 631 "pikchr.y"
2644 { pik_set_at(p,0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2645 #line 2670 "pikchr.c"
2646 break;
2647 case 45: /* attribute ::= SAME */
2648 #line 633 "pikchr.y"
2649 {pik_same(p,0,&yymsp[0].minor.yy0);}
2650 #line 2675 "pikchr.c"
2651 break;
2652 case 46: /* attribute ::= SAME AS object */
2653 #line 634 "pikchr.y"
2654 {pik_same(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2655 #line 2680 "pikchr.c"
2656 break;
2657 case 47: /* attribute ::= STRING textposition */
2658 #line 635 "pikchr.y"
2659 {pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy164);}
2660 #line 2685 "pikchr.c"
2661 break;
2662 case 48: /* attribute ::= FIT */
2663 #line 636 "pikchr.y"
2664 {pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
2665 #line 2690 "pikchr.c"
2666 break;
2667 case 49: /* attribute ::= BEHIND object */
2668 #line 637 "pikchr.y"
2669 {pik_behind(p,yymsp[0].minor.yy36);}
2670 #line 2695 "pikchr.c"
2671 break;
2672 case 50: /* withclause ::= DOT_E edge AT position */
2673 case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
2674 #line 645 "pikchr.y"
2675 { pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2676 #line 2701 "pikchr.c"
2677 break;
2678 case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2679 #line 649 "pikchr.y"
2680 {yylhsminor.yy0 = yymsp[0].minor.yy0;}
2681 #line 2706 "pikchr.c"
2682 yymsp[0].minor.yy0 = yylhsminor.yy0;
2683 break;
2684 case 53: /* boolproperty ::= CW */
2685 #line 660 "pikchr.y"
2686 {p->cur->cw = 1;}
2687 #line 2712 "pikchr.c"
2688 break;
2689 case 54: /* boolproperty ::= CCW */
2690 #line 661 "pikchr.y"
2691 {p->cur->cw = 0;}
2692 #line 2717 "pikchr.c"
2693 break;
2694 case 55: /* boolproperty ::= LARROW */
2695 #line 662 "pikchr.y"
2696 {p->cur->larrow=1; p->cur->rarrow=0; }
2697 #line 2722 "pikchr.c"
2698 break;
2699 case 56: /* boolproperty ::= RARROW */
2700 #line 663 "pikchr.y"
2701 {p->cur->larrow=0; p->cur->rarrow=1; }
2702 #line 2727 "pikchr.c"
2703 break;
2704 case 57: /* boolproperty ::= LRARROW */
2705 #line 664 "pikchr.y"
2706 {p->cur->larrow=1; p->cur->rarrow=1; }
2707 #line 2732 "pikchr.c"
2708 break;
2709 case 58: /* boolproperty ::= INVIS */
2710 #line 665 "pikchr.y"
2711 {p->cur->sw = 0.0;}
2712 #line 2737 "pikchr.c"
2713 break;
2714 case 59: /* boolproperty ::= THICK */
2715 #line 666 "pikchr.y"
2716 {p->cur->sw *= 1.5;}
2717 #line 2742 "pikchr.c"
2718 break;
2719 case 60: /* boolproperty ::= THIN */
2720 #line 667 "pikchr.y"
2721 {p->cur->sw *= 0.67;}
2722 #line 2747 "pikchr.c"
2723 break;
2724 case 61: /* boolproperty ::= SOLID */
2725 #line 668 "pikchr.y"
2726 {p->cur->sw = pik_value(p,"thickness",9,0);
2727 p->cur->dotted = p->cur->dashed = 0.0;}
2728 #line 2753 "pikchr.c"
2729 break;
2730 case 62: /* textposition ::= */
2731 #line 671 "pikchr.y"
2732 {yymsp[1].minor.yy164 = 0;}
2733 #line 2758 "pikchr.c"
2734 break;
2735 case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2736 #line 674 "pikchr.y"
2737 {yylhsminor.yy164 = (short int)pik_text_position(yymsp[-1].minor.yy164,&yymsp[0].minor.yy0);}
2738 #line 2763 "pikchr.c"
2739 yymsp[-1].minor.yy164 = yylhsminor.yy164;
2740 break;
2741 case 64: /* position ::= expr COMMA expr */
2742 #line 677 "pikchr.y"
2743 {yylhsminor.yy79.x=yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[0].minor.yy153;}
2744 #line 2769 "pikchr.c"
2745 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2746 break;
2747 case 65: /* position ::= place PLUS expr COMMA expr */
2748 #line 679 "pikchr.y"
2749 {yylhsminor.yy79.x=yymsp[-4].minor.yy79.x+yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y+yymsp[0].minor.yy153;}
2750 #line 2775 "pikchr.c"
2751 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2752 break;
2753 case 66: /* position ::= place MINUS expr COMMA expr */
2754 #line 680 "pikchr.y"
2755 {yylhsminor.yy79.x=yymsp[-4].minor.yy79.x-yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y-yymsp[0].minor.yy153;}
2756 #line 2781 "pikchr.c"
2757 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2758 break;
2759 case 67: /* position ::= place PLUS LP expr COMMA expr RP */
2760 #line 682 "pikchr.y"
2761 {yylhsminor.yy79.x=yymsp[-6].minor.yy79.x+yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y+yymsp[-1].minor.yy153;}
2762 #line 2787 "pikchr.c"
2763 yymsp[-6].minor.yy79 = yylhsminor.yy79;
2764 break;
2765 case 68: /* position ::= place MINUS LP expr COMMA expr RP */
2766 #line 684 "pikchr.y"
2767 {yylhsminor.yy79.x=yymsp[-6].minor.yy79.x-yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y-yymsp[-1].minor.yy153;}
2768 #line 2793 "pikchr.c"
2769 yymsp[-6].minor.yy79 = yylhsminor.yy79;
2770 break;
2771 case 69: /* position ::= LP position COMMA position RP */
2772 #line 685 "pikchr.y"
2773 {yymsp[-4].minor.yy79.x=yymsp[-3].minor.yy79.x; yymsp[-4].minor.yy79.y=yymsp[-1].minor.yy79.y;}
2774 #line 2799 "pikchr.c"
2775 break;
2776 case 70: /* position ::= LP position RP */
2777 #line 686 "pikchr.y"
2778 {yymsp[-2].minor.yy79=yymsp[-1].minor.yy79;}
2779 #line 2804 "pikchr.c"
2780 break;
2781 case 71: /* position ::= expr between position AND position */
2782 #line 688 "pikchr.y"
2783 {yylhsminor.yy79 = pik_position_between(yymsp[-4].minor.yy153,yymsp[-2].minor.yy79,yymsp[0].minor.yy79);}
2784 #line 2809 "pikchr.c"
2785 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2786 break;
2787 case 72: /* position ::= expr LT position COMMA position GT */
2788 #line 690 "pikchr.y"
2789 {yylhsminor.yy79 = pik_position_between(yymsp[-5].minor.yy153,yymsp[-3].minor.yy79,yymsp[-1].minor.yy79);}
2790 #line 2815 "pikchr.c"
2791 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2792 break;
2793 case 73: /* position ::= expr ABOVE position */
2794 #line 691 "pikchr.y"
2795 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y += yymsp[-2].minor.yy153;}
2796 #line 2821 "pikchr.c"
2797 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2798 break;
2799 case 74: /* position ::= expr BELOW position */
2800 #line 692 "pikchr.y"
2801 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y -= yymsp[-2].minor.yy153;}
2802 #line 2827 "pikchr.c"
2803 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2804 break;
2805 case 75: /* position ::= expr LEFT OF position */
2806 #line 693 "pikchr.y"
2807 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x -= yymsp[-3].minor.yy153;}
2808 #line 2833 "pikchr.c"
2809 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2810 break;
2811 case 76: /* position ::= expr RIGHT OF position */
2812 #line 694 "pikchr.y"
2813 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x += yymsp[-3].minor.yy153;}
2814 #line 2839 "pikchr.c"
2815 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2816 break;
2817 case 77: /* position ::= expr ON HEADING EDGEPT OF position */
2818 #line 696 "pikchr.y"
2819 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-5].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2820 #line 2845 "pikchr.c"
2821 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2822 break;
2823 case 78: /* position ::= expr HEADING EDGEPT OF position */
2824 #line 698 "pikchr.y"
2825 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-4].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2826 #line 2851 "pikchr.c"
2827 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2828 break;
2829 case 79: /* position ::= expr EDGEPT OF position */
2830 #line 700 "pikchr.y"
2831 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2832 #line 2857 "pikchr.c"
2833 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2834 break;
2835 case 80: /* position ::= expr ON HEADING expr FROM position */
2836 #line 702 "pikchr.y"
2837 {yylhsminor.yy79 = pik_position_at_angle(yymsp[-5].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2838 #line 2863 "pikchr.c"
2839 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2840 break;
2841 case 81: /* position ::= expr HEADING expr FROM position */
2842 #line 704 "pikchr.y"
2843 {yylhsminor.yy79 = pik_position_at_angle(yymsp[-4].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2844 #line 2869 "pikchr.c"
2845 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2846 break;
2847 case 82: /* place ::= edge OF object */
2848 #line 716 "pikchr.y"
2849 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2850 #line 2875 "pikchr.c"
2851 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2852 break;
2853 case 83: /* place2 ::= object */
2854 #line 717 "pikchr.y"
2855 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,0);}
2856 #line 2881 "pikchr.c"
2857 yymsp[0].minor.yy79 = yylhsminor.yy79;
2858 break;
2859 case 84: /* place2 ::= object DOT_E edge */
2860 #line 718 "pikchr.y"
2861 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2862 #line 2887 "pikchr.c"
2863 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2864 break;
2865 case 85: /* place2 ::= NTH VERTEX OF object */
2866 #line 719 "pikchr.y"
2867 {yylhsminor.yy79 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy36);}
2868 #line 2893 "pikchr.c"
2869 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2870 break;
2871 case 86: /* object ::= nth */
2872 #line 731 "pikchr.y"
2873 {yylhsminor.yy36 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2874 #line 2899 "pikchr.c"
2875 yymsp[0].minor.yy36 = yylhsminor.yy36;
2876 break;
2877 case 87: /* object ::= nth OF|IN object */
2878 #line 732 "pikchr.y"
2879 {yylhsminor.yy36 = pik_find_nth(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2880 #line 2905 "pikchr.c"
2881 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2882 break;
2883 case 88: /* objectname ::= THIS */
2884 #line 734 "pikchr.y"
2885 {yymsp[0].minor.yy36 = p->cur;}
2886 #line 2911 "pikchr.c"
2887 break;
2888 case 89: /* objectname ::= PLACENAME */
2889 #line 735 "pikchr.y"
2890 {yylhsminor.yy36 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2891 #line 2916 "pikchr.c"
2892 yymsp[0].minor.yy36 = yylhsminor.yy36;
2893 break;
2894 case 90: /* objectname ::= objectname DOT_U PLACENAME */
2895 #line 737 "pikchr.y"
2896 {yylhsminor.yy36 = pik_find_byname(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2897 #line 2922 "pikchr.c"
2898 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2899 break;
2900 case 91: /* nth ::= NTH CLASSNAME */
2901 #line 739 "pikchr.y"
2902 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2903 #line 2928 "pikchr.c"
2904 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2905 break;
2906 case 92: /* nth ::= NTH LAST CLASSNAME */
2907 #line 740 "pikchr.y"
2908 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2909 #line 2934 "pikchr.c"
2910 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2911 break;
2912 case 93: /* nth ::= LAST CLASSNAME */
2913 #line 741 "pikchr.y"
2914 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2915 #line 2940 "pikchr.c"
2916 break;
2917 case 94: /* nth ::= LAST */
2918 #line 742 "pikchr.y"
2919 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2920 #line 2945 "pikchr.c"
2921 yymsp[0].minor.yy0 = yylhsminor.yy0;
2922 break;
2923 case 95: /* nth ::= NTH LB RB */
2924 #line 743 "pikchr.y"
2925 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2926 #line 2951 "pikchr.c"
2927 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2928 break;
2929 case 96: /* nth ::= NTH LAST LB RB */
2930 #line 744 "pikchr.y"
2931 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2932 #line 2957 "pikchr.c"
2933 yymsp[-3].minor.yy0 = yylhsminor.yy0;
2934 break;
2935 case 97: /* nth ::= LAST LB RB */
2936 #line 745 "pikchr.y"
2937 {yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2938 #line 2963 "pikchr.c"
2939 break;
2940 case 98: /* expr ::= expr PLUS expr */
2941 #line 747 "pikchr.y"
2942 {yylhsminor.yy153=yymsp[-2].minor.yy153+yymsp[0].minor.yy153;}
2943 #line 2968 "pikchr.c"
2944 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2945 break;
2946 case 99: /* expr ::= expr MINUS expr */
2947 #line 748 "pikchr.y"
2948 {yylhsminor.yy153=yymsp[-2].minor.yy153-yymsp[0].minor.yy153;}
2949 #line 2974 "pikchr.c"
2950 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2951 break;
2952 case 100: /* expr ::= expr STAR expr */
2953 #line 749 "pikchr.y"
2954 {yylhsminor.yy153=yymsp[-2].minor.yy153*yymsp[0].minor.yy153;}
2955 #line 2980 "pikchr.c"
2956 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2957 break;
2958 case 101: /* expr ::= expr SLASH expr */
2959 #line 750 "pikchr.y"
2960 {
2961 if( yymsp[0].minor.yy153==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy153 = 0.0; }
2962 else{ yylhsminor.yy153 = yymsp[-2].minor.yy153/yymsp[0].minor.yy153; }
2963 }
2964 #line 2989 "pikchr.c"
2965 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2966 break;
2967 case 102: /* expr ::= MINUS expr */
2968 #line 754 "pikchr.y"
2969 {yymsp[-1].minor.yy153=-yymsp[0].minor.yy153;}
2970 #line 2995 "pikchr.c"
2971 break;
2972 case 103: /* expr ::= PLUS expr */
2973 #line 755 "pikchr.y"
2974 {yymsp[-1].minor.yy153=yymsp[0].minor.yy153;}
2975 #line 3000 "pikchr.c"
2976 break;
2977 case 104: /* expr ::= LP expr RP */
2978 #line 756 "pikchr.y"
2979 {yymsp[-2].minor.yy153=yymsp[-1].minor.yy153;}
2980 #line 3005 "pikchr.c"
2981 break;
2982 case 105: /* expr ::= LP FILL|COLOR|THICKNESS RP */
2983 #line 757 "pikchr.y"
2984 {yymsp[-2].minor.yy153=pik_get_var(p,&yymsp[-1].minor.yy0);}
2985 #line 3010 "pikchr.c"
2986 break;
2987 case 106: /* expr ::= NUMBER */
2988 #line 758 "pikchr.y"
2989 {yylhsminor.yy153=pik_atof(&yymsp[0].minor.yy0);}
2990 #line 3015 "pikchr.c"
2991 yymsp[0].minor.yy153 = yylhsminor.yy153;
2992 break;
2993 case 107: /* expr ::= ID */
2994 #line 759 "pikchr.y"
2995 {yylhsminor.yy153=pik_get_var(p,&yymsp[0].minor.yy0);}
2996 #line 3021 "pikchr.c"
2997 yymsp[0].minor.yy153 = yylhsminor.yy153;
2998 break;
2999 case 108: /* expr ::= FUNC1 LP expr RP */
3000 #line 760 "pikchr.y"
3001 {yylhsminor.yy153 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy153,0.0);}
3002 #line 3027 "pikchr.c"
3003 yymsp[-3].minor.yy153 = yylhsminor.yy153;
3004 break;
3005 case 109: /* expr ::= FUNC2 LP expr COMMA expr RP */
3006 #line 761 "pikchr.y"
3007 {yylhsminor.yy153 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy153,yymsp[-1].minor.yy153);}
3008 #line 3033 "pikchr.c"
3009 yymsp[-5].minor.yy153 = yylhsminor.yy153;
3010 break;
3011 case 110: /* expr ::= DIST LP position COMMA position RP */
3012 #line 762 "pikchr.y"
3013 {yymsp[-5].minor.yy153 = pik_dist(&yymsp[-3].minor.yy79,&yymsp[-1].minor.yy79);}
3014 #line 3039 "pikchr.c"
3015 break;
3016 case 111: /* expr ::= place2 DOT_XY X */
3017 #line 763 "pikchr.y"
3018 {yylhsminor.yy153 = yymsp[-2].minor.yy79.x;}
3019 #line 3044 "pikchr.c"
3020 yymsp[-2].minor.yy153 = yylhsminor.yy153;
3021 break;
3022 case 112: /* expr ::= place2 DOT_XY Y */
3023 #line 764 "pikchr.y"
3024 {yylhsminor.yy153 = yymsp[-2].minor.yy79.y;}
3025 #line 3050 "pikchr.c"
3026 yymsp[-2].minor.yy153 = yylhsminor.yy153;
3027 break;
3028 case 113: /* expr ::= object DOT_L numproperty */
3029 case 114: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==114);
3030 case 115: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==115);
3031 #line 765 "pikchr.y"
3032 {yylhsminor.yy153=pik_property_of(yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
3033 #line 3058 "pikchr.c"
3034 yymsp[-2].minor.yy153 = yylhsminor.yy153;
3035 break;
3036 default:
3037 /* (116) lvalue ::= ID */ yytestcase(yyruleno==116);
3038 /* (117) lvalue ::= FILL */ yytestcase(yyruleno==117);
@@ -3131,19 +3141,19 @@
3131 ){
3132 pik_parserARG_FETCH
3133 pik_parserCTX_FETCH
3134 #define TOKEN yyminor
3135 /************ Begin %syntax_error code ****************************************/
3136 #line 525 "pikchr.y"
3137
3138 if( TOKEN.z && TOKEN.z[0] ){
3139 pik_error(p, &TOKEN, "syntax error");
3140 }else{
3141 pik_error(p, 0, "syntax error");
3142 }
3143 UNUSED_PARAMETER(yymajor);
3144 #line 3169 "pikchr.c"
3145 /************ End %syntax_error code ******************************************/
3146 pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
3147 pik_parserCTX_STORE
3148 }
3149
@@ -3372,11 +3382,11 @@
3372 #else
3373 (void)iToken;
3374 return 0;
3375 #endif
3376 }
3377 #line 770 "pikchr.y"
3378
3379
3380
3381 /* Chart of the 148 official CSS color names with their
3382 ** corresponding RGB values thru Color Module Level 4:
@@ -7744,10 +7754,14 @@
7744 printf("******** Token %s (%d): \"%.*s\" **************\n",
7745 yyTokenName[token.eType], token.eType,
7746 (int)(isspace(token.z[0]) ? 0 : sz), token.z);
7747 #endif
7748 token.n = (unsigned short)(sz & 0xffff);
 
 
 
 
7749 pik_parser(pParser, token.eType, token);
7750 }
7751 }
7752 }
7753
@@ -8081,6 +8095,6 @@
8081
8082
8083 #endif /* PIKCHR_TCL */
8084
8085
8086 #line 8111 "pikchr.c"
8087
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -124,10 +124,19 @@
124 #include <assert.h>
125 #define count(X) (sizeof(X)/sizeof(X[0]))
126 #ifndef M_PI
127 # define M_PI 3.1415926535897932385
128 #endif
129
130 /* Limit the number of tokens in a single script to avoid run-away
131 ** macro expansion attacks. See forum post
132 ** https://pikchr.org/home/forumpost/ef8684c6955a411a
133 */
134 #ifndef PIKCHR_TOKEN_LIMIT
135 # define PIKCHR_TOKEN_LIMIT 100000
136 #endif
137
138
139 /* Tag intentionally unused parameters with this macro to prevent
140 ** compiler warnings with -Wextra */
141 #define UNUSED_PARAMETER(X) (void)(X)
142
@@ -341,10 +350,11 @@
350 /* Each call to the pikchr() subroutine uses an instance of the following
351 ** object to pass around context to all of its subroutines.
352 */
353 struct Pik {
354 unsigned nErr; /* Number of errors seen */
355 unsigned nToken; /* Number of tokens parsed */
356 PToken sIn; /* Input Pikchr-language text */
357 char *zOut; /* Result accumulates here */
358 unsigned int nOut; /* Bytes written to zOut[] so far */
359 unsigned int nOutAlloc; /* Space allocated to zOut[] */
360 unsigned char eDir; /* Current direction */
@@ -479,11 +489,11 @@
489 static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*);
490 static PNum pik_dist(PPoint*,PPoint*);
491 static void pik_add_macro(Pik*,PToken *pId,PToken *pCode);
492
493
494 #line 520 "pikchr.c"
495 /**************** End of %include directives **********************************/
496 /* These constants specify the various numeric values for terminal symbols.
497 ***************** Begin token definitions *************************************/
498 #ifndef T_ID
499 #define T_ID 1
@@ -1708,22 +1718,22 @@
1718 ** inside the C code.
1719 */
1720 /********* Begin destructor definitions ***************************************/
1721 case 99: /* statement_list */
1722 {
1723 #line 509 "pikchr.y"
1724 pik_elist_free(p,(yypminor->yy227));
1725 #line 1750 "pikchr.c"
1726 }
1727 break;
1728 case 100: /* statement */
1729 case 101: /* unnamed_statement */
1730 case 102: /* basetype */
1731 {
1732 #line 511 "pikchr.y"
1733 pik_elem_free(p,(yypminor->yy36));
1734 #line 1759 "pikchr.c"
1735 }
1736 break;
1737 /********* End destructor definitions *****************************************/
1738 default: break; /* If no destructor action specified: do nothing */
1739 }
@@ -1937,14 +1947,14 @@
1947 #endif
1948 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1949 /* Here code is inserted which will execute if the parser
1950 ** stack every overflows */
1951 /******** Begin %stack_overflow code ******************************************/
1952 #line 543 "pikchr.y"
1953
1954 pik_error(p, 0, "parser stack overflow");
1955 #line 1980 "pikchr.c"
1956 /******** End %stack_overflow code ********************************************/
1957 pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
1958 pik_parserCTX_STORE
1959 }
1960
@@ -2420,619 +2430,619 @@
2430 ** break;
2431 */
2432 /********** Begin reduce actions **********************************************/
2433 YYMINORTYPE yylhsminor;
2434 case 0: /* document ::= statement_list */
2435 #line 547 "pikchr.y"
2436 {pik_render(p,yymsp[0].minor.yy227);}
2437 #line 2462 "pikchr.c"
2438 break;
2439 case 1: /* statement_list ::= statement */
2440 #line 550 "pikchr.y"
2441 { yylhsminor.yy227 = pik_elist_append(p,0,yymsp[0].minor.yy36); }
2442 #line 2467 "pikchr.c"
2443 yymsp[0].minor.yy227 = yylhsminor.yy227;
2444 break;
2445 case 2: /* statement_list ::= statement_list EOL statement */
2446 #line 552 "pikchr.y"
2447 { yylhsminor.yy227 = pik_elist_append(p,yymsp[-2].minor.yy227,yymsp[0].minor.yy36); }
2448 #line 2473 "pikchr.c"
2449 yymsp[-2].minor.yy227 = yylhsminor.yy227;
2450 break;
2451 case 3: /* statement ::= */
2452 #line 555 "pikchr.y"
2453 { yymsp[1].minor.yy36 = 0; }
2454 #line 2479 "pikchr.c"
2455 break;
2456 case 4: /* statement ::= direction */
2457 #line 556 "pikchr.y"
2458 { pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy36=0; }
2459 #line 2484 "pikchr.c"
2460 yymsp[0].minor.yy36 = yylhsminor.yy36;
2461 break;
2462 case 5: /* statement ::= lvalue ASSIGN rvalue */
2463 #line 557 "pikchr.y"
2464 {pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy153,&yymsp[-1].minor.yy0); yylhsminor.yy36=0;}
2465 #line 2490 "pikchr.c"
2466 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2467 break;
2468 case 6: /* statement ::= PLACENAME COLON unnamed_statement */
2469 #line 559 "pikchr.y"
2470 { yylhsminor.yy36 = yymsp[0].minor.yy36; pik_elem_setname(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0); }
2471 #line 2496 "pikchr.c"
2472 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2473 break;
2474 case 7: /* statement ::= PLACENAME COLON position */
2475 #line 561 "pikchr.y"
2476 { yylhsminor.yy36 = pik_elem_new(p,0,0,0);
2477 if(yylhsminor.yy36){ yylhsminor.yy36->ptAt = yymsp[0].minor.yy79; pik_elem_setname(p,yylhsminor.yy36,&yymsp[-2].minor.yy0); }}
2478 #line 2503 "pikchr.c"
2479 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2480 break;
2481 case 8: /* statement ::= unnamed_statement */
2482 #line 563 "pikchr.y"
2483 {yylhsminor.yy36 = yymsp[0].minor.yy36;}
2484 #line 2509 "pikchr.c"
2485 yymsp[0].minor.yy36 = yylhsminor.yy36;
2486 break;
2487 case 9: /* statement ::= print prlist */
2488 #line 564 "pikchr.y"
2489 {pik_append(p,"<br>\n",5); yymsp[-1].minor.yy36=0;}
2490 #line 2515 "pikchr.c"
2491 break;
2492 case 10: /* statement ::= ASSERT LP expr EQ expr RP */
2493 #line 569 "pikchr.y"
2494 {yymsp[-5].minor.yy36=pik_assert(p,yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy153);}
2495 #line 2520 "pikchr.c"
2496 break;
2497 case 11: /* statement ::= ASSERT LP position EQ position RP */
2498 #line 571 "pikchr.y"
2499 {yymsp[-5].minor.yy36=pik_position_assert(p,&yymsp[-3].minor.yy79,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy79);}
2500 #line 2525 "pikchr.c"
2501 break;
2502 case 12: /* statement ::= DEFINE ID CODEBLOCK */
2503 #line 572 "pikchr.y"
2504 {yymsp[-2].minor.yy36=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
2505 #line 2530 "pikchr.c"
2506 break;
2507 case 13: /* rvalue ::= PLACENAME */
2508 #line 583 "pikchr.y"
2509 {yylhsminor.yy153 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2510 #line 2535 "pikchr.c"
2511 yymsp[0].minor.yy153 = yylhsminor.yy153;
2512 break;
2513 case 14: /* pritem ::= FILL */
2514 case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
2515 case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
2516 #line 588 "pikchr.y"
2517 {pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2518 #line 2543 "pikchr.c"
2519 break;
2520 case 17: /* pritem ::= rvalue */
2521 #line 591 "pikchr.y"
2522 {pik_append_num(p,"",yymsp[0].minor.yy153);}
2523 #line 2548 "pikchr.c"
2524 break;
2525 case 18: /* pritem ::= STRING */
2526 #line 592 "pikchr.y"
2527 {pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2528 #line 2553 "pikchr.c"
2529 break;
2530 case 19: /* prsep ::= COMMA */
2531 #line 593 "pikchr.y"
2532 {pik_append(p, " ", 1);}
2533 #line 2558 "pikchr.c"
2534 break;
2535 case 20: /* unnamed_statement ::= basetype attribute_list */
2536 #line 596 "pikchr.y"
2537 {yylhsminor.yy36 = yymsp[-1].minor.yy36; pik_after_adding_attributes(p,yylhsminor.yy36);}
2538 #line 2563 "pikchr.c"
2539 yymsp[-1].minor.yy36 = yylhsminor.yy36;
2540 break;
2541 case 21: /* basetype ::= CLASSNAME */
2542 #line 598 "pikchr.y"
2543 {yylhsminor.yy36 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2544 #line 2569 "pikchr.c"
2545 yymsp[0].minor.yy36 = yylhsminor.yy36;
2546 break;
2547 case 22: /* basetype ::= STRING textposition */
2548 #line 600 "pikchr.y"
2549 {yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy164; yylhsminor.yy36 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2550 #line 2575 "pikchr.c"
2551 yymsp[-1].minor.yy36 = yylhsminor.yy36;
2552 break;
2553 case 23: /* basetype ::= LB savelist statement_list RB */
2554 #line 602 "pikchr.y"
2555 { p->list = yymsp[-2].minor.yy227; yymsp[-3].minor.yy36 = pik_elem_new(p,0,0,yymsp[-1].minor.yy227); if(yymsp[-3].minor.yy36) yymsp[-3].minor.yy36->errTok = yymsp[0].minor.yy0; }
2556 #line 2581 "pikchr.c"
2557 break;
2558 case 24: /* savelist ::= */
2559 #line 607 "pikchr.y"
2560 {yymsp[1].minor.yy227 = p->list; p->list = 0;}
2561 #line 2586 "pikchr.c"
2562 break;
2563 case 25: /* relexpr ::= expr */
2564 #line 614 "pikchr.y"
2565 {yylhsminor.yy10.rAbs = yymsp[0].minor.yy153; yylhsminor.yy10.rRel = 0;}
2566 #line 2591 "pikchr.c"
2567 yymsp[0].minor.yy10 = yylhsminor.yy10;
2568 break;
2569 case 26: /* relexpr ::= expr PERCENT */
2570 #line 615 "pikchr.y"
2571 {yylhsminor.yy10.rAbs = 0; yylhsminor.yy10.rRel = yymsp[-1].minor.yy153/100;}
2572 #line 2597 "pikchr.c"
2573 yymsp[-1].minor.yy10 = yylhsminor.yy10;
2574 break;
2575 case 27: /* optrelexpr ::= */
2576 #line 617 "pikchr.y"
2577 {yymsp[1].minor.yy10.rAbs = 0; yymsp[1].minor.yy10.rRel = 1.0;}
2578 #line 2603 "pikchr.c"
2579 break;
2580 case 28: /* attribute_list ::= relexpr alist */
2581 #line 619 "pikchr.y"
2582 {pik_add_direction(p,0,&yymsp[-1].minor.yy10);}
2583 #line 2608 "pikchr.c"
2584 break;
2585 case 29: /* attribute ::= numproperty relexpr */
2586 #line 623 "pikchr.y"
2587 { pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10); }
2588 #line 2613 "pikchr.c"
2589 break;
2590 case 30: /* attribute ::= dashproperty expr */
2591 #line 624 "pikchr.y"
2592 { pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy153); }
2593 #line 2618 "pikchr.c"
2594 break;
2595 case 31: /* attribute ::= dashproperty */
2596 #line 625 "pikchr.y"
2597 { pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2598 #line 2623 "pikchr.c"
2599 break;
2600 case 32: /* attribute ::= colorproperty rvalue */
2601 #line 626 "pikchr.y"
2602 { pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153); }
2603 #line 2628 "pikchr.c"
2604 break;
2605 case 33: /* attribute ::= go direction optrelexpr */
2606 #line 627 "pikchr.y"
2607 { pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10);}
2608 #line 2633 "pikchr.c"
2609 break;
2610 case 34: /* attribute ::= go direction even position */
2611 #line 628 "pikchr.y"
2612 {pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79);}
2613 #line 2638 "pikchr.c"
2614 break;
2615 case 35: /* attribute ::= CLOSE */
2616 #line 629 "pikchr.y"
2617 { pik_close_path(p,&yymsp[0].minor.yy0); }
2618 #line 2643 "pikchr.c"
2619 break;
2620 case 36: /* attribute ::= CHOP */
2621 #line 630 "pikchr.y"
2622 { p->cur->bChop = 1; }
2623 #line 2648 "pikchr.c"
2624 break;
2625 case 37: /* attribute ::= FROM position */
2626 #line 631 "pikchr.y"
2627 { pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2628 #line 2653 "pikchr.c"
2629 break;
2630 case 38: /* attribute ::= TO position */
2631 #line 632 "pikchr.y"
2632 { pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2633 #line 2658 "pikchr.c"
2634 break;
2635 case 39: /* attribute ::= THEN */
2636 #line 633 "pikchr.y"
2637 { pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2638 #line 2663 "pikchr.c"
2639 break;
2640 case 40: /* attribute ::= THEN optrelexpr HEADING expr */
2641 case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
2642 #line 635 "pikchr.y"
2643 {pik_move_hdg(p,&yymsp[-2].minor.yy10,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153,0,&yymsp[-3].minor.yy0);}
2644 #line 2669 "pikchr.c"
2645 break;
2646 case 41: /* attribute ::= THEN optrelexpr EDGEPT */
2647 case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
2648 #line 636 "pikchr.y"
2649 {pik_move_hdg(p,&yymsp[-1].minor.yy10,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2650 #line 2675 "pikchr.c"
2651 break;
2652 case 44: /* attribute ::= AT position */
2653 #line 641 "pikchr.y"
2654 { pik_set_at(p,0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2655 #line 2680 "pikchr.c"
2656 break;
2657 case 45: /* attribute ::= SAME */
2658 #line 643 "pikchr.y"
2659 {pik_same(p,0,&yymsp[0].minor.yy0);}
2660 #line 2685 "pikchr.c"
2661 break;
2662 case 46: /* attribute ::= SAME AS object */
2663 #line 644 "pikchr.y"
2664 {pik_same(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2665 #line 2690 "pikchr.c"
2666 break;
2667 case 47: /* attribute ::= STRING textposition */
2668 #line 645 "pikchr.y"
2669 {pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy164);}
2670 #line 2695 "pikchr.c"
2671 break;
2672 case 48: /* attribute ::= FIT */
2673 #line 646 "pikchr.y"
2674 {pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
2675 #line 2700 "pikchr.c"
2676 break;
2677 case 49: /* attribute ::= BEHIND object */
2678 #line 647 "pikchr.y"
2679 {pik_behind(p,yymsp[0].minor.yy36);}
2680 #line 2705 "pikchr.c"
2681 break;
2682 case 50: /* withclause ::= DOT_E edge AT position */
2683 case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
2684 #line 655 "pikchr.y"
2685 { pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2686 #line 2711 "pikchr.c"
2687 break;
2688 case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2689 #line 659 "pikchr.y"
2690 {yylhsminor.yy0 = yymsp[0].minor.yy0;}
2691 #line 2716 "pikchr.c"
2692 yymsp[0].minor.yy0 = yylhsminor.yy0;
2693 break;
2694 case 53: /* boolproperty ::= CW */
2695 #line 670 "pikchr.y"
2696 {p->cur->cw = 1;}
2697 #line 2722 "pikchr.c"
2698 break;
2699 case 54: /* boolproperty ::= CCW */
2700 #line 671 "pikchr.y"
2701 {p->cur->cw = 0;}
2702 #line 2727 "pikchr.c"
2703 break;
2704 case 55: /* boolproperty ::= LARROW */
2705 #line 672 "pikchr.y"
2706 {p->cur->larrow=1; p->cur->rarrow=0; }
2707 #line 2732 "pikchr.c"
2708 break;
2709 case 56: /* boolproperty ::= RARROW */
2710 #line 673 "pikchr.y"
2711 {p->cur->larrow=0; p->cur->rarrow=1; }
2712 #line 2737 "pikchr.c"
2713 break;
2714 case 57: /* boolproperty ::= LRARROW */
2715 #line 674 "pikchr.y"
2716 {p->cur->larrow=1; p->cur->rarrow=1; }
2717 #line 2742 "pikchr.c"
2718 break;
2719 case 58: /* boolproperty ::= INVIS */
2720 #line 675 "pikchr.y"
2721 {p->cur->sw = 0.0;}
2722 #line 2747 "pikchr.c"
2723 break;
2724 case 59: /* boolproperty ::= THICK */
2725 #line 676 "pikchr.y"
2726 {p->cur->sw *= 1.5;}
2727 #line 2752 "pikchr.c"
2728 break;
2729 case 60: /* boolproperty ::= THIN */
2730 #line 677 "pikchr.y"
2731 {p->cur->sw *= 0.67;}
2732 #line 2757 "pikchr.c"
2733 break;
2734 case 61: /* boolproperty ::= SOLID */
2735 #line 678 "pikchr.y"
2736 {p->cur->sw = pik_value(p,"thickness",9,0);
2737 p->cur->dotted = p->cur->dashed = 0.0;}
2738 #line 2763 "pikchr.c"
2739 break;
2740 case 62: /* textposition ::= */
2741 #line 681 "pikchr.y"
2742 {yymsp[1].minor.yy164 = 0;}
2743 #line 2768 "pikchr.c"
2744 break;
2745 case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2746 #line 684 "pikchr.y"
2747 {yylhsminor.yy164 = (short int)pik_text_position(yymsp[-1].minor.yy164,&yymsp[0].minor.yy0);}
2748 #line 2773 "pikchr.c"
2749 yymsp[-1].minor.yy164 = yylhsminor.yy164;
2750 break;
2751 case 64: /* position ::= expr COMMA expr */
2752 #line 687 "pikchr.y"
2753 {yylhsminor.yy79.x=yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[0].minor.yy153;}
2754 #line 2779 "pikchr.c"
2755 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2756 break;
2757 case 65: /* position ::= place PLUS expr COMMA expr */
2758 #line 689 "pikchr.y"
2759 {yylhsminor.yy79.x=yymsp[-4].minor.yy79.x+yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y+yymsp[0].minor.yy153;}
2760 #line 2785 "pikchr.c"
2761 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2762 break;
2763 case 66: /* position ::= place MINUS expr COMMA expr */
2764 #line 690 "pikchr.y"
2765 {yylhsminor.yy79.x=yymsp[-4].minor.yy79.x-yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y-yymsp[0].minor.yy153;}
2766 #line 2791 "pikchr.c"
2767 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2768 break;
2769 case 67: /* position ::= place PLUS LP expr COMMA expr RP */
2770 #line 692 "pikchr.y"
2771 {yylhsminor.yy79.x=yymsp[-6].minor.yy79.x+yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y+yymsp[-1].minor.yy153;}
2772 #line 2797 "pikchr.c"
2773 yymsp[-6].minor.yy79 = yylhsminor.yy79;
2774 break;
2775 case 68: /* position ::= place MINUS LP expr COMMA expr RP */
2776 #line 694 "pikchr.y"
2777 {yylhsminor.yy79.x=yymsp[-6].minor.yy79.x-yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y-yymsp[-1].minor.yy153;}
2778 #line 2803 "pikchr.c"
2779 yymsp[-6].minor.yy79 = yylhsminor.yy79;
2780 break;
2781 case 69: /* position ::= LP position COMMA position RP */
2782 #line 695 "pikchr.y"
2783 {yymsp[-4].minor.yy79.x=yymsp[-3].minor.yy79.x; yymsp[-4].minor.yy79.y=yymsp[-1].minor.yy79.y;}
2784 #line 2809 "pikchr.c"
2785 break;
2786 case 70: /* position ::= LP position RP */
2787 #line 696 "pikchr.y"
2788 {yymsp[-2].minor.yy79=yymsp[-1].minor.yy79;}
2789 #line 2814 "pikchr.c"
2790 break;
2791 case 71: /* position ::= expr between position AND position */
2792 #line 698 "pikchr.y"
2793 {yylhsminor.yy79 = pik_position_between(yymsp[-4].minor.yy153,yymsp[-2].minor.yy79,yymsp[0].minor.yy79);}
2794 #line 2819 "pikchr.c"
2795 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2796 break;
2797 case 72: /* position ::= expr LT position COMMA position GT */
2798 #line 700 "pikchr.y"
2799 {yylhsminor.yy79 = pik_position_between(yymsp[-5].minor.yy153,yymsp[-3].minor.yy79,yymsp[-1].minor.yy79);}
2800 #line 2825 "pikchr.c"
2801 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2802 break;
2803 case 73: /* position ::= expr ABOVE position */
2804 #line 701 "pikchr.y"
2805 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y += yymsp[-2].minor.yy153;}
2806 #line 2831 "pikchr.c"
2807 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2808 break;
2809 case 74: /* position ::= expr BELOW position */
2810 #line 702 "pikchr.y"
2811 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y -= yymsp[-2].minor.yy153;}
2812 #line 2837 "pikchr.c"
2813 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2814 break;
2815 case 75: /* position ::= expr LEFT OF position */
2816 #line 703 "pikchr.y"
2817 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x -= yymsp[-3].minor.yy153;}
2818 #line 2843 "pikchr.c"
2819 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2820 break;
2821 case 76: /* position ::= expr RIGHT OF position */
2822 #line 704 "pikchr.y"
2823 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x += yymsp[-3].minor.yy153;}
2824 #line 2849 "pikchr.c"
2825 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2826 break;
2827 case 77: /* position ::= expr ON HEADING EDGEPT OF position */
2828 #line 706 "pikchr.y"
2829 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-5].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2830 #line 2855 "pikchr.c"
2831 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2832 break;
2833 case 78: /* position ::= expr HEADING EDGEPT OF position */
2834 #line 708 "pikchr.y"
2835 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-4].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2836 #line 2861 "pikchr.c"
2837 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2838 break;
2839 case 79: /* position ::= expr EDGEPT OF position */
2840 #line 710 "pikchr.y"
2841 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2842 #line 2867 "pikchr.c"
2843 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2844 break;
2845 case 80: /* position ::= expr ON HEADING expr FROM position */
2846 #line 712 "pikchr.y"
2847 {yylhsminor.yy79 = pik_position_at_angle(yymsp[-5].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2848 #line 2873 "pikchr.c"
2849 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2850 break;
2851 case 81: /* position ::= expr HEADING expr FROM position */
2852 #line 714 "pikchr.y"
2853 {yylhsminor.yy79 = pik_position_at_angle(yymsp[-4].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2854 #line 2879 "pikchr.c"
2855 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2856 break;
2857 case 82: /* place ::= edge OF object */
2858 #line 726 "pikchr.y"
2859 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2860 #line 2885 "pikchr.c"
2861 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2862 break;
2863 case 83: /* place2 ::= object */
2864 #line 727 "pikchr.y"
2865 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,0);}
2866 #line 2891 "pikchr.c"
2867 yymsp[0].minor.yy79 = yylhsminor.yy79;
2868 break;
2869 case 84: /* place2 ::= object DOT_E edge */
2870 #line 728 "pikchr.y"
2871 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2872 #line 2897 "pikchr.c"
2873 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2874 break;
2875 case 85: /* place2 ::= NTH VERTEX OF object */
2876 #line 729 "pikchr.y"
2877 {yylhsminor.yy79 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy36);}
2878 #line 2903 "pikchr.c"
2879 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2880 break;
2881 case 86: /* object ::= nth */
2882 #line 741 "pikchr.y"
2883 {yylhsminor.yy36 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2884 #line 2909 "pikchr.c"
2885 yymsp[0].minor.yy36 = yylhsminor.yy36;
2886 break;
2887 case 87: /* object ::= nth OF|IN object */
2888 #line 742 "pikchr.y"
2889 {yylhsminor.yy36 = pik_find_nth(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2890 #line 2915 "pikchr.c"
2891 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2892 break;
2893 case 88: /* objectname ::= THIS */
2894 #line 744 "pikchr.y"
2895 {yymsp[0].minor.yy36 = p->cur;}
2896 #line 2921 "pikchr.c"
2897 break;
2898 case 89: /* objectname ::= PLACENAME */
2899 #line 745 "pikchr.y"
2900 {yylhsminor.yy36 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2901 #line 2926 "pikchr.c"
2902 yymsp[0].minor.yy36 = yylhsminor.yy36;
2903 break;
2904 case 90: /* objectname ::= objectname DOT_U PLACENAME */
2905 #line 747 "pikchr.y"
2906 {yylhsminor.yy36 = pik_find_byname(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2907 #line 2932 "pikchr.c"
2908 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2909 break;
2910 case 91: /* nth ::= NTH CLASSNAME */
2911 #line 749 "pikchr.y"
2912 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2913 #line 2938 "pikchr.c"
2914 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2915 break;
2916 case 92: /* nth ::= NTH LAST CLASSNAME */
2917 #line 750 "pikchr.y"
2918 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2919 #line 2944 "pikchr.c"
2920 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2921 break;
2922 case 93: /* nth ::= LAST CLASSNAME */
2923 #line 751 "pikchr.y"
2924 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2925 #line 2950 "pikchr.c"
2926 break;
2927 case 94: /* nth ::= LAST */
2928 #line 752 "pikchr.y"
2929 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2930 #line 2955 "pikchr.c"
2931 yymsp[0].minor.yy0 = yylhsminor.yy0;
2932 break;
2933 case 95: /* nth ::= NTH LB RB */
2934 #line 753 "pikchr.y"
2935 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2936 #line 2961 "pikchr.c"
2937 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2938 break;
2939 case 96: /* nth ::= NTH LAST LB RB */
2940 #line 754 "pikchr.y"
2941 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2942 #line 2967 "pikchr.c"
2943 yymsp[-3].minor.yy0 = yylhsminor.yy0;
2944 break;
2945 case 97: /* nth ::= LAST LB RB */
2946 #line 755 "pikchr.y"
2947 {yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2948 #line 2973 "pikchr.c"
2949 break;
2950 case 98: /* expr ::= expr PLUS expr */
2951 #line 757 "pikchr.y"
2952 {yylhsminor.yy153=yymsp[-2].minor.yy153+yymsp[0].minor.yy153;}
2953 #line 2978 "pikchr.c"
2954 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2955 break;
2956 case 99: /* expr ::= expr MINUS expr */
2957 #line 758 "pikchr.y"
2958 {yylhsminor.yy153=yymsp[-2].minor.yy153-yymsp[0].minor.yy153;}
2959 #line 2984 "pikchr.c"
2960 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2961 break;
2962 case 100: /* expr ::= expr STAR expr */
2963 #line 759 "pikchr.y"
2964 {yylhsminor.yy153=yymsp[-2].minor.yy153*yymsp[0].minor.yy153;}
2965 #line 2990 "pikchr.c"
2966 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2967 break;
2968 case 101: /* expr ::= expr SLASH expr */
2969 #line 760 "pikchr.y"
2970 {
2971 if( yymsp[0].minor.yy153==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy153 = 0.0; }
2972 else{ yylhsminor.yy153 = yymsp[-2].minor.yy153/yymsp[0].minor.yy153; }
2973 }
2974 #line 2999 "pikchr.c"
2975 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2976 break;
2977 case 102: /* expr ::= MINUS expr */
2978 #line 764 "pikchr.y"
2979 {yymsp[-1].minor.yy153=-yymsp[0].minor.yy153;}
2980 #line 3005 "pikchr.c"
2981 break;
2982 case 103: /* expr ::= PLUS expr */
2983 #line 765 "pikchr.y"
2984 {yymsp[-1].minor.yy153=yymsp[0].minor.yy153;}
2985 #line 3010 "pikchr.c"
2986 break;
2987 case 104: /* expr ::= LP expr RP */
2988 #line 766 "pikchr.y"
2989 {yymsp[-2].minor.yy153=yymsp[-1].minor.yy153;}
2990 #line 3015 "pikchr.c"
2991 break;
2992 case 105: /* expr ::= LP FILL|COLOR|THICKNESS RP */
2993 #line 767 "pikchr.y"
2994 {yymsp[-2].minor.yy153=pik_get_var(p,&yymsp[-1].minor.yy0);}
2995 #line 3020 "pikchr.c"
2996 break;
2997 case 106: /* expr ::= NUMBER */
2998 #line 768 "pikchr.y"
2999 {yylhsminor.yy153=pik_atof(&yymsp[0].minor.yy0);}
3000 #line 3025 "pikchr.c"
3001 yymsp[0].minor.yy153 = yylhsminor.yy153;
3002 break;
3003 case 107: /* expr ::= ID */
3004 #line 769 "pikchr.y"
3005 {yylhsminor.yy153=pik_get_var(p,&yymsp[0].minor.yy0);}
3006 #line 3031 "pikchr.c"
3007 yymsp[0].minor.yy153 = yylhsminor.yy153;
3008 break;
3009 case 108: /* expr ::= FUNC1 LP expr RP */
3010 #line 770 "pikchr.y"
3011 {yylhsminor.yy153 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy153,0.0);}
3012 #line 3037 "pikchr.c"
3013 yymsp[-3].minor.yy153 = yylhsminor.yy153;
3014 break;
3015 case 109: /* expr ::= FUNC2 LP expr COMMA expr RP */
3016 #line 771 "pikchr.y"
3017 {yylhsminor.yy153 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy153,yymsp[-1].minor.yy153);}
3018 #line 3043 "pikchr.c"
3019 yymsp[-5].minor.yy153 = yylhsminor.yy153;
3020 break;
3021 case 110: /* expr ::= DIST LP position COMMA position RP */
3022 #line 772 "pikchr.y"
3023 {yymsp[-5].minor.yy153 = pik_dist(&yymsp[-3].minor.yy79,&yymsp[-1].minor.yy79);}
3024 #line 3049 "pikchr.c"
3025 break;
3026 case 111: /* expr ::= place2 DOT_XY X */
3027 #line 773 "pikchr.y"
3028 {yylhsminor.yy153 = yymsp[-2].minor.yy79.x;}
3029 #line 3054 "pikchr.c"
3030 yymsp[-2].minor.yy153 = yylhsminor.yy153;
3031 break;
3032 case 112: /* expr ::= place2 DOT_XY Y */
3033 #line 774 "pikchr.y"
3034 {yylhsminor.yy153 = yymsp[-2].minor.yy79.y;}
3035 #line 3060 "pikchr.c"
3036 yymsp[-2].minor.yy153 = yylhsminor.yy153;
3037 break;
3038 case 113: /* expr ::= object DOT_L numproperty */
3039 case 114: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==114);
3040 case 115: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==115);
3041 #line 775 "pikchr.y"
3042 {yylhsminor.yy153=pik_property_of(yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
3043 #line 3068 "pikchr.c"
3044 yymsp[-2].minor.yy153 = yylhsminor.yy153;
3045 break;
3046 default:
3047 /* (116) lvalue ::= ID */ yytestcase(yyruleno==116);
3048 /* (117) lvalue ::= FILL */ yytestcase(yyruleno==117);
@@ -3131,19 +3141,19 @@
3141 ){
3142 pik_parserARG_FETCH
3143 pik_parserCTX_FETCH
3144 #define TOKEN yyminor
3145 /************ Begin %syntax_error code ****************************************/
3146 #line 535 "pikchr.y"
3147
3148 if( TOKEN.z && TOKEN.z[0] ){
3149 pik_error(p, &TOKEN, "syntax error");
3150 }else{
3151 pik_error(p, 0, "syntax error");
3152 }
3153 UNUSED_PARAMETER(yymajor);
3154 #line 3179 "pikchr.c"
3155 /************ End %syntax_error code ******************************************/
3156 pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
3157 pik_parserCTX_STORE
3158 }
3159
@@ -3372,11 +3382,11 @@
3382 #else
3383 (void)iToken;
3384 return 0;
3385 #endif
3386 }
3387 #line 780 "pikchr.y"
3388
3389
3390
3391 /* Chart of the 148 official CSS color names with their
3392 ** corresponding RGB values thru Color Module Level 4:
@@ -7744,10 +7754,14 @@
7754 printf("******** Token %s (%d): \"%.*s\" **************\n",
7755 yyTokenName[token.eType], token.eType,
7756 (int)(isspace(token.z[0]) ? 0 : sz), token.z);
7757 #endif
7758 token.n = (unsigned short)(sz & 0xffff);
7759 if( p->nToken++ > PIKCHR_TOKEN_LIMIT ){
7760 pik_error(p, &token, "script is too complex");
7761 break;
7762 }
7763 pik_parser(pParser, token.eType, token);
7764 }
7765 }
7766 }
7767
@@ -8081,6 +8095,6 @@
8095
8096
8097 #endif /* PIKCHR_TCL */
8098
8099
8100 #line 8125 "pikchr.c"
8101
+242 -180
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455455
#define SQLITE_VERSION "3.39.0"
456456
#define SQLITE_VERSION_NUMBER 3039000
457
-#define SQLITE_SOURCE_ID "2022-03-23 10:04:52 43143ad131f17734fd2eff849e0a1bc2e26daf6a28c7e07d697d38732e6af5fc"
457
+#define SQLITE_SOURCE_ID "2022-04-01 17:23:17 a7d79560a0efd6221ba59ce84bcb4fa94024a901ac4a45e192ddecc6e1b5c78c"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -22410,10 +22410,11 @@
2241022410
FuncDef *pFunc; /* Pointer to function information */
2241122411
Mem *pMem; /* Memory cell used to store aggregate context */
2241222412
Vdbe *pVdbe; /* The VM that owns this context */
2241322413
int iOp; /* Instruction number of OP_Function */
2241422414
int isError; /* Error code returned by the function. */
22415
+ u8 enc; /* Encoding to use for results */
2241522416
u8 skipFlag; /* Skip accumulator loading if true */
2241622417
u8 argc; /* Number of arguments */
2241722418
sqlite3_value *argv[1]; /* Argument set */
2241822419
};
2241922420
@@ -22458,11 +22459,10 @@
2245822459
struct Vdbe {
2245922460
sqlite3 *db; /* The database connection that owns this statement */
2246022461
Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
2246122462
Parse *pParse; /* Parsing context used to create this Vdbe */
2246222463
ynVar nVar; /* Number of entries in aVar[] */
22463
- u32 iVdbeMagic; /* Magic number defining state of the SQL statement */
2246422464
int nMem; /* Number of memory locations currently allocated */
2246522465
int nCursor; /* Number of slots in apCsr[] */
2246622466
u32 cacheCtr; /* VdbeCursor row cache generation counter */
2246722467
int pc; /* The program counter */
2246822468
int rc; /* Value to return */
@@ -22497,10 +22497,11 @@
2249722497
u16 nResColumn; /* Number of columns in one row of the result set */
2249822498
u8 errorAction; /* Recovery action to do in case of an error */
2249922499
u8 minWriteFileFormat; /* Minimum file format for writable database files */
2250022500
u8 prepFlags; /* SQLITE_PREPARE_* flags */
2250122501
u8 doingRerun; /* True if rerunning after an auto-reprepare */
22502
+ u8 eVdbeState; /* On of the VDBE_*_STATE values */
2250222503
bft expired:2; /* 1: recompile VM immediately 2: when convenient */
2250322504
bft explain:2; /* True if EXPLAIN present on SQL command */
2250422505
bft changeCntOn:1; /* True to update the change-counter */
2250522506
bft runOnlyOnce:1; /* Automatically expire on reset */
2250622507
bft usesStmtJournal:1; /* True if uses a statement journal */
@@ -22527,17 +22528,16 @@
2252722528
ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
2252822529
#endif
2252922530
};
2253022531
2253122532
/*
22532
-** The following are allowed values for Vdbe.magic
22533
+** The following are allowed values for Vdbe.eVdbeState
2253322534
*/
22534
-#define VDBE_MAGIC_INIT 0x16bceaa5 /* Building a VDBE program */
22535
-#define VDBE_MAGIC_RUN 0x2df20da3 /* VDBE is ready to execute */
22536
-#define VDBE_MAGIC_HALT 0x319c2973 /* VDBE has completed execution */
22537
-#define VDBE_MAGIC_RESET 0x48fa9f76 /* Reset and ready to run again */
22538
-#define VDBE_MAGIC_DEAD 0x5606c3c8 /* The VDBE has been deallocated */
22535
+#define VDBE_INIT_STATE 0 /* Prepared statement under construction */
22536
+#define VDBE_READY_STATE 1 /* Ready to run but not yet started */
22537
+#define VDBE_RUN_STATE 2 /* Run in progress */
22538
+#define VDBE_HALT_STATE 3 /* Finished. Need reset() or finalize() */
2253922539
2254022540
/*
2254122541
** Structure used to store the context required by the
2254222542
** sqlite3_preupdate_*() API functions.
2254322543
*/
@@ -27002,12 +27002,17 @@
2700227002
** 32-bit signed integer. Hence the largest allocation is 0x40000000
2700327003
** or 1073741824 bytes.
2700427004
*/
2700527005
static int memsys5Roundup(int n){
2700627006
int iFullSz;
27007
- if( n > 0x40000000 ) return 0;
27008
- for(iFullSz=mem5.szAtom; iFullSz<n; iFullSz *= 2);
27007
+ if( n<=mem5.szAtom*2 ){
27008
+ if( n<=mem5.szAtom ) return mem5.szAtom;
27009
+ return mem5.szAtom*2;
27010
+ }
27011
+ if( n>0x40000000 ) return 0;
27012
+ for(iFullSz=mem5.szAtom*8; iFullSz<n; iFullSz *= 4);
27013
+ if( (iFullSz/2)>=n ) return iFullSz/2;
2700927014
return iFullSz;
2701027015
}
2701127016
2701227017
/*
2701327018
** Return the ceiling of the logarithm base 2 of iValue.
@@ -74949,11 +74954,10 @@
7494974954
** balance_deeper()
7495074955
** balance_nonroot()
7495174956
*/
7495274957
static int balance(BtCursor *pCur){
7495374958
int rc = SQLITE_OK;
74954
- const int nMin = pCur->pBt->usableSize * 2 / 3;
7495574959
u8 aBalanceQuickSpace[13];
7495674960
u8 *pFree = 0;
7495774961
7495874962
VVA_ONLY( int balance_quick_called = 0 );
7495974963
VVA_ONLY( int balance_deeper_called = 0 );
@@ -74961,11 +74965,15 @@
7496174965
do {
7496274966
int iPage;
7496374967
MemPage *pPage = pCur->pPage;
7496474968
7496574969
if( NEVER(pPage->nFree<0) && btreeComputeFreeSpace(pPage) ) break;
74966
- if( pPage->nOverflow==0 && pPage->nFree<=nMin ){
74970
+ if( pPage->nOverflow==0 && pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
74971
+ /* No rebalance required as long as:
74972
+ ** (1) There are no overflow cells
74973
+ ** (2) The amount of free space on the page is less than 2/3rds of
74974
+ ** the total usable space on the page. */
7496774975
break;
7496874976
}else if( (iPage = pCur->iPage)==0 ){
7496974977
if( pPage->nOverflow && (rc = anotherValidCursor(pCur))==SQLITE_OK ){
7497074978
/* The root page of the b-tree is overfull. In this case call the
7497174979
** balance_deeper() function to create a new child for the root-page
@@ -75775,11 +75783,19 @@
7577575783
** on the leaf node first. If the balance proceeds far enough up the
7577675784
** tree that we can be sure that any problem in the internal node has
7577775785
** been corrected, so be it. Otherwise, after balancing the leaf node,
7577875786
** walk the cursor up the tree to the internal node and balance it as
7577975787
** well. */
75780
- rc = balance(pCur);
75788
+ assert( pCur->pPage->nOverflow==0 );
75789
+ assert( pCur->pPage->nFree>=0 );
75790
+ if( pCur->pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
75791
+ /* Optimization: If the free space is less than 2/3rds of the page,
75792
+ ** then balance() will always be a no-op. No need to invoke it. */
75793
+ rc = SQLITE_OK;
75794
+ }else{
75795
+ rc = balance(pCur);
75796
+ }
7578175797
if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
7578275798
releasePageNotNull(pCur->pPage);
7578375799
pCur->iPage--;
7578475800
while( pCur->iPage>iCellDepth ){
7578575801
releasePage(pCur->apPage[pCur->iPage--]);
@@ -78270,11 +78286,15 @@
7827078286
#endif
7827178287
assert( pMem!=0 );
7827278288
assert( !sqlite3VdbeMemIsRowSet(pMem) );
7827378289
assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
7827478290
|| desiredEnc==SQLITE_UTF16BE );
78275
- if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
78291
+ if( !(pMem->flags&MEM_Str) ){
78292
+ pMem->enc = desiredEnc;
78293
+ return SQLITE_OK;
78294
+ }
78295
+ if( pMem->enc==desiredEnc ){
7827678296
return SQLITE_OK;
7827778297
}
7827878298
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
7827978299
#ifdef SQLITE_OMIT_UTF16
7828078300
return SQLITE_ERROR;
@@ -78529,10 +78549,11 @@
7852978549
t.flags = MEM_Null;
7853078550
t.db = pMem->db;
7853178551
ctx.pOut = &t;
7853278552
ctx.pMem = pMem;
7853378553
ctx.pFunc = pFunc;
78554
+ ctx.enc = ENC(t.db);
7853478555
pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */
7853578556
assert( (pMem->flags & MEM_Dyn)==0 );
7853678557
if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
7853778558
memcpy(pMem, &t, sizeof(t));
7853878559
return ctx.isError;
@@ -78556,10 +78577,11 @@
7855678577
memset(&ctx, 0, sizeof(ctx));
7855778578
sqlite3VdbeMemSetNull(pOut);
7855878579
ctx.pOut = pOut;
7855978580
ctx.pMem = pAccum;
7856078581
ctx.pFunc = pFunc;
78582
+ ctx.enc = ENC(pAccum->db);
7856178583
pFunc->xValue(&ctx);
7856278584
return ctx.isError;
7856378585
}
7856478586
#endif /* SQLITE_OMIT_WINDOWFUNC */
7856578587
@@ -79173,10 +79195,17 @@
7917379195
** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH
7917479196
** size limit) then no memory allocation occurs. If the string can be
7917579197
** stored without allocating memory, then it is. If a memory allocation
7917679198
** is required to store the string, then value of pMem is unchanged. In
7917779199
** either case, SQLITE_TOOBIG is returned.
79200
+**
79201
+** The "enc" parameter is the text encoding for the string, or zero
79202
+** to store a blob.
79203
+**
79204
+** If n is negative, then the string consists of all bytes up to but
79205
+** excluding the first zero character. The n parameter must be
79206
+** non-negative for blobs.
7917879207
*/
7917979208
SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
7918079209
Mem *pMem, /* Memory cell to set to string value */
7918179210
const char *z, /* String pointer */
7918279211
i64 n, /* Bytes in string, or negative */
@@ -79183,15 +79212,16 @@
7918379212
u8 enc, /* Encoding of z. 0 for BLOBs */
7918479213
void (*xDel)(void*) /* Destructor function */
7918579214
){
7918679215
i64 nByte = n; /* New value for pMem->n */
7918779216
int iLimit; /* Maximum allowed string or blob size */
79188
- u16 flags = 0; /* New value for pMem->flags */
79217
+ u16 flags; /* New value for pMem->flags */
7918979218
7919079219
assert( pMem!=0 );
7919179220
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
7919279221
assert( !sqlite3VdbeMemIsRowSet(pMem) );
79222
+ assert( enc!=0 || n>=0 );
7919379223
7919479224
/* If z is a NULL pointer, set pMem to contain an SQL NULL. */
7919579225
if( !z ){
7919679226
sqlite3VdbeMemSetNull(pMem);
7919779227
return SQLITE_OK;
@@ -79200,19 +79230,34 @@
7920079230
if( pMem->db ){
7920179231
iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];
7920279232
}else{
7920379233
iLimit = SQLITE_MAX_LENGTH;
7920479234
}
79205
- flags = (enc==0?MEM_Blob:MEM_Str);
7920679235
if( nByte<0 ){
7920779236
assert( enc!=0 );
7920879237
if( enc==SQLITE_UTF8 ){
7920979238
nByte = strlen(z);
7921079239
}else{
7921179240
for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
7921279241
}
79213
- flags |= MEM_Term;
79242
+ flags= MEM_Str|MEM_Term;
79243
+ }else if( enc==0 ){
79244
+ flags = MEM_Blob;
79245
+ enc = SQLITE_UTF8;
79246
+ }else{
79247
+ flags = MEM_Str;
79248
+ }
79249
+ if( nByte>iLimit ){
79250
+ if( xDel && xDel!=SQLITE_TRANSIENT ){
79251
+ if( xDel==SQLITE_DYNAMIC ){
79252
+ sqlite3DbFree(pMem->db, (void*)z);
79253
+ }else{
79254
+ xDel((void*)z);
79255
+ }
79256
+ }
79257
+ sqlite3VdbeMemSetNull(pMem);
79258
+ return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
7921479259
}
7921579260
7921679261
/* The following block sets the new values of Mem.z and Mem.xDel. It
7921779262
** also sets a flag in local variable "flags" to indicate the memory
7921879263
** management (one of MEM_Dyn or MEM_Static).
@@ -79220,13 +79265,10 @@
7922079265
if( xDel==SQLITE_TRANSIENT ){
7922179266
i64 nAlloc = nByte;
7922279267
if( flags&MEM_Term ){
7922379268
nAlloc += (enc==SQLITE_UTF8?1:2);
7922479269
}
79225
- if( nByte>iLimit ){
79226
- return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
79227
- }
7922879270
testcase( nAlloc==0 );
7922979271
testcase( nAlloc==31 );
7923079272
testcase( nAlloc==32 );
7923179273
if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){
7923279274
return SQLITE_NOMEM_BKPT;
@@ -79244,30 +79286,18 @@
7924479286
}
7924579287
}
7924679288
7924779289
pMem->n = (int)(nByte & 0x7fffffff);
7924879290
pMem->flags = flags;
79249
- if( enc ){
79250
- pMem->enc = enc;
79251
-#ifdef SQLITE_ENABLE_SESSION
79252
- }else if( pMem->db==0 ){
79253
- pMem->enc = SQLITE_UTF8;
79254
-#endif
79255
- }else{
79256
- assert( pMem->db!=0 );
79257
- pMem->enc = ENC(pMem->db);
79258
- }
79291
+ pMem->enc = enc;
7925979292
7926079293
#ifndef SQLITE_OMIT_UTF16
7926179294
if( enc>SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
7926279295
return SQLITE_NOMEM_BKPT;
7926379296
}
7926479297
#endif
7926579298
79266
- if( nByte>iLimit ){
79267
- return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
79268
- }
7926979299
7927079300
return SQLITE_OK;
7927179301
}
7927279302
7927379303
/*
@@ -79545,10 +79575,11 @@
7954579575
7954679576
assert( pCtx->pParse->rc==SQLITE_OK );
7954779577
memset(&ctx, 0, sizeof(ctx));
7954879578
ctx.pOut = pVal;
7954979579
ctx.pFunc = pFunc;
79580
+ ctx.enc = ENC(db);
7955079581
pFunc->xSFunc(&ctx, nVal, apVal);
7955179582
if( ctx.isError ){
7955279583
rc = ctx.isError;
7955379584
sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
7955479585
}else{
@@ -80055,11 +80086,11 @@
8005580086
db->pVdbe->pPrev = p;
8005680087
}
8005780088
p->pNext = db->pVdbe;
8005880089
p->pPrev = 0;
8005980090
db->pVdbe = p;
80060
- p->iVdbeMagic = VDBE_MAGIC_INIT;
80091
+ assert( p->eVdbeState==VDBE_INIT_STATE );
8006180092
p->pParse = pParse;
8006280093
pParse->pVdbe = p;
8006380094
assert( pParse->aLabel==0 );
8006480095
assert( pParse->nLabel==0 );
8006580096
assert( p->nOpAlloc==0 );
@@ -80256,11 +80287,11 @@
8025680287
SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
8025780288
int i;
8025880289
VdbeOp *pOp;
8025980290
8026080291
i = p->nOp;
80261
- assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
80292
+ assert( p->eVdbeState==VDBE_INIT_STATE );
8026280293
assert( op>=0 && op<0xff );
8026380294
if( p->nOpAlloc<=i ){
8026480295
return growOp3(p, op, p1, p2, p3);
8026580296
}
8026680297
assert( p->aOp!=0 );
@@ -80588,11 +80619,11 @@
8058880619
}
8058980620
}
8059080621
SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
8059180622
Parse *p = v->pParse;
8059280623
int j = ADDR(x);
80593
- assert( v->iVdbeMagic==VDBE_MAGIC_INIT );
80624
+ assert( v->eVdbeState==VDBE_INIT_STATE );
8059480625
assert( j<-p->nLabel );
8059580626
assert( j>=0 );
8059680627
#ifdef SQLITE_DEBUG
8059780628
if( p->db->flags & SQLITE_VdbeAddopTrace ){
8059880629
printf("RESOLVE LABEL %d to %d\n", x, v->nOp);
@@ -80719,10 +80750,12 @@
8071980750
int hasCreateTable = 0;
8072080751
int hasCreateIndex = 0;
8072180752
int hasInitCoroutine = 0;
8072280753
Op *pOp;
8072380754
VdbeOpIter sIter;
80755
+
80756
+ if( v==0 ) return 0;
8072480757
memset(&sIter, 0, sizeof(sIter));
8072580758
sIter.v = v;
8072680759
8072780760
while( (pOp = opIterNext(&sIter))!=0 ){
8072880761
int opcode = pOp->opcode;
@@ -80883,22 +80916,24 @@
8088380916
assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0);
8088480917
}
8088580918
if( pOp==p->aOp ) break;
8088680919
pOp--;
8088780920
}
80888
- sqlite3DbFree(p->db, pParse->aLabel);
80889
- pParse->aLabel = 0;
80921
+ if( aLabel ){
80922
+ sqlite3DbFreeNN(p->db, pParse->aLabel);
80923
+ pParse->aLabel = 0;
80924
+ }
8089080925
pParse->nLabel = 0;
8089180926
*pMaxFuncArgs = nMaxArgs;
8089280927
assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
8089380928
}
8089480929
8089580930
/*
8089680931
** Return the address of the next instruction to be inserted.
8089780932
*/
8089880933
SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){
80899
- assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
80934
+ assert( p->eVdbeState==VDBE_INIT_STATE );
8090080935
return p->nOp;
8090180936
}
8090280937
8090380938
/*
8090480939
** Verify that at least N opcode slots are available in p without
@@ -80979,11 +81014,11 @@
8097981014
int iLineno /* Source-file line number of first opcode */
8098081015
){
8098181016
int i;
8098281017
VdbeOp *pOut, *pFirst;
8098381018
assert( nOp>0 );
80984
- assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
81019
+ assert( p->eVdbeState==VDBE_INIT_STATE );
8098581020
if( p->nOp + nOp > p->nOpAlloc && growOpArray(p, nOp) ){
8098681021
return 0;
8098781022
}
8098881023
pFirst = pOut = &p->aOp[p->nOp];
8098981024
for(i=0; i<nOp; i++, aOp++, pOut++){
@@ -81170,17 +81205,20 @@
8117081205
** Free the space allocated for aOp and any p4 values allocated for the
8117181206
** opcodes contained within. If aOp is not NULL it is assumed to contain
8117281207
** nOp entries.
8117381208
*/
8117481209
static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
81210
+ assert( nOp>=0 );
8117581211
if( aOp ){
81176
- Op *pOp;
81177
- for(pOp=&aOp[nOp-1]; pOp>=aOp; pOp--){
81212
+ Op *pOp = &aOp[nOp-1];
81213
+ while(1){ /* Exit via break */
8117881214
if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
8117981215
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
8118081216
sqlite3DbFree(db, pOp->zComment);
8118181217
#endif
81218
+ if( pOp==aOp ) break;
81219
+ pOp--;
8118281220
}
8118381221
sqlite3DbFreeNN(db, aOp);
8118481222
}
8118581223
}
8118681224
@@ -81302,11 +81340,11 @@
8130281340
SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
8130381341
Op *pOp;
8130481342
sqlite3 *db;
8130581343
assert( p!=0 );
8130681344
db = p->db;
81307
- assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
81345
+ assert( p->eVdbeState==VDBE_INIT_STATE );
8130881346
assert( p->aOp!=0 || db->mallocFailed );
8130981347
if( db->mallocFailed ){
8131081348
if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
8131181349
return;
8131281350
}
@@ -81430,11 +81468,11 @@
8143081468
*/
8143181469
SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
8143281470
/* C89 specifies that the constant "dummy" will be initialized to all
8143381471
** zeros, which is correct. MSVC generates a warning, nevertheless. */
8143481472
static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
81435
- assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
81473
+ assert( p->eVdbeState==VDBE_INIT_STATE );
8143681474
if( addr<0 ){
8143781475
addr = p->nOp - 1;
8143881476
}
8143981477
assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
8144081478
if( p->db->mallocFailed ){
@@ -82132,11 +82170,11 @@
8213282170
int bListSubprogs = (p->explain==1 || (db->flags & SQLITE_TriggerEQP)!=0);
8213382171
Op *aOp; /* Array of opcodes */
8213482172
Op *pOp; /* Current opcode */
8213582173
8213682174
assert( p->explain );
82137
- assert( p->iVdbeMagic==VDBE_MAGIC_RUN );
82175
+ assert( p->eVdbeState==VDBE_RUN_STATE );
8213882176
assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );
8213982177
8214082178
/* Even though this opcode does not use dynamic strings for
8214182179
** the result, result columns may become dynamic if the user calls
8214282180
** sqlite3_column_text16(), causing a translation to UTF-16 encoding.
@@ -82312,18 +82350,19 @@
8231282350
SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
8231382351
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
8231482352
int i;
8231582353
#endif
8231682354
assert( p!=0 );
82317
- assert( p->iVdbeMagic==VDBE_MAGIC_INIT || p->iVdbeMagic==VDBE_MAGIC_RESET );
82355
+ assert( p->eVdbeState==VDBE_INIT_STATE
82356
+ || p->eVdbeState==VDBE_READY_STATE
82357
+ || p->eVdbeState==VDBE_HALT_STATE );
8231882358
8231982359
/* There should be at least one opcode.
8232082360
*/
8232182361
assert( p->nOp>0 );
8232282362
82323
- /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */
82324
- p->iVdbeMagic = VDBE_MAGIC_RUN;
82363
+ p->eVdbeState = VDBE_READY_STATE;
8232582364
8232682365
#ifdef SQLITE_DEBUG
8232782366
for(i=0; i<p->nMem; i++){
8232882367
assert( p->aMem[i].db==p->db );
8232982368
}
@@ -82375,11 +82414,11 @@
8237582414
struct ReusableSpace x; /* Reusable bulk memory */
8237682415
8237782416
assert( p!=0 );
8237882417
assert( p->nOp>0 );
8237982418
assert( pParse!=0 );
82380
- assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
82419
+ assert( p->eVdbeState==VDBE_INIT_STATE );
8238182420
assert( pParse==p->pParse );
8238282421
p->pVList = pParse->pVList;
8238382422
pParse->pVList = 0;
8238482423
db = p->db;
8238582424
assert( db->mallocFailed==0 );
@@ -82516,18 +82555,16 @@
8251682555
8251782556
/*
8251882557
** Close all cursors in the current frame.
8251982558
*/
8252082559
static void closeCursorsInFrame(Vdbe *p){
82521
- if( p->apCsr ){
82522
- int i;
82523
- for(i=0; i<p->nCursor; i++){
82524
- VdbeCursor *pC = p->apCsr[i];
82525
- if( pC ){
82526
- sqlite3VdbeFreeCursor(p, pC);
82527
- p->apCsr[i] = 0;
82528
- }
82560
+ int i;
82561
+ for(i=0; i<p->nCursor; i++){
82562
+ VdbeCursor *pC = p->apCsr[i];
82563
+ if( pC ){
82564
+ sqlite3VdbeFreeCursor(p, pC);
82565
+ p->apCsr[i] = 0;
8252982566
}
8253082567
}
8253182568
}
8253282569
8253382570
/*
@@ -82572,13 +82609,11 @@
8257282609
p->pFrame = 0;
8257382610
p->nFrame = 0;
8257482611
}
8257582612
assert( p->nFrame==0 );
8257682613
closeCursorsInFrame(p);
82577
- if( p->aMem ){
82578
- releaseMemArray(p->aMem, p->nMem);
82579
- }
82614
+ releaseMemArray(p->aMem, p->nMem);
8258082615
while( p->pDelFrame ){
8258182616
VdbeFrame *pDel = p->pDelFrame;
8258282617
p->pDelFrame = pDel->pParent;
8258382618
sqlite3VdbeFrameDelete(pDel);
8258482619
}
@@ -83014,10 +83049,11 @@
8301483049
|| (!deferred && p->nFkConstraint>0)
8301583050
){
8301683051
p->rc = SQLITE_CONSTRAINT_FOREIGNKEY;
8301783052
p->errorAction = OE_Abort;
8301883053
sqlite3VdbeError(p, "FOREIGN KEY constraint failed");
83054
+ if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)==0 ) return SQLITE_ERROR;
8301983055
return SQLITE_CONSTRAINT_FOREIGNKEY;
8302083056
}
8302183057
return SQLITE_OK;
8302283058
}
8302383059
#endif
@@ -83053,11 +83089,11 @@
8305383089
** Then the internal cache might have been left in an inconsistent
8305483090
** state. We need to rollback the statement transaction, if there is
8305583091
** one, or the complete transaction if there is no statement transaction.
8305683092
*/
8305783093
83058
- if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
83094
+ if( p->eVdbeState!=VDBE_RUN_STATE ){
8305983095
return SQLITE_OK;
8306083096
}
8306183097
if( db->mallocFailed ){
8306283098
p->rc = SQLITE_NOMEM_BKPT;
8306383099
}
@@ -83064,11 +83100,11 @@
8306483100
closeAllCursors(p);
8306583101
checkActiveVdbeCnt(db);
8306683102
8306783103
/* No commit or rollback needed if the program never started or if the
8306883104
** SQL statement does not read or write a database file. */
83069
- if( p->pc>=0 && p->bIsReader ){
83105
+ if( p->bIsReader ){
8307083106
int mrc; /* Primary error code from p->rc */
8307183107
int eStatementOp = 0;
8307283108
int isSpecialError; /* Set to true if a 'special' error */
8307383109
8307483110
/* Lock all btrees used by the statement */
@@ -83212,19 +83248,17 @@
8321283248
/* Release the locks */
8321383249
sqlite3VdbeLeave(p);
8321483250
}
8321583251
8321683252
/* We have successfully halted and closed the VM. Record this fact. */
83217
- if( p->pc>=0 ){
83218
- db->nVdbeActive--;
83219
- if( !p->readOnly ) db->nVdbeWrite--;
83220
- if( p->bIsReader ) db->nVdbeRead--;
83221
- assert( db->nVdbeActive>=db->nVdbeRead );
83222
- assert( db->nVdbeRead>=db->nVdbeWrite );
83223
- assert( db->nVdbeWrite>=0 );
83224
- }
83225
- p->iVdbeMagic = VDBE_MAGIC_HALT;
83253
+ db->nVdbeActive--;
83254
+ if( !p->readOnly ) db->nVdbeWrite--;
83255
+ if( p->bIsReader ) db->nVdbeRead--;
83256
+ assert( db->nVdbeActive>=db->nVdbeRead );
83257
+ assert( db->nVdbeRead>=db->nVdbeWrite );
83258
+ assert( db->nVdbeWrite>=0 );
83259
+ p->eVdbeState = VDBE_HALT_STATE;
8322683260
checkActiveVdbeCnt(db);
8322783261
if( db->mallocFailed ){
8322883262
p->rc = SQLITE_NOMEM_BKPT;
8322983263
}
8323083264
@@ -83302,12 +83336,12 @@
8330283336
**
8330383337
** After this routine is run, the VDBE should be ready to be executed
8330483338
** again.
8330583339
**
8330683340
** To look at it another way, this routine resets the state of the
83307
-** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to
83308
-** VDBE_MAGIC_INIT.
83341
+** virtual machine from VDBE_RUN_STATE or VDBE_HALT_STATE back to
83342
+** VDBE_READY_STATE.
8330983343
*/
8331083344
SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
8331183345
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
8331283346
int i;
8331383347
#endif
@@ -83332,16 +83366,10 @@
8333283366
sqlite3VdbeTransferError(p);
8333383367
}else{
8333483368
db->errCode = p->rc;
8333583369
}
8333683370
if( p->runOnlyOnce ) p->expired = 1;
83337
- }else if( p->rc && p->expired ){
83338
- /* The expired flag was set on the VDBE before the first call
83339
- ** to sqlite3_step(). For consistency (since sqlite3_step() was
83340
- ** called), set the database error in this case as well.
83341
- */
83342
- sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg);
8334383371
}
8334483372
8334583373
/* Reset register contents and reclaim error message memory.
8334683374
*/
8334783375
#ifdef SQLITE_DEBUG
@@ -83394,21 +83422,23 @@
8339483422
}
8339583423
fclose(out);
8339683424
}
8339783425
}
8339883426
#endif
83399
- p->iVdbeMagic = VDBE_MAGIC_RESET;
8340083427
return p->rc & db->errMask;
8340183428
}
8340283429
8340383430
/*
8340483431
** Clean up and delete a VDBE after execution. Return an integer which is
8340583432
** the result code. Write any error message text into *pzErrMsg.
8340683433
*/
8340783434
SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){
8340883435
int rc = SQLITE_OK;
83409
- if( p->iVdbeMagic==VDBE_MAGIC_RUN || p->iVdbeMagic==VDBE_MAGIC_HALT ){
83436
+ assert( VDBE_RUN_STATE>VDBE_READY_STATE );
83437
+ assert( VDBE_HALT_STATE>VDBE_READY_STATE );
83438
+ assert( VDBE_INIT_STATE<VDBE_READY_STATE );
83439
+ if( p->eVdbeState>=VDBE_READY_STATE ){
8341083440
rc = sqlite3VdbeReset(p);
8341183441
assert( (rc & p->db->errMask)==rc );
8341283442
}
8341383443
sqlite3VdbeDelete(p);
8341483444
return rc;
@@ -83459,23 +83489,25 @@
8345983489
** the database connection and frees the object itself.
8346083490
*/
8346183491
SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
8346283492
SubProgram *pSub, *pNext;
8346383493
assert( p->db==0 || p->db==db );
83464
- releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
83494
+ if( p->aColName ){
83495
+ releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
83496
+ sqlite3DbFreeNN(db, p->aColName);
83497
+ }
8346583498
for(pSub=p->pProgram; pSub; pSub=pNext){
8346683499
pNext = pSub->pNext;
8346783500
vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
8346883501
sqlite3DbFree(db, pSub);
8346983502
}
83470
- if( p->iVdbeMagic!=VDBE_MAGIC_INIT ){
83503
+ if( p->eVdbeState!=VDBE_INIT_STATE ){
8347183504
releaseMemArray(p->aVar, p->nVar);
83472
- sqlite3DbFree(db, p->pVList);
83473
- sqlite3DbFree(db, p->pFree);
83505
+ if( p->pVList ) sqlite3DbFreeNN(db, p->pVList);
83506
+ if( p->pFree ) sqlite3DbFreeNN(db, p->pFree);
8347483507
}
8347583508
vdbeFreeOpArray(db, p->aOp, p->nOp);
83476
- sqlite3DbFree(db, p->aColName);
8347783509
sqlite3DbFree(db, p->zSql);
8347883510
#ifdef SQLITE_ENABLE_NORMALIZE
8347983511
sqlite3DbFree(db, p->zNormSql);
8348083512
{
8348183513
DblquoteStr *pThis, *pNext;
@@ -83513,12 +83545,10 @@
8351383545
db->pVdbe = p->pNext;
8351483546
}
8351583547
if( p->pNext ){
8351683548
p->pNext->pPrev = p->pPrev;
8351783549
}
83518
- p->iVdbeMagic = VDBE_MAGIC_DEAD;
83519
- p->db = 0;
8352083550
sqlite3DbFreeNN(db, p);
8352183551
}
8352283552
8352383553
/*
8352483554
** The cursor "p" has a pending seek operation that has not yet been
@@ -85638,20 +85668,26 @@
8563885668
const char *z, /* String pointer */
8563985669
int n, /* Bytes in string, or negative */
8564085670
u8 enc, /* Encoding of z. 0 for BLOBs */
8564185671
void (*xDel)(void*) /* Destructor function */
8564285672
){
85643
- int rc = sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel);
85673
+ Mem *pOut = pCtx->pOut;
85674
+ int rc = sqlite3VdbeMemSetStr(pOut, z, n, enc, xDel);
8564485675
if( rc ){
8564585676
if( rc==SQLITE_TOOBIG ){
8564685677
sqlite3_result_error_toobig(pCtx);
8564785678
}else{
8564885679
/* The only errors possible from sqlite3VdbeMemSetStr are
8564985680
** SQLITE_TOOBIG and SQLITE_NOMEM */
8565085681
assert( rc==SQLITE_NOMEM );
8565185682
sqlite3_result_error_nomem(pCtx);
8565285683
}
85684
+ return;
85685
+ }
85686
+ sqlite3VdbeChangeEncoding(pOut, pCtx->enc);
85687
+ if( sqlite3VdbeMemTooBig(pOut) ){
85688
+ sqlite3_result_error_toobig(pCtx);
8565385689
}
8565485690
}
8565585691
static int invokeValueDestructor(
8565685692
const void *p, /* Value to destroy */
8565785693
void (*xDel)(void*), /* The destructor */
@@ -85791,21 +85827,26 @@
8579185827
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
8579285828
setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);
8579385829
}
8579485830
#endif /* SQLITE_OMIT_UTF16 */
8579585831
SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
85832
+ Mem *pOut = pCtx->pOut;
8579685833
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
85797
- sqlite3VdbeMemCopy(pCtx->pOut, pValue);
85834
+ sqlite3VdbeMemCopy(pOut, pValue);
85835
+ sqlite3VdbeChangeEncoding(pOut, pCtx->enc);
85836
+ if( sqlite3VdbeMemTooBig(pOut) ){
85837
+ sqlite3_result_error_toobig(pCtx);
85838
+ }
8579885839
}
8579985840
SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
85800
- assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
85801
- sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n);
85841
+ sqlite3_result_zeroblob64(pCtx, n>0 ? n : 0);
8580285842
}
8580385843
SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
8580485844
Mem *pOut = pCtx->pOut;
8580585845
assert( sqlite3_mutex_held(pOut->db->mutex) );
8580685846
if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
85847
+ sqlite3_result_error_toobig(pCtx);
8580785848
return SQLITE_TOOBIG;
8580885849
}
8580985850
#ifndef SQLITE_OMIT_INCRBLOB
8581085851
sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n);
8581185852
return SQLITE_OK;
@@ -85817,12 +85858,12 @@
8581785858
pCtx->isError = errCode ? errCode : -1;
8581885859
#ifdef SQLITE_DEBUG
8581985860
if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
8582085861
#endif
8582185862
if( pCtx->pOut->flags & MEM_Null ){
85822
- sqlite3VdbeMemSetStr(pCtx->pOut, sqlite3ErrStr(errCode), -1,
85823
- SQLITE_UTF8, SQLITE_STATIC);
85863
+ setResultStrOrError(pCtx, sqlite3ErrStr(errCode), -1, SQLITE_UTF8,
85864
+ SQLITE_STATIC);
8582485865
}
8582585866
}
8582685867
8582785868
/* Force an SQLITE_TOOBIG error. */
8582885869
SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){
@@ -85891,85 +85932,94 @@
8589185932
*/
8589285933
static int sqlite3Step(Vdbe *p){
8589385934
sqlite3 *db;
8589485935
int rc;
8589585936
85896
- assert(p);
85897
- if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
85898
- /* We used to require that sqlite3_reset() be called before retrying
85899
- ** sqlite3_step() after any error or after SQLITE_DONE. But beginning
85900
- ** with version 3.7.0, we changed this so that sqlite3_reset() would
85901
- ** be called automatically instead of throwing the SQLITE_MISUSE error.
85902
- ** This "automatic-reset" change is not technically an incompatibility,
85903
- ** since any application that receives an SQLITE_MISUSE is broken by
85904
- ** definition.
85905
- **
85906
- ** Nevertheless, some published applications that were originally written
85907
- ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
85908
- ** returns, and those were broken by the automatic-reset change. As a
85909
- ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
85910
- ** legacy behavior of returning SQLITE_MISUSE for cases where the
85911
- ** previous sqlite3_step() returned something other than a SQLITE_LOCKED
85912
- ** or SQLITE_BUSY error.
85913
- */
85914
-#ifdef SQLITE_OMIT_AUTORESET
85915
- if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){
85916
- sqlite3_reset((sqlite3_stmt*)p);
85917
- }else{
85918
- return SQLITE_MISUSE_BKPT;
85919
- }
85920
-#else
85921
- sqlite3_reset((sqlite3_stmt*)p);
85922
-#endif
85923
- }
85924
-
8592585937
/* Check that malloc() has not failed. If it has, return early. */
8592685938
db = p->db;
8592785939
if( db->mallocFailed ){
8592885940
p->rc = SQLITE_NOMEM;
8592985941
return SQLITE_NOMEM_BKPT;
8593085942
}
8593185943
85932
- if( p->pc<0 && p->expired ){
85933
- p->rc = SQLITE_SCHEMA;
85934
- rc = SQLITE_ERROR;
85935
- if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
85936
- /* If this statement was prepared using saved SQL and an
85937
- ** error has occurred, then return the error code in p->rc to the
85938
- ** caller. Set the error code in the database handle to the same value.
85939
- */
85940
- rc = sqlite3VdbeTransferError(p);
85941
- }
85942
- goto end_of_step;
85943
- }
85944
- if( p->pc<0 ){
85945
- /* If there are no other statements currently running, then
85946
- ** reset the interrupt flag. This prevents a call to sqlite3_interrupt
85947
- ** from interrupting a statement that has not yet started.
85948
- */
85949
- if( db->nVdbeActive==0 ){
85950
- AtomicStore(&db->u1.isInterrupted, 0);
85951
- }
85952
-
85953
- assert( db->nVdbeWrite>0 || db->autoCommit==0
85954
- || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
85955
- );
85944
+ assert(p);
85945
+ if( p->eVdbeState!=VDBE_RUN_STATE ){
85946
+ restart_step:
85947
+ if( p->eVdbeState==VDBE_READY_STATE ){
85948
+ if( p->expired ){
85949
+ p->rc = SQLITE_SCHEMA;
85950
+ rc = SQLITE_ERROR;
85951
+ if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
85952
+ /* If this statement was prepared using saved SQL and an
85953
+ ** error has occurred, then return the error code in p->rc to the
85954
+ ** caller. Set the error code in the database handle to the same
85955
+ ** value.
85956
+ */
85957
+ rc = sqlite3VdbeTransferError(p);
85958
+ }
85959
+ goto end_of_step;
85960
+ }
85961
+
85962
+ /* If there are no other statements currently running, then
85963
+ ** reset the interrupt flag. This prevents a call to sqlite3_interrupt
85964
+ ** from interrupting a statement that has not yet started.
85965
+ */
85966
+ if( db->nVdbeActive==0 ){
85967
+ AtomicStore(&db->u1.isInterrupted, 0);
85968
+ }
85969
+
85970
+ assert( db->nVdbeWrite>0 || db->autoCommit==0
85971
+ || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
85972
+ );
8595685973
8595785974
#ifndef SQLITE_OMIT_TRACE
85958
- if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
85959
- && !db->init.busy && p->zSql ){
85960
- sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
85961
- }else{
85962
- assert( p->startTime==0 );
85963
- }
85975
+ if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
85976
+ && !db->init.busy && p->zSql ){
85977
+ sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
85978
+ }else{
85979
+ assert( p->startTime==0 );
85980
+ }
8596485981
#endif
8596585982
85966
- db->nVdbeActive++;
85967
- if( p->readOnly==0 ) db->nVdbeWrite++;
85968
- if( p->bIsReader ) db->nVdbeRead++;
85969
- p->pc = 0;
85983
+ db->nVdbeActive++;
85984
+ if( p->readOnly==0 ) db->nVdbeWrite++;
85985
+ if( p->bIsReader ) db->nVdbeRead++;
85986
+ p->pc = 0;
85987
+ p->eVdbeState = VDBE_RUN_STATE;
85988
+ }else
85989
+
85990
+ if( ALWAYS(p->eVdbeState==VDBE_HALT_STATE) ){
85991
+ /* We used to require that sqlite3_reset() be called before retrying
85992
+ ** sqlite3_step() after any error or after SQLITE_DONE. But beginning
85993
+ ** with version 3.7.0, we changed this so that sqlite3_reset() would
85994
+ ** be called automatically instead of throwing the SQLITE_MISUSE error.
85995
+ ** This "automatic-reset" change is not technically an incompatibility,
85996
+ ** since any application that receives an SQLITE_MISUSE is broken by
85997
+ ** definition.
85998
+ **
85999
+ ** Nevertheless, some published applications that were originally written
86000
+ ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
86001
+ ** returns, and those were broken by the automatic-reset change. As a
86002
+ ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
86003
+ ** legacy behavior of returning SQLITE_MISUSE for cases where the
86004
+ ** previous sqlite3_step() returned something other than a SQLITE_LOCKED
86005
+ ** or SQLITE_BUSY error.
86006
+ */
86007
+#ifdef SQLITE_OMIT_AUTORESET
86008
+ if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){
86009
+ sqlite3_reset((sqlite3_stmt*)p);
86010
+ }else{
86011
+ return SQLITE_MISUSE_BKPT;
86012
+ }
86013
+#else
86014
+ sqlite3_reset((sqlite3_stmt*)p);
86015
+#endif
86016
+ assert( p->eVdbeState==VDBE_READY_STATE );
86017
+ goto restart_step;
86018
+ }
8597086019
}
86020
+
8597186021
#ifdef SQLITE_DEBUG
8597286022
p->rcApp = SQLITE_OK;
8597386023
#endif
8597486024
#ifndef SQLITE_OMIT_EXPLAIN
8597586025
if( p->explain ){
@@ -85980,11 +86030,16 @@
8598086030
db->nVdbeExec++;
8598186031
rc = sqlite3VdbeExec(p);
8598286032
db->nVdbeExec--;
8598386033
}
8598486034
85985
- if( rc!=SQLITE_ROW ){
86035
+ if( rc==SQLITE_ROW ){
86036
+ assert( p->rc==SQLITE_OK );
86037
+ assert( db->mallocFailed==0 );
86038
+ db->errCode = SQLITE_ROW;
86039
+ return SQLITE_ROW;
86040
+ }else{
8598686041
#ifndef SQLITE_OMIT_TRACE
8598786042
/* If the statement completed successfully, invoke the profile callback */
8598886043
checkProfileCallback(db, p);
8598986044
#endif
8599086045
@@ -86672,11 +86727,11 @@
8667286727
Mem *pVar;
8667386728
if( vdbeSafetyNotNull(p) ){
8667486729
return SQLITE_MISUSE_BKPT;
8667586730
}
8667686731
sqlite3_mutex_enter(p->db->mutex);
86677
- if( p->iVdbeMagic!=VDBE_MAGIC_RUN || p->pc>=0 ){
86732
+ if( p->eVdbeState!=VDBE_READY_STATE ){
8667886733
sqlite3Error(p->db, SQLITE_MISUSE);
8667986734
sqlite3_mutex_leave(p->db->mutex);
8668086735
sqlite3_log(SQLITE_MISUSE,
8668186736
"bind on a busy prepared statement: [%s]", p->zSql);
8668286737
return SQLITE_MISUSE_BKPT;
@@ -87025,11 +87080,11 @@
8702587080
/*
8702687081
** Return true if the prepared statement is in need of being reset.
8702787082
*/
8702887083
SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
8702987084
Vdbe *v = (Vdbe*)pStmt;
87030
- return v!=0 && v->iVdbeMagic==VDBE_MAGIC_RUN && v->pc>=0;
87085
+ return v!=0 && v->eVdbeState==VDBE_RUN_STATE;
8703187086
}
8703287087
8703387088
/*
8703487089
** Return a pointer to the next prepared statement after pStmt associated
8703587090
** with database connection pDb. If pStmt is NULL, return the first
@@ -88339,11 +88394,11 @@
8833988394
#ifdef VDBE_PROFILE
8834088395
u64 start; /* CPU clock count at start of opcode */
8834188396
#endif
8834288397
/*** INSERT STACK UNION HERE ***/
8834388398
88344
- assert( p->iVdbeMagic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
88399
+ assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
8834588400
sqlite3VdbeEnter(p);
8834688401
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
8834788402
if( db->xProgress ){
8834888403
u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
8834988404
assert( 0 < db->nProgressOps );
@@ -94848,10 +94903,11 @@
9484894903
pCtx->pFunc = pOp->p4.pFunc;
9484994904
pCtx->iOp = (int)(pOp - aOp);
9485094905
pCtx->pVdbe = p;
9485194906
pCtx->skipFlag = 0;
9485294907
pCtx->isError = 0;
94908
+ pCtx->enc = encoding;
9485394909
pCtx->argc = n;
9485494910
pOp->p4type = P4_FUNCCTX;
9485594911
pOp->p4.pCtx = pCtx;
9485694912
9485794913
/* OP_AggInverse must have P1==1 and OP_AggStep must have P1==0 */
@@ -94977,13 +95033,10 @@
9497795033
sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
9497895034
goto abort_due_to_error;
9497995035
}
9498095036
sqlite3VdbeChangeEncoding(pMem, encoding);
9498195037
UPDATE_MAX_BLOBSIZE(pMem);
94982
- if( sqlite3VdbeMemTooBig(pMem) ){
94983
- goto too_big;
94984
- }
9498595038
break;
9498695039
}
9498795040
9498895041
#ifndef SQLITE_OMIT_WAL
9498995042
/* Opcode: Checkpoint P1 P2 P3 * *
@@ -95500,10 +95553,11 @@
9550095553
pVtab = pCur->uc.pVCur->pVtab;
9550195554
pModule = pVtab->pModule;
9550295555
assert( pModule->xColumn );
9550395556
memset(&sContext, 0, sizeof(sContext));
9550495557
sContext.pOut = pDest;
95558
+ sContext.enc = encoding;
9550595559
assert( pOp->p5==OPFLAG_NOCHNG || pOp->p5==0 );
9550695560
if( pOp->p5 & OPFLAG_NOCHNG ){
9550795561
sqlite3VdbeMemSetNull(pDest);
9550895562
pDest->flags = MEM_Null|MEM_Zero;
9550995563
pDest->u.nZero = 0;
@@ -95518,13 +95572,10 @@
9551895572
}
9551995573
sqlite3VdbeChangeEncoding(pDest, encoding);
9552095574
REGISTER_TRACE(pOp->p3, pDest);
9552195575
UPDATE_MAX_BLOBSIZE(pDest);
9552295576
95523
- if( sqlite3VdbeMemTooBig(pDest) ){
95524
- goto too_big;
95525
- }
9552695577
if( rc ) goto abort_due_to_error;
9552795578
break;
9552895579
}
9552995580
#endif /* SQLITE_OMIT_VIRTUALTABLE */
9553095581
@@ -95787,10 +95838,11 @@
9578795838
** reinitializes the relavant parts of the sqlite3_context object */
9578895839
pOut = &aMem[pOp->p3];
9578995840
if( pCtx->pOut != pOut ){
9579095841
pCtx->pVdbe = p;
9579195842
pCtx->pOut = pOut;
95843
+ pCtx->enc = encoding;
9579295844
for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
9579395845
}
9579495846
assert( pCtx->pVdbe==p );
9579595847
9579695848
memAboutToChange(p, pOut);
@@ -95813,15 +95865,14 @@
9581395865
sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
9581495866
pCtx->isError = 0;
9581595867
if( rc ) goto abort_due_to_error;
9581695868
}
9581795869
95818
- /* Copy the result of the function into register P3 */
95819
- if( pOut->flags & (MEM_Str|MEM_Blob) ){
95820
- sqlite3VdbeChangeEncoding(pOut, encoding);
95821
- if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
95822
- }
95870
+ assert( (pOut->flags&MEM_Str)==0
95871
+ || pOut->enc==encoding
95872
+ || db->mallocFailed );
95873
+ assert( !sqlite3VdbeMemTooBig(pOut) );
9582395874
9582495875
REGISTER_TRACE(pOp->p3, pOut);
9582595876
UPDATE_MAX_BLOBSIZE(pOut);
9582695877
break;
9582795878
}
@@ -114347,11 +114398,13 @@
114347114398
&& (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
114348114399
){
114349114400
int iDb, i;
114350114401
assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
114351114402
sqlite3VdbeJumpHere(v, 0);
114352
- for(iDb=0; iDb<db->nDb; iDb++){
114403
+ assert( db->nDb>0 );
114404
+ iDb = 0;
114405
+ do{
114353114406
Schema *pSchema;
114354114407
if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
114355114408
sqlite3VdbeUsesBtree(v, iDb);
114356114409
pSchema = db->aDb[iDb].pSchema;
114357114410
sqlite3VdbeAddOp4Int(v,
@@ -114362,11 +114415,11 @@
114362114415
pSchema->iGeneration /* P4 */
114363114416
);
114364114417
if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
114365114418
VdbeComment((v,
114366114419
"usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
114367
- }
114420
+ }while( ++iDb<db->nDb );
114368114421
#ifndef SQLITE_OMIT_VIRTUALTABLE
114369114422
for(i=0; i<pParse->nVtabLock; i++){
114370114423
char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);
114371114424
sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
114372114425
}
@@ -131503,11 +131556,11 @@
131503131556
**
131504131557
** Do N steps of incremental vacuuming on a database.
131505131558
*/
131506131559
#ifndef SQLITE_OMIT_AUTOVACUUM
131507131560
case PragTyp_INCREMENTAL_VACUUM: {
131508
- int iLimit, addr;
131561
+ int iLimit = 0, addr;
131509131562
if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
131510131563
iLimit = 0x7fffffff;
131511131564
}
131512131565
sqlite3BeginWriteOperation(pParse, 0, iDb);
131513131566
sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1);
@@ -133807,11 +133860,11 @@
133807133860
if( db->mallocFailed ){
133808133861
rc = SQLITE_NOMEM_BKPT;
133809133862
sqlite3ResetAllSchemasOfConnection(db);
133810133863
pDb = &db->aDb[iDb];
133811133864
}else
133812
- if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){
133865
+ if( rc==SQLITE_OK || ((db->flags&SQLITE_NoSchemaError) && rc!=SQLITE_NOMEM)){
133813133866
/* Hack: If the SQLITE_NoSchemaError flag is set, then consider
133814133867
** the schema loaded, even if errors (other than OOM) occurred. In
133815133868
** this situation the current sqlite3_prepare() operation will fail,
133816133869
** but the following one will attempt to compile the supplied statement
133817133870
** against whatever subset of the schema was loaded before the error
@@ -154862,12 +154915,21 @@
154862154915
if( j<0 ){
154863154916
if( pLoop->maskSelf==pTerm->prereqAll ){
154864154917
/* If there are extra terms in the WHERE clause not used by an index
154865154918
** that depend only on the table being scanned, and that will tend to
154866154919
** cause many rows to be omitted, then mark that table as
154867
- ** "self-culling". */
154868
- pLoop->wsFlags |= WHERE_SELFCULL;
154920
+ ** "self-culling".
154921
+ **
154922
+ ** 2022-03-24: Self-culling only applies if either the extra terms
154923
+ ** are straight comparison operators that are non-true with NULL
154924
+ ** operand, or if the loop is not a LEFT JOIN.
154925
+ */
154926
+ if( (pTerm->eOperator & 0x3f)!=0
154927
+ || (pWC->pWInfo->pTabList->a[pLoop->iTab].fg.jointype & JT_LEFT)==0
154928
+ ){
154929
+ pLoop->wsFlags |= WHERE_SELFCULL;
154930
+ }
154869154931
}
154870154932
if( pTerm->truthProb<=0 ){
154871154933
/* If a truth probability is specified using the likelihood() hints,
154872154934
** then use the probability provided by the application. */
154873154935
pLoop->nOut += pTerm->truthProb;
@@ -168198,11 +168260,11 @@
168198168260
sqlite3DeleteTable(db, pParse->pNewTable);
168199168261
}
168200168262
if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){
168201168263
sqlite3DeleteTrigger(db, pParse->pNewTrigger);
168202168264
}
168203
- sqlite3DbFree(db, pParse->pVList);
168265
+ if( pParse->pVList ) sqlite3DbFreeNN(db, pParse->pVList);
168204168266
db->pParse = pParentParse;
168205168267
assert( nErr==0 || pParse->rc!=SQLITE_OK );
168206168268
return nErr;
168207168269
}
168208168270
@@ -234692,11 +234754,11 @@
234692234754
int nArg, /* Number of args */
234693234755
sqlite3_value **apUnused /* Function arguments */
234694234756
){
234695234757
assert( nArg==0 );
234696234758
UNUSED_PARAM2(nArg, apUnused);
234697
- sqlite3_result_text(pCtx, "fts5: 2022-03-14 20:31:57 387ab17b8a0a4b87903aab52abc7da79098b882aff2ab687a554d5794e9d183e", -1, SQLITE_TRANSIENT);
234759
+ sqlite3_result_text(pCtx, "fts5: 2022-03-31 11:12:56 f2d9262e4427ab37ba26c004fc7a4790c86c1856d695a6b4ec3e72732ea54c09", -1, SQLITE_TRANSIENT);
234698234760
}
234699234761
234700234762
/*
234701234763
** Return true if zName is the extension on one of the shadow tables used
234702234764
** by this module.
234703234765
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.39.0"
456 #define SQLITE_VERSION_NUMBER 3039000
457 #define SQLITE_SOURCE_ID "2022-03-23 10:04:52 43143ad131f17734fd2eff849e0a1bc2e26daf6a28c7e07d697d38732e6af5fc"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -22410,10 +22410,11 @@
22410 FuncDef *pFunc; /* Pointer to function information */
22411 Mem *pMem; /* Memory cell used to store aggregate context */
22412 Vdbe *pVdbe; /* The VM that owns this context */
22413 int iOp; /* Instruction number of OP_Function */
22414 int isError; /* Error code returned by the function. */
 
22415 u8 skipFlag; /* Skip accumulator loading if true */
22416 u8 argc; /* Number of arguments */
22417 sqlite3_value *argv[1]; /* Argument set */
22418 };
22419
@@ -22458,11 +22459,10 @@
22458 struct Vdbe {
22459 sqlite3 *db; /* The database connection that owns this statement */
22460 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
22461 Parse *pParse; /* Parsing context used to create this Vdbe */
22462 ynVar nVar; /* Number of entries in aVar[] */
22463 u32 iVdbeMagic; /* Magic number defining state of the SQL statement */
22464 int nMem; /* Number of memory locations currently allocated */
22465 int nCursor; /* Number of slots in apCsr[] */
22466 u32 cacheCtr; /* VdbeCursor row cache generation counter */
22467 int pc; /* The program counter */
22468 int rc; /* Value to return */
@@ -22497,10 +22497,11 @@
22497 u16 nResColumn; /* Number of columns in one row of the result set */
22498 u8 errorAction; /* Recovery action to do in case of an error */
22499 u8 minWriteFileFormat; /* Minimum file format for writable database files */
22500 u8 prepFlags; /* SQLITE_PREPARE_* flags */
22501 u8 doingRerun; /* True if rerunning after an auto-reprepare */
 
22502 bft expired:2; /* 1: recompile VM immediately 2: when convenient */
22503 bft explain:2; /* True if EXPLAIN present on SQL command */
22504 bft changeCntOn:1; /* True to update the change-counter */
22505 bft runOnlyOnce:1; /* Automatically expire on reset */
22506 bft usesStmtJournal:1; /* True if uses a statement journal */
@@ -22527,17 +22528,16 @@
22527 ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
22528 #endif
22529 };
22530
22531 /*
22532 ** The following are allowed values for Vdbe.magic
22533 */
22534 #define VDBE_MAGIC_INIT 0x16bceaa5 /* Building a VDBE program */
22535 #define VDBE_MAGIC_RUN 0x2df20da3 /* VDBE is ready to execute */
22536 #define VDBE_MAGIC_HALT 0x319c2973 /* VDBE has completed execution */
22537 #define VDBE_MAGIC_RESET 0x48fa9f76 /* Reset and ready to run again */
22538 #define VDBE_MAGIC_DEAD 0x5606c3c8 /* The VDBE has been deallocated */
22539
22540 /*
22541 ** Structure used to store the context required by the
22542 ** sqlite3_preupdate_*() API functions.
22543 */
@@ -27002,12 +27002,17 @@
27002 ** 32-bit signed integer. Hence the largest allocation is 0x40000000
27003 ** or 1073741824 bytes.
27004 */
27005 static int memsys5Roundup(int n){
27006 int iFullSz;
27007 if( n > 0x40000000 ) return 0;
27008 for(iFullSz=mem5.szAtom; iFullSz<n; iFullSz *= 2);
 
 
 
 
 
27009 return iFullSz;
27010 }
27011
27012 /*
27013 ** Return the ceiling of the logarithm base 2 of iValue.
@@ -74949,11 +74954,10 @@
74949 ** balance_deeper()
74950 ** balance_nonroot()
74951 */
74952 static int balance(BtCursor *pCur){
74953 int rc = SQLITE_OK;
74954 const int nMin = pCur->pBt->usableSize * 2 / 3;
74955 u8 aBalanceQuickSpace[13];
74956 u8 *pFree = 0;
74957
74958 VVA_ONLY( int balance_quick_called = 0 );
74959 VVA_ONLY( int balance_deeper_called = 0 );
@@ -74961,11 +74965,15 @@
74961 do {
74962 int iPage;
74963 MemPage *pPage = pCur->pPage;
74964
74965 if( NEVER(pPage->nFree<0) && btreeComputeFreeSpace(pPage) ) break;
74966 if( pPage->nOverflow==0 && pPage->nFree<=nMin ){
 
 
 
 
74967 break;
74968 }else if( (iPage = pCur->iPage)==0 ){
74969 if( pPage->nOverflow && (rc = anotherValidCursor(pCur))==SQLITE_OK ){
74970 /* The root page of the b-tree is overfull. In this case call the
74971 ** balance_deeper() function to create a new child for the root-page
@@ -75775,11 +75783,19 @@
75775 ** on the leaf node first. If the balance proceeds far enough up the
75776 ** tree that we can be sure that any problem in the internal node has
75777 ** been corrected, so be it. Otherwise, after balancing the leaf node,
75778 ** walk the cursor up the tree to the internal node and balance it as
75779 ** well. */
75780 rc = balance(pCur);
 
 
 
 
 
 
 
 
75781 if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
75782 releasePageNotNull(pCur->pPage);
75783 pCur->iPage--;
75784 while( pCur->iPage>iCellDepth ){
75785 releasePage(pCur->apPage[pCur->iPage--]);
@@ -78270,11 +78286,15 @@
78270 #endif
78271 assert( pMem!=0 );
78272 assert( !sqlite3VdbeMemIsRowSet(pMem) );
78273 assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
78274 || desiredEnc==SQLITE_UTF16BE );
78275 if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
 
 
 
 
78276 return SQLITE_OK;
78277 }
78278 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
78279 #ifdef SQLITE_OMIT_UTF16
78280 return SQLITE_ERROR;
@@ -78529,10 +78549,11 @@
78529 t.flags = MEM_Null;
78530 t.db = pMem->db;
78531 ctx.pOut = &t;
78532 ctx.pMem = pMem;
78533 ctx.pFunc = pFunc;
 
78534 pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */
78535 assert( (pMem->flags & MEM_Dyn)==0 );
78536 if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
78537 memcpy(pMem, &t, sizeof(t));
78538 return ctx.isError;
@@ -78556,10 +78577,11 @@
78556 memset(&ctx, 0, sizeof(ctx));
78557 sqlite3VdbeMemSetNull(pOut);
78558 ctx.pOut = pOut;
78559 ctx.pMem = pAccum;
78560 ctx.pFunc = pFunc;
 
78561 pFunc->xValue(&ctx);
78562 return ctx.isError;
78563 }
78564 #endif /* SQLITE_OMIT_WINDOWFUNC */
78565
@@ -79173,10 +79195,17 @@
79173 ** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH
79174 ** size limit) then no memory allocation occurs. If the string can be
79175 ** stored without allocating memory, then it is. If a memory allocation
79176 ** is required to store the string, then value of pMem is unchanged. In
79177 ** either case, SQLITE_TOOBIG is returned.
 
 
 
 
 
 
 
79178 */
79179 SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
79180 Mem *pMem, /* Memory cell to set to string value */
79181 const char *z, /* String pointer */
79182 i64 n, /* Bytes in string, or negative */
@@ -79183,15 +79212,16 @@
79183 u8 enc, /* Encoding of z. 0 for BLOBs */
79184 void (*xDel)(void*) /* Destructor function */
79185 ){
79186 i64 nByte = n; /* New value for pMem->n */
79187 int iLimit; /* Maximum allowed string or blob size */
79188 u16 flags = 0; /* New value for pMem->flags */
79189
79190 assert( pMem!=0 );
79191 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
79192 assert( !sqlite3VdbeMemIsRowSet(pMem) );
 
79193
79194 /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
79195 if( !z ){
79196 sqlite3VdbeMemSetNull(pMem);
79197 return SQLITE_OK;
@@ -79200,19 +79230,34 @@
79200 if( pMem->db ){
79201 iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];
79202 }else{
79203 iLimit = SQLITE_MAX_LENGTH;
79204 }
79205 flags = (enc==0?MEM_Blob:MEM_Str);
79206 if( nByte<0 ){
79207 assert( enc!=0 );
79208 if( enc==SQLITE_UTF8 ){
79209 nByte = strlen(z);
79210 }else{
79211 for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
79212 }
79213 flags |= MEM_Term;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79214 }
79215
79216 /* The following block sets the new values of Mem.z and Mem.xDel. It
79217 ** also sets a flag in local variable "flags" to indicate the memory
79218 ** management (one of MEM_Dyn or MEM_Static).
@@ -79220,13 +79265,10 @@
79220 if( xDel==SQLITE_TRANSIENT ){
79221 i64 nAlloc = nByte;
79222 if( flags&MEM_Term ){
79223 nAlloc += (enc==SQLITE_UTF8?1:2);
79224 }
79225 if( nByte>iLimit ){
79226 return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
79227 }
79228 testcase( nAlloc==0 );
79229 testcase( nAlloc==31 );
79230 testcase( nAlloc==32 );
79231 if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){
79232 return SQLITE_NOMEM_BKPT;
@@ -79244,30 +79286,18 @@
79244 }
79245 }
79246
79247 pMem->n = (int)(nByte & 0x7fffffff);
79248 pMem->flags = flags;
79249 if( enc ){
79250 pMem->enc = enc;
79251 #ifdef SQLITE_ENABLE_SESSION
79252 }else if( pMem->db==0 ){
79253 pMem->enc = SQLITE_UTF8;
79254 #endif
79255 }else{
79256 assert( pMem->db!=0 );
79257 pMem->enc = ENC(pMem->db);
79258 }
79259
79260 #ifndef SQLITE_OMIT_UTF16
79261 if( enc>SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
79262 return SQLITE_NOMEM_BKPT;
79263 }
79264 #endif
79265
79266 if( nByte>iLimit ){
79267 return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
79268 }
79269
79270 return SQLITE_OK;
79271 }
79272
79273 /*
@@ -79545,10 +79575,11 @@
79545
79546 assert( pCtx->pParse->rc==SQLITE_OK );
79547 memset(&ctx, 0, sizeof(ctx));
79548 ctx.pOut = pVal;
79549 ctx.pFunc = pFunc;
 
79550 pFunc->xSFunc(&ctx, nVal, apVal);
79551 if( ctx.isError ){
79552 rc = ctx.isError;
79553 sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
79554 }else{
@@ -80055,11 +80086,11 @@
80055 db->pVdbe->pPrev = p;
80056 }
80057 p->pNext = db->pVdbe;
80058 p->pPrev = 0;
80059 db->pVdbe = p;
80060 p->iVdbeMagic = VDBE_MAGIC_INIT;
80061 p->pParse = pParse;
80062 pParse->pVdbe = p;
80063 assert( pParse->aLabel==0 );
80064 assert( pParse->nLabel==0 );
80065 assert( p->nOpAlloc==0 );
@@ -80256,11 +80287,11 @@
80256 SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
80257 int i;
80258 VdbeOp *pOp;
80259
80260 i = p->nOp;
80261 assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
80262 assert( op>=0 && op<0xff );
80263 if( p->nOpAlloc<=i ){
80264 return growOp3(p, op, p1, p2, p3);
80265 }
80266 assert( p->aOp!=0 );
@@ -80588,11 +80619,11 @@
80588 }
80589 }
80590 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
80591 Parse *p = v->pParse;
80592 int j = ADDR(x);
80593 assert( v->iVdbeMagic==VDBE_MAGIC_INIT );
80594 assert( j<-p->nLabel );
80595 assert( j>=0 );
80596 #ifdef SQLITE_DEBUG
80597 if( p->db->flags & SQLITE_VdbeAddopTrace ){
80598 printf("RESOLVE LABEL %d to %d\n", x, v->nOp);
@@ -80719,10 +80750,12 @@
80719 int hasCreateTable = 0;
80720 int hasCreateIndex = 0;
80721 int hasInitCoroutine = 0;
80722 Op *pOp;
80723 VdbeOpIter sIter;
 
 
80724 memset(&sIter, 0, sizeof(sIter));
80725 sIter.v = v;
80726
80727 while( (pOp = opIterNext(&sIter))!=0 ){
80728 int opcode = pOp->opcode;
@@ -80883,22 +80916,24 @@
80883 assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0);
80884 }
80885 if( pOp==p->aOp ) break;
80886 pOp--;
80887 }
80888 sqlite3DbFree(p->db, pParse->aLabel);
80889 pParse->aLabel = 0;
 
 
80890 pParse->nLabel = 0;
80891 *pMaxFuncArgs = nMaxArgs;
80892 assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
80893 }
80894
80895 /*
80896 ** Return the address of the next instruction to be inserted.
80897 */
80898 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){
80899 assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
80900 return p->nOp;
80901 }
80902
80903 /*
80904 ** Verify that at least N opcode slots are available in p without
@@ -80979,11 +81014,11 @@
80979 int iLineno /* Source-file line number of first opcode */
80980 ){
80981 int i;
80982 VdbeOp *pOut, *pFirst;
80983 assert( nOp>0 );
80984 assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
80985 if( p->nOp + nOp > p->nOpAlloc && growOpArray(p, nOp) ){
80986 return 0;
80987 }
80988 pFirst = pOut = &p->aOp[p->nOp];
80989 for(i=0; i<nOp; i++, aOp++, pOut++){
@@ -81170,17 +81205,20 @@
81170 ** Free the space allocated for aOp and any p4 values allocated for the
81171 ** opcodes contained within. If aOp is not NULL it is assumed to contain
81172 ** nOp entries.
81173 */
81174 static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
 
81175 if( aOp ){
81176 Op *pOp;
81177 for(pOp=&aOp[nOp-1]; pOp>=aOp; pOp--){
81178 if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
81179 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
81180 sqlite3DbFree(db, pOp->zComment);
81181 #endif
 
 
81182 }
81183 sqlite3DbFreeNN(db, aOp);
81184 }
81185 }
81186
@@ -81302,11 +81340,11 @@
81302 SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
81303 Op *pOp;
81304 sqlite3 *db;
81305 assert( p!=0 );
81306 db = p->db;
81307 assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
81308 assert( p->aOp!=0 || db->mallocFailed );
81309 if( db->mallocFailed ){
81310 if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
81311 return;
81312 }
@@ -81430,11 +81468,11 @@
81430 */
81431 SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
81432 /* C89 specifies that the constant "dummy" will be initialized to all
81433 ** zeros, which is correct. MSVC generates a warning, nevertheless. */
81434 static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
81435 assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
81436 if( addr<0 ){
81437 addr = p->nOp - 1;
81438 }
81439 assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
81440 if( p->db->mallocFailed ){
@@ -82132,11 +82170,11 @@
82132 int bListSubprogs = (p->explain==1 || (db->flags & SQLITE_TriggerEQP)!=0);
82133 Op *aOp; /* Array of opcodes */
82134 Op *pOp; /* Current opcode */
82135
82136 assert( p->explain );
82137 assert( p->iVdbeMagic==VDBE_MAGIC_RUN );
82138 assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );
82139
82140 /* Even though this opcode does not use dynamic strings for
82141 ** the result, result columns may become dynamic if the user calls
82142 ** sqlite3_column_text16(), causing a translation to UTF-16 encoding.
@@ -82312,18 +82350,19 @@
82312 SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
82313 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
82314 int i;
82315 #endif
82316 assert( p!=0 );
82317 assert( p->iVdbeMagic==VDBE_MAGIC_INIT || p->iVdbeMagic==VDBE_MAGIC_RESET );
 
 
82318
82319 /* There should be at least one opcode.
82320 */
82321 assert( p->nOp>0 );
82322
82323 /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */
82324 p->iVdbeMagic = VDBE_MAGIC_RUN;
82325
82326 #ifdef SQLITE_DEBUG
82327 for(i=0; i<p->nMem; i++){
82328 assert( p->aMem[i].db==p->db );
82329 }
@@ -82375,11 +82414,11 @@
82375 struct ReusableSpace x; /* Reusable bulk memory */
82376
82377 assert( p!=0 );
82378 assert( p->nOp>0 );
82379 assert( pParse!=0 );
82380 assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
82381 assert( pParse==p->pParse );
82382 p->pVList = pParse->pVList;
82383 pParse->pVList = 0;
82384 db = p->db;
82385 assert( db->mallocFailed==0 );
@@ -82516,18 +82555,16 @@
82516
82517 /*
82518 ** Close all cursors in the current frame.
82519 */
82520 static void closeCursorsInFrame(Vdbe *p){
82521 if( p->apCsr ){
82522 int i;
82523 for(i=0; i<p->nCursor; i++){
82524 VdbeCursor *pC = p->apCsr[i];
82525 if( pC ){
82526 sqlite3VdbeFreeCursor(p, pC);
82527 p->apCsr[i] = 0;
82528 }
82529 }
82530 }
82531 }
82532
82533 /*
@@ -82572,13 +82609,11 @@
82572 p->pFrame = 0;
82573 p->nFrame = 0;
82574 }
82575 assert( p->nFrame==0 );
82576 closeCursorsInFrame(p);
82577 if( p->aMem ){
82578 releaseMemArray(p->aMem, p->nMem);
82579 }
82580 while( p->pDelFrame ){
82581 VdbeFrame *pDel = p->pDelFrame;
82582 p->pDelFrame = pDel->pParent;
82583 sqlite3VdbeFrameDelete(pDel);
82584 }
@@ -83014,10 +83049,11 @@
83014 || (!deferred && p->nFkConstraint>0)
83015 ){
83016 p->rc = SQLITE_CONSTRAINT_FOREIGNKEY;
83017 p->errorAction = OE_Abort;
83018 sqlite3VdbeError(p, "FOREIGN KEY constraint failed");
 
83019 return SQLITE_CONSTRAINT_FOREIGNKEY;
83020 }
83021 return SQLITE_OK;
83022 }
83023 #endif
@@ -83053,11 +83089,11 @@
83053 ** Then the internal cache might have been left in an inconsistent
83054 ** state. We need to rollback the statement transaction, if there is
83055 ** one, or the complete transaction if there is no statement transaction.
83056 */
83057
83058 if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
83059 return SQLITE_OK;
83060 }
83061 if( db->mallocFailed ){
83062 p->rc = SQLITE_NOMEM_BKPT;
83063 }
@@ -83064,11 +83100,11 @@
83064 closeAllCursors(p);
83065 checkActiveVdbeCnt(db);
83066
83067 /* No commit or rollback needed if the program never started or if the
83068 ** SQL statement does not read or write a database file. */
83069 if( p->pc>=0 && p->bIsReader ){
83070 int mrc; /* Primary error code from p->rc */
83071 int eStatementOp = 0;
83072 int isSpecialError; /* Set to true if a 'special' error */
83073
83074 /* Lock all btrees used by the statement */
@@ -83212,19 +83248,17 @@
83212 /* Release the locks */
83213 sqlite3VdbeLeave(p);
83214 }
83215
83216 /* We have successfully halted and closed the VM. Record this fact. */
83217 if( p->pc>=0 ){
83218 db->nVdbeActive--;
83219 if( !p->readOnly ) db->nVdbeWrite--;
83220 if( p->bIsReader ) db->nVdbeRead--;
83221 assert( db->nVdbeActive>=db->nVdbeRead );
83222 assert( db->nVdbeRead>=db->nVdbeWrite );
83223 assert( db->nVdbeWrite>=0 );
83224 }
83225 p->iVdbeMagic = VDBE_MAGIC_HALT;
83226 checkActiveVdbeCnt(db);
83227 if( db->mallocFailed ){
83228 p->rc = SQLITE_NOMEM_BKPT;
83229 }
83230
@@ -83302,12 +83336,12 @@
83302 **
83303 ** After this routine is run, the VDBE should be ready to be executed
83304 ** again.
83305 **
83306 ** To look at it another way, this routine resets the state of the
83307 ** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to
83308 ** VDBE_MAGIC_INIT.
83309 */
83310 SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
83311 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
83312 int i;
83313 #endif
@@ -83332,16 +83366,10 @@
83332 sqlite3VdbeTransferError(p);
83333 }else{
83334 db->errCode = p->rc;
83335 }
83336 if( p->runOnlyOnce ) p->expired = 1;
83337 }else if( p->rc && p->expired ){
83338 /* The expired flag was set on the VDBE before the first call
83339 ** to sqlite3_step(). For consistency (since sqlite3_step() was
83340 ** called), set the database error in this case as well.
83341 */
83342 sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg);
83343 }
83344
83345 /* Reset register contents and reclaim error message memory.
83346 */
83347 #ifdef SQLITE_DEBUG
@@ -83394,21 +83422,23 @@
83394 }
83395 fclose(out);
83396 }
83397 }
83398 #endif
83399 p->iVdbeMagic = VDBE_MAGIC_RESET;
83400 return p->rc & db->errMask;
83401 }
83402
83403 /*
83404 ** Clean up and delete a VDBE after execution. Return an integer which is
83405 ** the result code. Write any error message text into *pzErrMsg.
83406 */
83407 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){
83408 int rc = SQLITE_OK;
83409 if( p->iVdbeMagic==VDBE_MAGIC_RUN || p->iVdbeMagic==VDBE_MAGIC_HALT ){
 
 
 
83410 rc = sqlite3VdbeReset(p);
83411 assert( (rc & p->db->errMask)==rc );
83412 }
83413 sqlite3VdbeDelete(p);
83414 return rc;
@@ -83459,23 +83489,25 @@
83459 ** the database connection and frees the object itself.
83460 */
83461 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
83462 SubProgram *pSub, *pNext;
83463 assert( p->db==0 || p->db==db );
83464 releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
 
 
 
83465 for(pSub=p->pProgram; pSub; pSub=pNext){
83466 pNext = pSub->pNext;
83467 vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
83468 sqlite3DbFree(db, pSub);
83469 }
83470 if( p->iVdbeMagic!=VDBE_MAGIC_INIT ){
83471 releaseMemArray(p->aVar, p->nVar);
83472 sqlite3DbFree(db, p->pVList);
83473 sqlite3DbFree(db, p->pFree);
83474 }
83475 vdbeFreeOpArray(db, p->aOp, p->nOp);
83476 sqlite3DbFree(db, p->aColName);
83477 sqlite3DbFree(db, p->zSql);
83478 #ifdef SQLITE_ENABLE_NORMALIZE
83479 sqlite3DbFree(db, p->zNormSql);
83480 {
83481 DblquoteStr *pThis, *pNext;
@@ -83513,12 +83545,10 @@
83513 db->pVdbe = p->pNext;
83514 }
83515 if( p->pNext ){
83516 p->pNext->pPrev = p->pPrev;
83517 }
83518 p->iVdbeMagic = VDBE_MAGIC_DEAD;
83519 p->db = 0;
83520 sqlite3DbFreeNN(db, p);
83521 }
83522
83523 /*
83524 ** The cursor "p" has a pending seek operation that has not yet been
@@ -85638,20 +85668,26 @@
85638 const char *z, /* String pointer */
85639 int n, /* Bytes in string, or negative */
85640 u8 enc, /* Encoding of z. 0 for BLOBs */
85641 void (*xDel)(void*) /* Destructor function */
85642 ){
85643 int rc = sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel);
 
85644 if( rc ){
85645 if( rc==SQLITE_TOOBIG ){
85646 sqlite3_result_error_toobig(pCtx);
85647 }else{
85648 /* The only errors possible from sqlite3VdbeMemSetStr are
85649 ** SQLITE_TOOBIG and SQLITE_NOMEM */
85650 assert( rc==SQLITE_NOMEM );
85651 sqlite3_result_error_nomem(pCtx);
85652 }
 
 
 
 
 
85653 }
85654 }
85655 static int invokeValueDestructor(
85656 const void *p, /* Value to destroy */
85657 void (*xDel)(void*), /* The destructor */
@@ -85791,21 +85827,26 @@
85791 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
85792 setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);
85793 }
85794 #endif /* SQLITE_OMIT_UTF16 */
85795 SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
 
85796 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
85797 sqlite3VdbeMemCopy(pCtx->pOut, pValue);
 
 
 
 
85798 }
85799 SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
85800 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
85801 sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n);
85802 }
85803 SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
85804 Mem *pOut = pCtx->pOut;
85805 assert( sqlite3_mutex_held(pOut->db->mutex) );
85806 if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
 
85807 return SQLITE_TOOBIG;
85808 }
85809 #ifndef SQLITE_OMIT_INCRBLOB
85810 sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n);
85811 return SQLITE_OK;
@@ -85817,12 +85858,12 @@
85817 pCtx->isError = errCode ? errCode : -1;
85818 #ifdef SQLITE_DEBUG
85819 if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
85820 #endif
85821 if( pCtx->pOut->flags & MEM_Null ){
85822 sqlite3VdbeMemSetStr(pCtx->pOut, sqlite3ErrStr(errCode), -1,
85823 SQLITE_UTF8, SQLITE_STATIC);
85824 }
85825 }
85826
85827 /* Force an SQLITE_TOOBIG error. */
85828 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){
@@ -85891,85 +85932,94 @@
85891 */
85892 static int sqlite3Step(Vdbe *p){
85893 sqlite3 *db;
85894 int rc;
85895
85896 assert(p);
85897 if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
85898 /* We used to require that sqlite3_reset() be called before retrying
85899 ** sqlite3_step() after any error or after SQLITE_DONE. But beginning
85900 ** with version 3.7.0, we changed this so that sqlite3_reset() would
85901 ** be called automatically instead of throwing the SQLITE_MISUSE error.
85902 ** This "automatic-reset" change is not technically an incompatibility,
85903 ** since any application that receives an SQLITE_MISUSE is broken by
85904 ** definition.
85905 **
85906 ** Nevertheless, some published applications that were originally written
85907 ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
85908 ** returns, and those were broken by the automatic-reset change. As a
85909 ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
85910 ** legacy behavior of returning SQLITE_MISUSE for cases where the
85911 ** previous sqlite3_step() returned something other than a SQLITE_LOCKED
85912 ** or SQLITE_BUSY error.
85913 */
85914 #ifdef SQLITE_OMIT_AUTORESET
85915 if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){
85916 sqlite3_reset((sqlite3_stmt*)p);
85917 }else{
85918 return SQLITE_MISUSE_BKPT;
85919 }
85920 #else
85921 sqlite3_reset((sqlite3_stmt*)p);
85922 #endif
85923 }
85924
85925 /* Check that malloc() has not failed. If it has, return early. */
85926 db = p->db;
85927 if( db->mallocFailed ){
85928 p->rc = SQLITE_NOMEM;
85929 return SQLITE_NOMEM_BKPT;
85930 }
85931
85932 if( p->pc<0 && p->expired ){
85933 p->rc = SQLITE_SCHEMA;
85934 rc = SQLITE_ERROR;
85935 if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
85936 /* If this statement was prepared using saved SQL and an
85937 ** error has occurred, then return the error code in p->rc to the
85938 ** caller. Set the error code in the database handle to the same value.
85939 */
85940 rc = sqlite3VdbeTransferError(p);
85941 }
85942 goto end_of_step;
85943 }
85944 if( p->pc<0 ){
85945 /* If there are no other statements currently running, then
85946 ** reset the interrupt flag. This prevents a call to sqlite3_interrupt
85947 ** from interrupting a statement that has not yet started.
85948 */
85949 if( db->nVdbeActive==0 ){
85950 AtomicStore(&db->u1.isInterrupted, 0);
85951 }
85952
85953 assert( db->nVdbeWrite>0 || db->autoCommit==0
85954 || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
85955 );
 
 
 
 
 
85956
85957 #ifndef SQLITE_OMIT_TRACE
85958 if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
85959 && !db->init.busy && p->zSql ){
85960 sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
85961 }else{
85962 assert( p->startTime==0 );
85963 }
85964 #endif
85965
85966 db->nVdbeActive++;
85967 if( p->readOnly==0 ) db->nVdbeWrite++;
85968 if( p->bIsReader ) db->nVdbeRead++;
85969 p->pc = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85970 }
 
85971 #ifdef SQLITE_DEBUG
85972 p->rcApp = SQLITE_OK;
85973 #endif
85974 #ifndef SQLITE_OMIT_EXPLAIN
85975 if( p->explain ){
@@ -85980,11 +86030,16 @@
85980 db->nVdbeExec++;
85981 rc = sqlite3VdbeExec(p);
85982 db->nVdbeExec--;
85983 }
85984
85985 if( rc!=SQLITE_ROW ){
 
 
 
 
 
85986 #ifndef SQLITE_OMIT_TRACE
85987 /* If the statement completed successfully, invoke the profile callback */
85988 checkProfileCallback(db, p);
85989 #endif
85990
@@ -86672,11 +86727,11 @@
86672 Mem *pVar;
86673 if( vdbeSafetyNotNull(p) ){
86674 return SQLITE_MISUSE_BKPT;
86675 }
86676 sqlite3_mutex_enter(p->db->mutex);
86677 if( p->iVdbeMagic!=VDBE_MAGIC_RUN || p->pc>=0 ){
86678 sqlite3Error(p->db, SQLITE_MISUSE);
86679 sqlite3_mutex_leave(p->db->mutex);
86680 sqlite3_log(SQLITE_MISUSE,
86681 "bind on a busy prepared statement: [%s]", p->zSql);
86682 return SQLITE_MISUSE_BKPT;
@@ -87025,11 +87080,11 @@
87025 /*
87026 ** Return true if the prepared statement is in need of being reset.
87027 */
87028 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
87029 Vdbe *v = (Vdbe*)pStmt;
87030 return v!=0 && v->iVdbeMagic==VDBE_MAGIC_RUN && v->pc>=0;
87031 }
87032
87033 /*
87034 ** Return a pointer to the next prepared statement after pStmt associated
87035 ** with database connection pDb. If pStmt is NULL, return the first
@@ -88339,11 +88394,11 @@
88339 #ifdef VDBE_PROFILE
88340 u64 start; /* CPU clock count at start of opcode */
88341 #endif
88342 /*** INSERT STACK UNION HERE ***/
88343
88344 assert( p->iVdbeMagic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
88345 sqlite3VdbeEnter(p);
88346 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
88347 if( db->xProgress ){
88348 u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
88349 assert( 0 < db->nProgressOps );
@@ -94848,10 +94903,11 @@
94848 pCtx->pFunc = pOp->p4.pFunc;
94849 pCtx->iOp = (int)(pOp - aOp);
94850 pCtx->pVdbe = p;
94851 pCtx->skipFlag = 0;
94852 pCtx->isError = 0;
 
94853 pCtx->argc = n;
94854 pOp->p4type = P4_FUNCCTX;
94855 pOp->p4.pCtx = pCtx;
94856
94857 /* OP_AggInverse must have P1==1 and OP_AggStep must have P1==0 */
@@ -94977,13 +95033,10 @@
94977 sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
94978 goto abort_due_to_error;
94979 }
94980 sqlite3VdbeChangeEncoding(pMem, encoding);
94981 UPDATE_MAX_BLOBSIZE(pMem);
94982 if( sqlite3VdbeMemTooBig(pMem) ){
94983 goto too_big;
94984 }
94985 break;
94986 }
94987
94988 #ifndef SQLITE_OMIT_WAL
94989 /* Opcode: Checkpoint P1 P2 P3 * *
@@ -95500,10 +95553,11 @@
95500 pVtab = pCur->uc.pVCur->pVtab;
95501 pModule = pVtab->pModule;
95502 assert( pModule->xColumn );
95503 memset(&sContext, 0, sizeof(sContext));
95504 sContext.pOut = pDest;
 
95505 assert( pOp->p5==OPFLAG_NOCHNG || pOp->p5==0 );
95506 if( pOp->p5 & OPFLAG_NOCHNG ){
95507 sqlite3VdbeMemSetNull(pDest);
95508 pDest->flags = MEM_Null|MEM_Zero;
95509 pDest->u.nZero = 0;
@@ -95518,13 +95572,10 @@
95518 }
95519 sqlite3VdbeChangeEncoding(pDest, encoding);
95520 REGISTER_TRACE(pOp->p3, pDest);
95521 UPDATE_MAX_BLOBSIZE(pDest);
95522
95523 if( sqlite3VdbeMemTooBig(pDest) ){
95524 goto too_big;
95525 }
95526 if( rc ) goto abort_due_to_error;
95527 break;
95528 }
95529 #endif /* SQLITE_OMIT_VIRTUALTABLE */
95530
@@ -95787,10 +95838,11 @@
95787 ** reinitializes the relavant parts of the sqlite3_context object */
95788 pOut = &aMem[pOp->p3];
95789 if( pCtx->pOut != pOut ){
95790 pCtx->pVdbe = p;
95791 pCtx->pOut = pOut;
 
95792 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
95793 }
95794 assert( pCtx->pVdbe==p );
95795
95796 memAboutToChange(p, pOut);
@@ -95813,15 +95865,14 @@
95813 sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
95814 pCtx->isError = 0;
95815 if( rc ) goto abort_due_to_error;
95816 }
95817
95818 /* Copy the result of the function into register P3 */
95819 if( pOut->flags & (MEM_Str|MEM_Blob) ){
95820 sqlite3VdbeChangeEncoding(pOut, encoding);
95821 if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
95822 }
95823
95824 REGISTER_TRACE(pOp->p3, pOut);
95825 UPDATE_MAX_BLOBSIZE(pOut);
95826 break;
95827 }
@@ -114347,11 +114398,13 @@
114347 && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
114348 ){
114349 int iDb, i;
114350 assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
114351 sqlite3VdbeJumpHere(v, 0);
114352 for(iDb=0; iDb<db->nDb; iDb++){
 
 
114353 Schema *pSchema;
114354 if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
114355 sqlite3VdbeUsesBtree(v, iDb);
114356 pSchema = db->aDb[iDb].pSchema;
114357 sqlite3VdbeAddOp4Int(v,
@@ -114362,11 +114415,11 @@
114362 pSchema->iGeneration /* P4 */
114363 );
114364 if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
114365 VdbeComment((v,
114366 "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
114367 }
114368 #ifndef SQLITE_OMIT_VIRTUALTABLE
114369 for(i=0; i<pParse->nVtabLock; i++){
114370 char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);
114371 sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
114372 }
@@ -131503,11 +131556,11 @@
131503 **
131504 ** Do N steps of incremental vacuuming on a database.
131505 */
131506 #ifndef SQLITE_OMIT_AUTOVACUUM
131507 case PragTyp_INCREMENTAL_VACUUM: {
131508 int iLimit, addr;
131509 if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
131510 iLimit = 0x7fffffff;
131511 }
131512 sqlite3BeginWriteOperation(pParse, 0, iDb);
131513 sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1);
@@ -133807,11 +133860,11 @@
133807 if( db->mallocFailed ){
133808 rc = SQLITE_NOMEM_BKPT;
133809 sqlite3ResetAllSchemasOfConnection(db);
133810 pDb = &db->aDb[iDb];
133811 }else
133812 if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){
133813 /* Hack: If the SQLITE_NoSchemaError flag is set, then consider
133814 ** the schema loaded, even if errors (other than OOM) occurred. In
133815 ** this situation the current sqlite3_prepare() operation will fail,
133816 ** but the following one will attempt to compile the supplied statement
133817 ** against whatever subset of the schema was loaded before the error
@@ -154862,12 +154915,21 @@
154862 if( j<0 ){
154863 if( pLoop->maskSelf==pTerm->prereqAll ){
154864 /* If there are extra terms in the WHERE clause not used by an index
154865 ** that depend only on the table being scanned, and that will tend to
154866 ** cause many rows to be omitted, then mark that table as
154867 ** "self-culling". */
154868 pLoop->wsFlags |= WHERE_SELFCULL;
 
 
 
 
 
 
 
 
 
154869 }
154870 if( pTerm->truthProb<=0 ){
154871 /* If a truth probability is specified using the likelihood() hints,
154872 ** then use the probability provided by the application. */
154873 pLoop->nOut += pTerm->truthProb;
@@ -168198,11 +168260,11 @@
168198 sqlite3DeleteTable(db, pParse->pNewTable);
168199 }
168200 if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){
168201 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
168202 }
168203 sqlite3DbFree(db, pParse->pVList);
168204 db->pParse = pParentParse;
168205 assert( nErr==0 || pParse->rc!=SQLITE_OK );
168206 return nErr;
168207 }
168208
@@ -234692,11 +234754,11 @@
234692 int nArg, /* Number of args */
234693 sqlite3_value **apUnused /* Function arguments */
234694 ){
234695 assert( nArg==0 );
234696 UNUSED_PARAM2(nArg, apUnused);
234697 sqlite3_result_text(pCtx, "fts5: 2022-03-14 20:31:57 387ab17b8a0a4b87903aab52abc7da79098b882aff2ab687a554d5794e9d183e", -1, SQLITE_TRANSIENT);
234698 }
234699
234700 /*
234701 ** Return true if zName is the extension on one of the shadow tables used
234702 ** by this module.
234703
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.39.0"
456 #define SQLITE_VERSION_NUMBER 3039000
457 #define SQLITE_SOURCE_ID "2022-04-01 17:23:17 a7d79560a0efd6221ba59ce84bcb4fa94024a901ac4a45e192ddecc6e1b5c78c"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -22410,10 +22410,11 @@
22410 FuncDef *pFunc; /* Pointer to function information */
22411 Mem *pMem; /* Memory cell used to store aggregate context */
22412 Vdbe *pVdbe; /* The VM that owns this context */
22413 int iOp; /* Instruction number of OP_Function */
22414 int isError; /* Error code returned by the function. */
22415 u8 enc; /* Encoding to use for results */
22416 u8 skipFlag; /* Skip accumulator loading if true */
22417 u8 argc; /* Number of arguments */
22418 sqlite3_value *argv[1]; /* Argument set */
22419 };
22420
@@ -22458,11 +22459,10 @@
22459 struct Vdbe {
22460 sqlite3 *db; /* The database connection that owns this statement */
22461 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
22462 Parse *pParse; /* Parsing context used to create this Vdbe */
22463 ynVar nVar; /* Number of entries in aVar[] */
 
22464 int nMem; /* Number of memory locations currently allocated */
22465 int nCursor; /* Number of slots in apCsr[] */
22466 u32 cacheCtr; /* VdbeCursor row cache generation counter */
22467 int pc; /* The program counter */
22468 int rc; /* Value to return */
@@ -22497,10 +22497,11 @@
22497 u16 nResColumn; /* Number of columns in one row of the result set */
22498 u8 errorAction; /* Recovery action to do in case of an error */
22499 u8 minWriteFileFormat; /* Minimum file format for writable database files */
22500 u8 prepFlags; /* SQLITE_PREPARE_* flags */
22501 u8 doingRerun; /* True if rerunning after an auto-reprepare */
22502 u8 eVdbeState; /* On of the VDBE_*_STATE values */
22503 bft expired:2; /* 1: recompile VM immediately 2: when convenient */
22504 bft explain:2; /* True if EXPLAIN present on SQL command */
22505 bft changeCntOn:1; /* True to update the change-counter */
22506 bft runOnlyOnce:1; /* Automatically expire on reset */
22507 bft usesStmtJournal:1; /* True if uses a statement journal */
@@ -22527,17 +22528,16 @@
22528 ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
22529 #endif
22530 };
22531
22532 /*
22533 ** The following are allowed values for Vdbe.eVdbeState
22534 */
22535 #define VDBE_INIT_STATE 0 /* Prepared statement under construction */
22536 #define VDBE_READY_STATE 1 /* Ready to run but not yet started */
22537 #define VDBE_RUN_STATE 2 /* Run in progress */
22538 #define VDBE_HALT_STATE 3 /* Finished. Need reset() or finalize() */
 
22539
22540 /*
22541 ** Structure used to store the context required by the
22542 ** sqlite3_preupdate_*() API functions.
22543 */
@@ -27002,12 +27002,17 @@
27002 ** 32-bit signed integer. Hence the largest allocation is 0x40000000
27003 ** or 1073741824 bytes.
27004 */
27005 static int memsys5Roundup(int n){
27006 int iFullSz;
27007 if( n<=mem5.szAtom*2 ){
27008 if( n<=mem5.szAtom ) return mem5.szAtom;
27009 return mem5.szAtom*2;
27010 }
27011 if( n>0x40000000 ) return 0;
27012 for(iFullSz=mem5.szAtom*8; iFullSz<n; iFullSz *= 4);
27013 if( (iFullSz/2)>=n ) return iFullSz/2;
27014 return iFullSz;
27015 }
27016
27017 /*
27018 ** Return the ceiling of the logarithm base 2 of iValue.
@@ -74949,11 +74954,10 @@
74954 ** balance_deeper()
74955 ** balance_nonroot()
74956 */
74957 static int balance(BtCursor *pCur){
74958 int rc = SQLITE_OK;
 
74959 u8 aBalanceQuickSpace[13];
74960 u8 *pFree = 0;
74961
74962 VVA_ONLY( int balance_quick_called = 0 );
74963 VVA_ONLY( int balance_deeper_called = 0 );
@@ -74961,11 +74965,15 @@
74965 do {
74966 int iPage;
74967 MemPage *pPage = pCur->pPage;
74968
74969 if( NEVER(pPage->nFree<0) && btreeComputeFreeSpace(pPage) ) break;
74970 if( pPage->nOverflow==0 && pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
74971 /* No rebalance required as long as:
74972 ** (1) There are no overflow cells
74973 ** (2) The amount of free space on the page is less than 2/3rds of
74974 ** the total usable space on the page. */
74975 break;
74976 }else if( (iPage = pCur->iPage)==0 ){
74977 if( pPage->nOverflow && (rc = anotherValidCursor(pCur))==SQLITE_OK ){
74978 /* The root page of the b-tree is overfull. In this case call the
74979 ** balance_deeper() function to create a new child for the root-page
@@ -75775,11 +75783,19 @@
75783 ** on the leaf node first. If the balance proceeds far enough up the
75784 ** tree that we can be sure that any problem in the internal node has
75785 ** been corrected, so be it. Otherwise, after balancing the leaf node,
75786 ** walk the cursor up the tree to the internal node and balance it as
75787 ** well. */
75788 assert( pCur->pPage->nOverflow==0 );
75789 assert( pCur->pPage->nFree>=0 );
75790 if( pCur->pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
75791 /* Optimization: If the free space is less than 2/3rds of the page,
75792 ** then balance() will always be a no-op. No need to invoke it. */
75793 rc = SQLITE_OK;
75794 }else{
75795 rc = balance(pCur);
75796 }
75797 if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
75798 releasePageNotNull(pCur->pPage);
75799 pCur->iPage--;
75800 while( pCur->iPage>iCellDepth ){
75801 releasePage(pCur->apPage[pCur->iPage--]);
@@ -78270,11 +78286,15 @@
78286 #endif
78287 assert( pMem!=0 );
78288 assert( !sqlite3VdbeMemIsRowSet(pMem) );
78289 assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
78290 || desiredEnc==SQLITE_UTF16BE );
78291 if( !(pMem->flags&MEM_Str) ){
78292 pMem->enc = desiredEnc;
78293 return SQLITE_OK;
78294 }
78295 if( pMem->enc==desiredEnc ){
78296 return SQLITE_OK;
78297 }
78298 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
78299 #ifdef SQLITE_OMIT_UTF16
78300 return SQLITE_ERROR;
@@ -78529,10 +78549,11 @@
78549 t.flags = MEM_Null;
78550 t.db = pMem->db;
78551 ctx.pOut = &t;
78552 ctx.pMem = pMem;
78553 ctx.pFunc = pFunc;
78554 ctx.enc = ENC(t.db);
78555 pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */
78556 assert( (pMem->flags & MEM_Dyn)==0 );
78557 if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
78558 memcpy(pMem, &t, sizeof(t));
78559 return ctx.isError;
@@ -78556,10 +78577,11 @@
78577 memset(&ctx, 0, sizeof(ctx));
78578 sqlite3VdbeMemSetNull(pOut);
78579 ctx.pOut = pOut;
78580 ctx.pMem = pAccum;
78581 ctx.pFunc = pFunc;
78582 ctx.enc = ENC(pAccum->db);
78583 pFunc->xValue(&ctx);
78584 return ctx.isError;
78585 }
78586 #endif /* SQLITE_OMIT_WINDOWFUNC */
78587
@@ -79173,10 +79195,17 @@
79195 ** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH
79196 ** size limit) then no memory allocation occurs. If the string can be
79197 ** stored without allocating memory, then it is. If a memory allocation
79198 ** is required to store the string, then value of pMem is unchanged. In
79199 ** either case, SQLITE_TOOBIG is returned.
79200 **
79201 ** The "enc" parameter is the text encoding for the string, or zero
79202 ** to store a blob.
79203 **
79204 ** If n is negative, then the string consists of all bytes up to but
79205 ** excluding the first zero character. The n parameter must be
79206 ** non-negative for blobs.
79207 */
79208 SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
79209 Mem *pMem, /* Memory cell to set to string value */
79210 const char *z, /* String pointer */
79211 i64 n, /* Bytes in string, or negative */
@@ -79183,15 +79212,16 @@
79212 u8 enc, /* Encoding of z. 0 for BLOBs */
79213 void (*xDel)(void*) /* Destructor function */
79214 ){
79215 i64 nByte = n; /* New value for pMem->n */
79216 int iLimit; /* Maximum allowed string or blob size */
79217 u16 flags; /* New value for pMem->flags */
79218
79219 assert( pMem!=0 );
79220 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
79221 assert( !sqlite3VdbeMemIsRowSet(pMem) );
79222 assert( enc!=0 || n>=0 );
79223
79224 /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
79225 if( !z ){
79226 sqlite3VdbeMemSetNull(pMem);
79227 return SQLITE_OK;
@@ -79200,19 +79230,34 @@
79230 if( pMem->db ){
79231 iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];
79232 }else{
79233 iLimit = SQLITE_MAX_LENGTH;
79234 }
 
79235 if( nByte<0 ){
79236 assert( enc!=0 );
79237 if( enc==SQLITE_UTF8 ){
79238 nByte = strlen(z);
79239 }else{
79240 for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
79241 }
79242 flags= MEM_Str|MEM_Term;
79243 }else if( enc==0 ){
79244 flags = MEM_Blob;
79245 enc = SQLITE_UTF8;
79246 }else{
79247 flags = MEM_Str;
79248 }
79249 if( nByte>iLimit ){
79250 if( xDel && xDel!=SQLITE_TRANSIENT ){
79251 if( xDel==SQLITE_DYNAMIC ){
79252 sqlite3DbFree(pMem->db, (void*)z);
79253 }else{
79254 xDel((void*)z);
79255 }
79256 }
79257 sqlite3VdbeMemSetNull(pMem);
79258 return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
79259 }
79260
79261 /* The following block sets the new values of Mem.z and Mem.xDel. It
79262 ** also sets a flag in local variable "flags" to indicate the memory
79263 ** management (one of MEM_Dyn or MEM_Static).
@@ -79220,13 +79265,10 @@
79265 if( xDel==SQLITE_TRANSIENT ){
79266 i64 nAlloc = nByte;
79267 if( flags&MEM_Term ){
79268 nAlloc += (enc==SQLITE_UTF8?1:2);
79269 }
 
 
 
79270 testcase( nAlloc==0 );
79271 testcase( nAlloc==31 );
79272 testcase( nAlloc==32 );
79273 if( sqlite3VdbeMemClearAndResize(pMem, (int)MAX(nAlloc,32)) ){
79274 return SQLITE_NOMEM_BKPT;
@@ -79244,30 +79286,18 @@
79286 }
79287 }
79288
79289 pMem->n = (int)(nByte & 0x7fffffff);
79290 pMem->flags = flags;
79291 pMem->enc = enc;
 
 
 
 
 
 
 
 
 
79292
79293 #ifndef SQLITE_OMIT_UTF16
79294 if( enc>SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
79295 return SQLITE_NOMEM_BKPT;
79296 }
79297 #endif
79298
 
 
 
79299
79300 return SQLITE_OK;
79301 }
79302
79303 /*
@@ -79545,10 +79575,11 @@
79575
79576 assert( pCtx->pParse->rc==SQLITE_OK );
79577 memset(&ctx, 0, sizeof(ctx));
79578 ctx.pOut = pVal;
79579 ctx.pFunc = pFunc;
79580 ctx.enc = ENC(db);
79581 pFunc->xSFunc(&ctx, nVal, apVal);
79582 if( ctx.isError ){
79583 rc = ctx.isError;
79584 sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
79585 }else{
@@ -80055,11 +80086,11 @@
80086 db->pVdbe->pPrev = p;
80087 }
80088 p->pNext = db->pVdbe;
80089 p->pPrev = 0;
80090 db->pVdbe = p;
80091 assert( p->eVdbeState==VDBE_INIT_STATE );
80092 p->pParse = pParse;
80093 pParse->pVdbe = p;
80094 assert( pParse->aLabel==0 );
80095 assert( pParse->nLabel==0 );
80096 assert( p->nOpAlloc==0 );
@@ -80256,11 +80287,11 @@
80287 SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
80288 int i;
80289 VdbeOp *pOp;
80290
80291 i = p->nOp;
80292 assert( p->eVdbeState==VDBE_INIT_STATE );
80293 assert( op>=0 && op<0xff );
80294 if( p->nOpAlloc<=i ){
80295 return growOp3(p, op, p1, p2, p3);
80296 }
80297 assert( p->aOp!=0 );
@@ -80588,11 +80619,11 @@
80619 }
80620 }
80621 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
80622 Parse *p = v->pParse;
80623 int j = ADDR(x);
80624 assert( v->eVdbeState==VDBE_INIT_STATE );
80625 assert( j<-p->nLabel );
80626 assert( j>=0 );
80627 #ifdef SQLITE_DEBUG
80628 if( p->db->flags & SQLITE_VdbeAddopTrace ){
80629 printf("RESOLVE LABEL %d to %d\n", x, v->nOp);
@@ -80719,10 +80750,12 @@
80750 int hasCreateTable = 0;
80751 int hasCreateIndex = 0;
80752 int hasInitCoroutine = 0;
80753 Op *pOp;
80754 VdbeOpIter sIter;
80755
80756 if( v==0 ) return 0;
80757 memset(&sIter, 0, sizeof(sIter));
80758 sIter.v = v;
80759
80760 while( (pOp = opIterNext(&sIter))!=0 ){
80761 int opcode = pOp->opcode;
@@ -80883,22 +80916,24 @@
80916 assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0);
80917 }
80918 if( pOp==p->aOp ) break;
80919 pOp--;
80920 }
80921 if( aLabel ){
80922 sqlite3DbFreeNN(p->db, pParse->aLabel);
80923 pParse->aLabel = 0;
80924 }
80925 pParse->nLabel = 0;
80926 *pMaxFuncArgs = nMaxArgs;
80927 assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
80928 }
80929
80930 /*
80931 ** Return the address of the next instruction to be inserted.
80932 */
80933 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){
80934 assert( p->eVdbeState==VDBE_INIT_STATE );
80935 return p->nOp;
80936 }
80937
80938 /*
80939 ** Verify that at least N opcode slots are available in p without
@@ -80979,11 +81014,11 @@
81014 int iLineno /* Source-file line number of first opcode */
81015 ){
81016 int i;
81017 VdbeOp *pOut, *pFirst;
81018 assert( nOp>0 );
81019 assert( p->eVdbeState==VDBE_INIT_STATE );
81020 if( p->nOp + nOp > p->nOpAlloc && growOpArray(p, nOp) ){
81021 return 0;
81022 }
81023 pFirst = pOut = &p->aOp[p->nOp];
81024 for(i=0; i<nOp; i++, aOp++, pOut++){
@@ -81170,17 +81205,20 @@
81205 ** Free the space allocated for aOp and any p4 values allocated for the
81206 ** opcodes contained within. If aOp is not NULL it is assumed to contain
81207 ** nOp entries.
81208 */
81209 static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
81210 assert( nOp>=0 );
81211 if( aOp ){
81212 Op *pOp = &aOp[nOp-1];
81213 while(1){ /* Exit via break */
81214 if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
81215 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
81216 sqlite3DbFree(db, pOp->zComment);
81217 #endif
81218 if( pOp==aOp ) break;
81219 pOp--;
81220 }
81221 sqlite3DbFreeNN(db, aOp);
81222 }
81223 }
81224
@@ -81302,11 +81340,11 @@
81340 SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
81341 Op *pOp;
81342 sqlite3 *db;
81343 assert( p!=0 );
81344 db = p->db;
81345 assert( p->eVdbeState==VDBE_INIT_STATE );
81346 assert( p->aOp!=0 || db->mallocFailed );
81347 if( db->mallocFailed ){
81348 if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
81349 return;
81350 }
@@ -81430,11 +81468,11 @@
81468 */
81469 SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
81470 /* C89 specifies that the constant "dummy" will be initialized to all
81471 ** zeros, which is correct. MSVC generates a warning, nevertheless. */
81472 static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
81473 assert( p->eVdbeState==VDBE_INIT_STATE );
81474 if( addr<0 ){
81475 addr = p->nOp - 1;
81476 }
81477 assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
81478 if( p->db->mallocFailed ){
@@ -82132,11 +82170,11 @@
82170 int bListSubprogs = (p->explain==1 || (db->flags & SQLITE_TriggerEQP)!=0);
82171 Op *aOp; /* Array of opcodes */
82172 Op *pOp; /* Current opcode */
82173
82174 assert( p->explain );
82175 assert( p->eVdbeState==VDBE_RUN_STATE );
82176 assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );
82177
82178 /* Even though this opcode does not use dynamic strings for
82179 ** the result, result columns may become dynamic if the user calls
82180 ** sqlite3_column_text16(), causing a translation to UTF-16 encoding.
@@ -82312,18 +82350,19 @@
82350 SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
82351 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
82352 int i;
82353 #endif
82354 assert( p!=0 );
82355 assert( p->eVdbeState==VDBE_INIT_STATE
82356 || p->eVdbeState==VDBE_READY_STATE
82357 || p->eVdbeState==VDBE_HALT_STATE );
82358
82359 /* There should be at least one opcode.
82360 */
82361 assert( p->nOp>0 );
82362
82363 p->eVdbeState = VDBE_READY_STATE;
 
82364
82365 #ifdef SQLITE_DEBUG
82366 for(i=0; i<p->nMem; i++){
82367 assert( p->aMem[i].db==p->db );
82368 }
@@ -82375,11 +82414,11 @@
82414 struct ReusableSpace x; /* Reusable bulk memory */
82415
82416 assert( p!=0 );
82417 assert( p->nOp>0 );
82418 assert( pParse!=0 );
82419 assert( p->eVdbeState==VDBE_INIT_STATE );
82420 assert( pParse==p->pParse );
82421 p->pVList = pParse->pVList;
82422 pParse->pVList = 0;
82423 db = p->db;
82424 assert( db->mallocFailed==0 );
@@ -82516,18 +82555,16 @@
82555
82556 /*
82557 ** Close all cursors in the current frame.
82558 */
82559 static void closeCursorsInFrame(Vdbe *p){
82560 int i;
82561 for(i=0; i<p->nCursor; i++){
82562 VdbeCursor *pC = p->apCsr[i];
82563 if( pC ){
82564 sqlite3VdbeFreeCursor(p, pC);
82565 p->apCsr[i] = 0;
 
 
82566 }
82567 }
82568 }
82569
82570 /*
@@ -82572,13 +82609,11 @@
82609 p->pFrame = 0;
82610 p->nFrame = 0;
82611 }
82612 assert( p->nFrame==0 );
82613 closeCursorsInFrame(p);
82614 releaseMemArray(p->aMem, p->nMem);
 
 
82615 while( p->pDelFrame ){
82616 VdbeFrame *pDel = p->pDelFrame;
82617 p->pDelFrame = pDel->pParent;
82618 sqlite3VdbeFrameDelete(pDel);
82619 }
@@ -83014,10 +83049,11 @@
83049 || (!deferred && p->nFkConstraint>0)
83050 ){
83051 p->rc = SQLITE_CONSTRAINT_FOREIGNKEY;
83052 p->errorAction = OE_Abort;
83053 sqlite3VdbeError(p, "FOREIGN KEY constraint failed");
83054 if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)==0 ) return SQLITE_ERROR;
83055 return SQLITE_CONSTRAINT_FOREIGNKEY;
83056 }
83057 return SQLITE_OK;
83058 }
83059 #endif
@@ -83053,11 +83089,11 @@
83089 ** Then the internal cache might have been left in an inconsistent
83090 ** state. We need to rollback the statement transaction, if there is
83091 ** one, or the complete transaction if there is no statement transaction.
83092 */
83093
83094 if( p->eVdbeState!=VDBE_RUN_STATE ){
83095 return SQLITE_OK;
83096 }
83097 if( db->mallocFailed ){
83098 p->rc = SQLITE_NOMEM_BKPT;
83099 }
@@ -83064,11 +83100,11 @@
83100 closeAllCursors(p);
83101 checkActiveVdbeCnt(db);
83102
83103 /* No commit or rollback needed if the program never started or if the
83104 ** SQL statement does not read or write a database file. */
83105 if( p->bIsReader ){
83106 int mrc; /* Primary error code from p->rc */
83107 int eStatementOp = 0;
83108 int isSpecialError; /* Set to true if a 'special' error */
83109
83110 /* Lock all btrees used by the statement */
@@ -83212,19 +83248,17 @@
83248 /* Release the locks */
83249 sqlite3VdbeLeave(p);
83250 }
83251
83252 /* We have successfully halted and closed the VM. Record this fact. */
83253 db->nVdbeActive--;
83254 if( !p->readOnly ) db->nVdbeWrite--;
83255 if( p->bIsReader ) db->nVdbeRead--;
83256 assert( db->nVdbeActive>=db->nVdbeRead );
83257 assert( db->nVdbeRead>=db->nVdbeWrite );
83258 assert( db->nVdbeWrite>=0 );
83259 p->eVdbeState = VDBE_HALT_STATE;
 
 
83260 checkActiveVdbeCnt(db);
83261 if( db->mallocFailed ){
83262 p->rc = SQLITE_NOMEM_BKPT;
83263 }
83264
@@ -83302,12 +83336,12 @@
83336 **
83337 ** After this routine is run, the VDBE should be ready to be executed
83338 ** again.
83339 **
83340 ** To look at it another way, this routine resets the state of the
83341 ** virtual machine from VDBE_RUN_STATE or VDBE_HALT_STATE back to
83342 ** VDBE_READY_STATE.
83343 */
83344 SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
83345 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
83346 int i;
83347 #endif
@@ -83332,16 +83366,10 @@
83366 sqlite3VdbeTransferError(p);
83367 }else{
83368 db->errCode = p->rc;
83369 }
83370 if( p->runOnlyOnce ) p->expired = 1;
 
 
 
 
 
 
83371 }
83372
83373 /* Reset register contents and reclaim error message memory.
83374 */
83375 #ifdef SQLITE_DEBUG
@@ -83394,21 +83422,23 @@
83422 }
83423 fclose(out);
83424 }
83425 }
83426 #endif
 
83427 return p->rc & db->errMask;
83428 }
83429
83430 /*
83431 ** Clean up and delete a VDBE after execution. Return an integer which is
83432 ** the result code. Write any error message text into *pzErrMsg.
83433 */
83434 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){
83435 int rc = SQLITE_OK;
83436 assert( VDBE_RUN_STATE>VDBE_READY_STATE );
83437 assert( VDBE_HALT_STATE>VDBE_READY_STATE );
83438 assert( VDBE_INIT_STATE<VDBE_READY_STATE );
83439 if( p->eVdbeState>=VDBE_READY_STATE ){
83440 rc = sqlite3VdbeReset(p);
83441 assert( (rc & p->db->errMask)==rc );
83442 }
83443 sqlite3VdbeDelete(p);
83444 return rc;
@@ -83459,23 +83489,25 @@
83489 ** the database connection and frees the object itself.
83490 */
83491 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
83492 SubProgram *pSub, *pNext;
83493 assert( p->db==0 || p->db==db );
83494 if( p->aColName ){
83495 releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
83496 sqlite3DbFreeNN(db, p->aColName);
83497 }
83498 for(pSub=p->pProgram; pSub; pSub=pNext){
83499 pNext = pSub->pNext;
83500 vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
83501 sqlite3DbFree(db, pSub);
83502 }
83503 if( p->eVdbeState!=VDBE_INIT_STATE ){
83504 releaseMemArray(p->aVar, p->nVar);
83505 if( p->pVList ) sqlite3DbFreeNN(db, p->pVList);
83506 if( p->pFree ) sqlite3DbFreeNN(db, p->pFree);
83507 }
83508 vdbeFreeOpArray(db, p->aOp, p->nOp);
 
83509 sqlite3DbFree(db, p->zSql);
83510 #ifdef SQLITE_ENABLE_NORMALIZE
83511 sqlite3DbFree(db, p->zNormSql);
83512 {
83513 DblquoteStr *pThis, *pNext;
@@ -83513,12 +83545,10 @@
83545 db->pVdbe = p->pNext;
83546 }
83547 if( p->pNext ){
83548 p->pNext->pPrev = p->pPrev;
83549 }
 
 
83550 sqlite3DbFreeNN(db, p);
83551 }
83552
83553 /*
83554 ** The cursor "p" has a pending seek operation that has not yet been
@@ -85638,20 +85668,26 @@
85668 const char *z, /* String pointer */
85669 int n, /* Bytes in string, or negative */
85670 u8 enc, /* Encoding of z. 0 for BLOBs */
85671 void (*xDel)(void*) /* Destructor function */
85672 ){
85673 Mem *pOut = pCtx->pOut;
85674 int rc = sqlite3VdbeMemSetStr(pOut, z, n, enc, xDel);
85675 if( rc ){
85676 if( rc==SQLITE_TOOBIG ){
85677 sqlite3_result_error_toobig(pCtx);
85678 }else{
85679 /* The only errors possible from sqlite3VdbeMemSetStr are
85680 ** SQLITE_TOOBIG and SQLITE_NOMEM */
85681 assert( rc==SQLITE_NOMEM );
85682 sqlite3_result_error_nomem(pCtx);
85683 }
85684 return;
85685 }
85686 sqlite3VdbeChangeEncoding(pOut, pCtx->enc);
85687 if( sqlite3VdbeMemTooBig(pOut) ){
85688 sqlite3_result_error_toobig(pCtx);
85689 }
85690 }
85691 static int invokeValueDestructor(
85692 const void *p, /* Value to destroy */
85693 void (*xDel)(void*), /* The destructor */
@@ -85791,21 +85827,26 @@
85827 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
85828 setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);
85829 }
85830 #endif /* SQLITE_OMIT_UTF16 */
85831 SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
85832 Mem *pOut = pCtx->pOut;
85833 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
85834 sqlite3VdbeMemCopy(pOut, pValue);
85835 sqlite3VdbeChangeEncoding(pOut, pCtx->enc);
85836 if( sqlite3VdbeMemTooBig(pOut) ){
85837 sqlite3_result_error_toobig(pCtx);
85838 }
85839 }
85840 SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
85841 sqlite3_result_zeroblob64(pCtx, n>0 ? n : 0);
 
85842 }
85843 SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
85844 Mem *pOut = pCtx->pOut;
85845 assert( sqlite3_mutex_held(pOut->db->mutex) );
85846 if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
85847 sqlite3_result_error_toobig(pCtx);
85848 return SQLITE_TOOBIG;
85849 }
85850 #ifndef SQLITE_OMIT_INCRBLOB
85851 sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n);
85852 return SQLITE_OK;
@@ -85817,12 +85858,12 @@
85858 pCtx->isError = errCode ? errCode : -1;
85859 #ifdef SQLITE_DEBUG
85860 if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
85861 #endif
85862 if( pCtx->pOut->flags & MEM_Null ){
85863 setResultStrOrError(pCtx, sqlite3ErrStr(errCode), -1, SQLITE_UTF8,
85864 SQLITE_STATIC);
85865 }
85866 }
85867
85868 /* Force an SQLITE_TOOBIG error. */
85869 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){
@@ -85891,85 +85932,94 @@
85932 */
85933 static int sqlite3Step(Vdbe *p){
85934 sqlite3 *db;
85935 int rc;
85936
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85937 /* Check that malloc() has not failed. If it has, return early. */
85938 db = p->db;
85939 if( db->mallocFailed ){
85940 p->rc = SQLITE_NOMEM;
85941 return SQLITE_NOMEM_BKPT;
85942 }
85943
85944 assert(p);
85945 if( p->eVdbeState!=VDBE_RUN_STATE ){
85946 restart_step:
85947 if( p->eVdbeState==VDBE_READY_STATE ){
85948 if( p->expired ){
85949 p->rc = SQLITE_SCHEMA;
85950 rc = SQLITE_ERROR;
85951 if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
85952 /* If this statement was prepared using saved SQL and an
85953 ** error has occurred, then return the error code in p->rc to the
85954 ** caller. Set the error code in the database handle to the same
85955 ** value.
85956 */
85957 rc = sqlite3VdbeTransferError(p);
85958 }
85959 goto end_of_step;
85960 }
85961
85962 /* If there are no other statements currently running, then
85963 ** reset the interrupt flag. This prevents a call to sqlite3_interrupt
85964 ** from interrupting a statement that has not yet started.
85965 */
85966 if( db->nVdbeActive==0 ){
85967 AtomicStore(&db->u1.isInterrupted, 0);
85968 }
85969
85970 assert( db->nVdbeWrite>0 || db->autoCommit==0
85971 || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
85972 );
85973
85974 #ifndef SQLITE_OMIT_TRACE
85975 if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
85976 && !db->init.busy && p->zSql ){
85977 sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
85978 }else{
85979 assert( p->startTime==0 );
85980 }
85981 #endif
85982
85983 db->nVdbeActive++;
85984 if( p->readOnly==0 ) db->nVdbeWrite++;
85985 if( p->bIsReader ) db->nVdbeRead++;
85986 p->pc = 0;
85987 p->eVdbeState = VDBE_RUN_STATE;
85988 }else
85989
85990 if( ALWAYS(p->eVdbeState==VDBE_HALT_STATE) ){
85991 /* We used to require that sqlite3_reset() be called before retrying
85992 ** sqlite3_step() after any error or after SQLITE_DONE. But beginning
85993 ** with version 3.7.0, we changed this so that sqlite3_reset() would
85994 ** be called automatically instead of throwing the SQLITE_MISUSE error.
85995 ** This "automatic-reset" change is not technically an incompatibility,
85996 ** since any application that receives an SQLITE_MISUSE is broken by
85997 ** definition.
85998 **
85999 ** Nevertheless, some published applications that were originally written
86000 ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
86001 ** returns, and those were broken by the automatic-reset change. As a
86002 ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
86003 ** legacy behavior of returning SQLITE_MISUSE for cases where the
86004 ** previous sqlite3_step() returned something other than a SQLITE_LOCKED
86005 ** or SQLITE_BUSY error.
86006 */
86007 #ifdef SQLITE_OMIT_AUTORESET
86008 if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){
86009 sqlite3_reset((sqlite3_stmt*)p);
86010 }else{
86011 return SQLITE_MISUSE_BKPT;
86012 }
86013 #else
86014 sqlite3_reset((sqlite3_stmt*)p);
86015 #endif
86016 assert( p->eVdbeState==VDBE_READY_STATE );
86017 goto restart_step;
86018 }
86019 }
86020
86021 #ifdef SQLITE_DEBUG
86022 p->rcApp = SQLITE_OK;
86023 #endif
86024 #ifndef SQLITE_OMIT_EXPLAIN
86025 if( p->explain ){
@@ -85980,11 +86030,16 @@
86030 db->nVdbeExec++;
86031 rc = sqlite3VdbeExec(p);
86032 db->nVdbeExec--;
86033 }
86034
86035 if( rc==SQLITE_ROW ){
86036 assert( p->rc==SQLITE_OK );
86037 assert( db->mallocFailed==0 );
86038 db->errCode = SQLITE_ROW;
86039 return SQLITE_ROW;
86040 }else{
86041 #ifndef SQLITE_OMIT_TRACE
86042 /* If the statement completed successfully, invoke the profile callback */
86043 checkProfileCallback(db, p);
86044 #endif
86045
@@ -86672,11 +86727,11 @@
86727 Mem *pVar;
86728 if( vdbeSafetyNotNull(p) ){
86729 return SQLITE_MISUSE_BKPT;
86730 }
86731 sqlite3_mutex_enter(p->db->mutex);
86732 if( p->eVdbeState!=VDBE_READY_STATE ){
86733 sqlite3Error(p->db, SQLITE_MISUSE);
86734 sqlite3_mutex_leave(p->db->mutex);
86735 sqlite3_log(SQLITE_MISUSE,
86736 "bind on a busy prepared statement: [%s]", p->zSql);
86737 return SQLITE_MISUSE_BKPT;
@@ -87025,11 +87080,11 @@
87080 /*
87081 ** Return true if the prepared statement is in need of being reset.
87082 */
87083 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
87084 Vdbe *v = (Vdbe*)pStmt;
87085 return v!=0 && v->eVdbeState==VDBE_RUN_STATE;
87086 }
87087
87088 /*
87089 ** Return a pointer to the next prepared statement after pStmt associated
87090 ** with database connection pDb. If pStmt is NULL, return the first
@@ -88339,11 +88394,11 @@
88394 #ifdef VDBE_PROFILE
88395 u64 start; /* CPU clock count at start of opcode */
88396 #endif
88397 /*** INSERT STACK UNION HERE ***/
88398
88399 assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
88400 sqlite3VdbeEnter(p);
88401 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
88402 if( db->xProgress ){
88403 u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
88404 assert( 0 < db->nProgressOps );
@@ -94848,10 +94903,11 @@
94903 pCtx->pFunc = pOp->p4.pFunc;
94904 pCtx->iOp = (int)(pOp - aOp);
94905 pCtx->pVdbe = p;
94906 pCtx->skipFlag = 0;
94907 pCtx->isError = 0;
94908 pCtx->enc = encoding;
94909 pCtx->argc = n;
94910 pOp->p4type = P4_FUNCCTX;
94911 pOp->p4.pCtx = pCtx;
94912
94913 /* OP_AggInverse must have P1==1 and OP_AggStep must have P1==0 */
@@ -94977,13 +95033,10 @@
95033 sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
95034 goto abort_due_to_error;
95035 }
95036 sqlite3VdbeChangeEncoding(pMem, encoding);
95037 UPDATE_MAX_BLOBSIZE(pMem);
 
 
 
95038 break;
95039 }
95040
95041 #ifndef SQLITE_OMIT_WAL
95042 /* Opcode: Checkpoint P1 P2 P3 * *
@@ -95500,10 +95553,11 @@
95553 pVtab = pCur->uc.pVCur->pVtab;
95554 pModule = pVtab->pModule;
95555 assert( pModule->xColumn );
95556 memset(&sContext, 0, sizeof(sContext));
95557 sContext.pOut = pDest;
95558 sContext.enc = encoding;
95559 assert( pOp->p5==OPFLAG_NOCHNG || pOp->p5==0 );
95560 if( pOp->p5 & OPFLAG_NOCHNG ){
95561 sqlite3VdbeMemSetNull(pDest);
95562 pDest->flags = MEM_Null|MEM_Zero;
95563 pDest->u.nZero = 0;
@@ -95518,13 +95572,10 @@
95572 }
95573 sqlite3VdbeChangeEncoding(pDest, encoding);
95574 REGISTER_TRACE(pOp->p3, pDest);
95575 UPDATE_MAX_BLOBSIZE(pDest);
95576
 
 
 
95577 if( rc ) goto abort_due_to_error;
95578 break;
95579 }
95580 #endif /* SQLITE_OMIT_VIRTUALTABLE */
95581
@@ -95787,10 +95838,11 @@
95838 ** reinitializes the relavant parts of the sqlite3_context object */
95839 pOut = &aMem[pOp->p3];
95840 if( pCtx->pOut != pOut ){
95841 pCtx->pVdbe = p;
95842 pCtx->pOut = pOut;
95843 pCtx->enc = encoding;
95844 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
95845 }
95846 assert( pCtx->pVdbe==p );
95847
95848 memAboutToChange(p, pOut);
@@ -95813,15 +95865,14 @@
95865 sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
95866 pCtx->isError = 0;
95867 if( rc ) goto abort_due_to_error;
95868 }
95869
95870 assert( (pOut->flags&MEM_Str)==0
95871 || pOut->enc==encoding
95872 || db->mallocFailed );
95873 assert( !sqlite3VdbeMemTooBig(pOut) );
 
95874
95875 REGISTER_TRACE(pOp->p3, pOut);
95876 UPDATE_MAX_BLOBSIZE(pOut);
95877 break;
95878 }
@@ -114347,11 +114398,13 @@
114398 && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
114399 ){
114400 int iDb, i;
114401 assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
114402 sqlite3VdbeJumpHere(v, 0);
114403 assert( db->nDb>0 );
114404 iDb = 0;
114405 do{
114406 Schema *pSchema;
114407 if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
114408 sqlite3VdbeUsesBtree(v, iDb);
114409 pSchema = db->aDb[iDb].pSchema;
114410 sqlite3VdbeAddOp4Int(v,
@@ -114362,11 +114415,11 @@
114415 pSchema->iGeneration /* P4 */
114416 );
114417 if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
114418 VdbeComment((v,
114419 "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
114420 }while( ++iDb<db->nDb );
114421 #ifndef SQLITE_OMIT_VIRTUALTABLE
114422 for(i=0; i<pParse->nVtabLock; i++){
114423 char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);
114424 sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
114425 }
@@ -131503,11 +131556,11 @@
131556 **
131557 ** Do N steps of incremental vacuuming on a database.
131558 */
131559 #ifndef SQLITE_OMIT_AUTOVACUUM
131560 case PragTyp_INCREMENTAL_VACUUM: {
131561 int iLimit = 0, addr;
131562 if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
131563 iLimit = 0x7fffffff;
131564 }
131565 sqlite3BeginWriteOperation(pParse, 0, iDb);
131566 sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1);
@@ -133807,11 +133860,11 @@
133860 if( db->mallocFailed ){
133861 rc = SQLITE_NOMEM_BKPT;
133862 sqlite3ResetAllSchemasOfConnection(db);
133863 pDb = &db->aDb[iDb];
133864 }else
133865 if( rc==SQLITE_OK || ((db->flags&SQLITE_NoSchemaError) && rc!=SQLITE_NOMEM)){
133866 /* Hack: If the SQLITE_NoSchemaError flag is set, then consider
133867 ** the schema loaded, even if errors (other than OOM) occurred. In
133868 ** this situation the current sqlite3_prepare() operation will fail,
133869 ** but the following one will attempt to compile the supplied statement
133870 ** against whatever subset of the schema was loaded before the error
@@ -154862,12 +154915,21 @@
154915 if( j<0 ){
154916 if( pLoop->maskSelf==pTerm->prereqAll ){
154917 /* If there are extra terms in the WHERE clause not used by an index
154918 ** that depend only on the table being scanned, and that will tend to
154919 ** cause many rows to be omitted, then mark that table as
154920 ** "self-culling".
154921 **
154922 ** 2022-03-24: Self-culling only applies if either the extra terms
154923 ** are straight comparison operators that are non-true with NULL
154924 ** operand, or if the loop is not a LEFT JOIN.
154925 */
154926 if( (pTerm->eOperator & 0x3f)!=0
154927 || (pWC->pWInfo->pTabList->a[pLoop->iTab].fg.jointype & JT_LEFT)==0
154928 ){
154929 pLoop->wsFlags |= WHERE_SELFCULL;
154930 }
154931 }
154932 if( pTerm->truthProb<=0 ){
154933 /* If a truth probability is specified using the likelihood() hints,
154934 ** then use the probability provided by the application. */
154935 pLoop->nOut += pTerm->truthProb;
@@ -168198,11 +168260,11 @@
168260 sqlite3DeleteTable(db, pParse->pNewTable);
168261 }
168262 if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){
168263 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
168264 }
168265 if( pParse->pVList ) sqlite3DbFreeNN(db, pParse->pVList);
168266 db->pParse = pParentParse;
168267 assert( nErr==0 || pParse->rc!=SQLITE_OK );
168268 return nErr;
168269 }
168270
@@ -234692,11 +234754,11 @@
234754 int nArg, /* Number of args */
234755 sqlite3_value **apUnused /* Function arguments */
234756 ){
234757 assert( nArg==0 );
234758 UNUSED_PARAM2(nArg, apUnused);
234759 sqlite3_result_text(pCtx, "fts5: 2022-03-31 11:12:56 f2d9262e4427ab37ba26c004fc7a4790c86c1856d695a6b4ec3e72732ea54c09", -1, SQLITE_TRANSIENT);
234760 }
234761
234762 /*
234763 ** Return true if zName is the extension on one of the shadow tables used
234764 ** by this module.
234765
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.39.0"
150150
#define SQLITE_VERSION_NUMBER 3039000
151
-#define SQLITE_SOURCE_ID "2022-03-23 10:04:52 43143ad131f17734fd2eff849e0a1bc2e26daf6a28c7e07d697d38732e6af5fc"
151
+#define SQLITE_SOURCE_ID "2022-04-01 17:23:17 a7d79560a0efd6221ba59ce84bcb4fa94024a901ac4a45e192ddecc6e1b5c78c"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
157157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.39.0"
150 #define SQLITE_VERSION_NUMBER 3039000
151 #define SQLITE_SOURCE_ID "2022-03-23 10:04:52 43143ad131f17734fd2eff849e0a1bc2e26daf6a28c7e07d697d38732e6af5fc"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.39.0"
150 #define SQLITE_VERSION_NUMBER 3039000
151 #define SQLITE_SOURCE_ID "2022-04-01 17:23:17 a7d79560a0efd6221ba59ce84bcb4fa94024a901ac4a45e192ddecc6e1b5c78c"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
+10 -3
--- src/dispatch.c
+++ src/dispatch.c
@@ -125,11 +125,13 @@
125125
&& strncmp(zName, aCommand[lwr].zName, nName)==0; ++lwr ){
126126
if( aCommand[lwr].eCmdFlags & eType ){
127127
if( mid<0 ){
128128
mid = lwr; /* Potential ambiguous prefix */
129129
}else{
130
- return 2; /* Confirmed ambiguous prefix */
130
+ if( aCommand[lwr].xFunc != aCommand[mid].xFunc ){
131
+ return 2; /* Confirmed ambiguous prefix */
132
+ }
131133
}
132134
}
133135
}
134136
if( mid>=0 ){
135137
*ppCmd = &aCommand[mid];
@@ -207,16 +209,21 @@
207209
return 0;
208210
}
209211
210212
/*
211213
** Fill Blob with a space-separated list of all command names that
212
-** match the prefix zPrefix.
214
+** match the prefix zPrefix and the eType CMDFLAGS_ bits.
213215
*/
214
-void dispatch_matching_names(const char *zPrefix, Blob *pList){
216
+void dispatch_matching_names(
217
+ const char *zPrefix, /* name prefix */
218
+ unsigned eType, /* CMDFLAG_ bits */
219
+ Blob *pList /* space-separated list of command names */
220
+){
215221
int i;
216222
int nPrefix = (int)strlen(zPrefix);
217223
for(i=FOSSIL_FIRST_CMD; i<MX_COMMAND; i++){
224
+ if( (aCommand[i].eCmdFlags & eType)==0 ) continue;
218225
if( strncmp(zPrefix, aCommand[i].zName, nPrefix)==0 ){
219226
blob_appendf(pList, " %s", aCommand[i].zName);
220227
}
221228
}
222229
}
223230
--- src/dispatch.c
+++ src/dispatch.c
@@ -125,11 +125,13 @@
125 && strncmp(zName, aCommand[lwr].zName, nName)==0; ++lwr ){
126 if( aCommand[lwr].eCmdFlags & eType ){
127 if( mid<0 ){
128 mid = lwr; /* Potential ambiguous prefix */
129 }else{
130 return 2; /* Confirmed ambiguous prefix */
 
 
131 }
132 }
133 }
134 if( mid>=0 ){
135 *ppCmd = &aCommand[mid];
@@ -207,16 +209,21 @@
207 return 0;
208 }
209
210 /*
211 ** Fill Blob with a space-separated list of all command names that
212 ** match the prefix zPrefix.
213 */
214 void dispatch_matching_names(const char *zPrefix, Blob *pList){
 
 
 
 
215 int i;
216 int nPrefix = (int)strlen(zPrefix);
217 for(i=FOSSIL_FIRST_CMD; i<MX_COMMAND; i++){
 
218 if( strncmp(zPrefix, aCommand[i].zName, nPrefix)==0 ){
219 blob_appendf(pList, " %s", aCommand[i].zName);
220 }
221 }
222 }
223
--- src/dispatch.c
+++ src/dispatch.c
@@ -125,11 +125,13 @@
125 && strncmp(zName, aCommand[lwr].zName, nName)==0; ++lwr ){
126 if( aCommand[lwr].eCmdFlags & eType ){
127 if( mid<0 ){
128 mid = lwr; /* Potential ambiguous prefix */
129 }else{
130 if( aCommand[lwr].xFunc != aCommand[mid].xFunc ){
131 return 2; /* Confirmed ambiguous prefix */
132 }
133 }
134 }
135 }
136 if( mid>=0 ){
137 *ppCmd = &aCommand[mid];
@@ -207,16 +209,21 @@
209 return 0;
210 }
211
212 /*
213 ** Fill Blob with a space-separated list of all command names that
214 ** match the prefix zPrefix and the eType CMDFLAGS_ bits.
215 */
216 void dispatch_matching_names(
217 const char *zPrefix, /* name prefix */
218 unsigned eType, /* CMDFLAG_ bits */
219 Blob *pList /* space-separated list of command names */
220 ){
221 int i;
222 int nPrefix = (int)strlen(zPrefix);
223 for(i=FOSSIL_FIRST_CMD; i<MX_COMMAND; i++){
224 if( (aCommand[i].eCmdFlags & eType)==0 ) continue;
225 if( strncmp(zPrefix, aCommand[i].zName, nPrefix)==0 ){
226 blob_appendf(pList, " %s", aCommand[i].zName);
227 }
228 }
229 }
230
+191
--- src/info.c
+++ src/info.c
@@ -3678,5 +3678,196 @@
36783678
db_column_text(&q,2),
36793679
db_column_text(&q,3));
36803680
}
36813681
db_finalize(&q);
36823682
}
3683
+
3684
+#if INTERFACE
3685
+/*
3686
+** Description of a check-in relative to an earlier, tagged check-in.
3687
+*/
3688
+typedef struct CommitDescr {
3689
+ char *zRelTagname; /* Tag name on the relative check-in */
3690
+ int nCommitsSince; /* Number of commits since then */
3691
+ char *zCommitHash; /* Hash of the described check-in */
3692
+ int isDirty; /* Working directory has uncommitted changes */
3693
+} CommitDescr;
3694
+#endif
3695
+
3696
+/*
3697
+** Describe the check-in given by 'zName', and possibly matching 'matchGlob',
3698
+** relative to an earlier, tagged check-in. Use 'descr' for the output.
3699
+**
3700
+** Finds the closest ancestor (ignoring merge-ins) that has a non-propagating
3701
+** label tag and the number of steps backwards that we had to search in
3702
+** order to find that tag. Tags applied to more than one check-in are ignored.
3703
+**
3704
+** Return values:
3705
+** 0: ok
3706
+** -1: zName does not resolve to a commit
3707
+** -2: zName resolves to more than a commit
3708
+** -3: no ancestor commit with a fitting non-propagating tag found
3709
+*/
3710
+int describe_commit(
3711
+ const char *zName, /* Name of the commit to be described */
3712
+ const char *matchGlob, /* Glob pattern for the tag */
3713
+ CommitDescr *descr /* Write the description here */
3714
+){
3715
+ int rid; /* rid for zName */
3716
+ const char *zUuid; /* Hash of rid */
3717
+ int nRet = 0; /* Value to be returned */
3718
+ Stmt q; /* Query for tagged ancestors */
3719
+
3720
+ rid = symbolic_name_to_rid(zName, "ci"); /* only commits */
3721
+
3722
+ if( rid<=0 ){
3723
+ /* Commit does not exist or is ambiguous */
3724
+ descr->zRelTagname = mprintf("");
3725
+ descr->nCommitsSince = -1;
3726
+ descr->zCommitHash = mprintf("");
3727
+ descr->isDirty = -1;
3728
+ return (rid-1);
3729
+ }
3730
+
3731
+ zUuid = rid_to_uuid(rid);
3732
+ descr->zCommitHash = mprintf("%s", zUuid);
3733
+ descr->isDirty = unsaved_changes(0);
3734
+
3735
+ db_multi_exec(
3736
+ "DROP TABLE IF EXISTS temp.singletonTag;"
3737
+ "CREATE TEMP TABLE singletonTag("
3738
+ " rid INT,"
3739
+ " tagname TEXT,"
3740
+ " PRIMARY KEY (rid,tagname)"
3741
+ ") WITHOUT ROWID;"
3742
+ "INSERT OR IGNORE INTO singletonTag(rid, tagname)"
3743
+ " SELECT min(rid),"
3744
+ " substr(tagname,5)"
3745
+ " FROM tag, tagxref"
3746
+ " WHERE tag.tagid=tagxref.tagid"
3747
+ " AND tagxref.tagtype=1"
3748
+ " AND tagname GLOB 'sym-%q'"
3749
+ " GROUP BY tagname"
3750
+ " HAVING count(*)==1;",
3751
+ (matchGlob ? matchGlob : "*")
3752
+ );
3753
+
3754
+ db_prepare(&q,
3755
+ "WITH RECURSIVE"
3756
+ " ancestor(rid,mtime,tagname,n) AS ("
3757
+ " SELECT %d, event.mtime, singletonTag.tagname, 0 "
3758
+ " FROM event"
3759
+ " LEFT JOIN singletonTag ON singletonTag.rid=event.objid"
3760
+ " WHERE event.objid=%d"
3761
+ " UNION ALL"
3762
+ " SELECT plink.pid, event.mtime, singletonTag.tagname, n+1"
3763
+ " FROM ancestor, plink, event"
3764
+ " LEFT JOIN singletonTag ON singletonTag.rid=plink.pid"
3765
+ " WHERE plink.cid=ancestor.rid"
3766
+ " AND event.objid=plink.pid"
3767
+ " AND ancestor.tagname IS NULL"
3768
+ " ORDER BY mtime DESC"
3769
+ " )"
3770
+ "SELECT tagname, n"
3771
+ " FROM ancestor"
3772
+ " WHERE tagname IS NOT NULL"
3773
+ " ORDER BY n LIMIT 1;",
3774
+ rid, rid
3775
+ );
3776
+
3777
+ if( db_step(&q)==SQLITE_ROW ){
3778
+ const char *lastTag = db_column_text(&q, 0);
3779
+ descr->zRelTagname = mprintf("%s", lastTag);
3780
+ descr->nCommitsSince = db_column_int(&q, 1);
3781
+ nRet = 0;
3782
+ }else{
3783
+ /* no ancestor commit with a fitting singleton tag found */
3784
+ descr->zRelTagname = mprintf("");
3785
+ descr->nCommitsSince = -1;
3786
+ nRet = -3;
3787
+ }
3788
+
3789
+ db_finalize(&q);
3790
+ return nRet;
3791
+}
3792
+
3793
+/*
3794
+** COMMAND: describe
3795
+**
3796
+** Usage: %fossil describe ?VERSION? ?OPTIONS?
3797
+**
3798
+** Provide a description of the given VERSION by showing a non-propagating
3799
+** tag of the youngest tagged ancestor, followed by the number of commits
3800
+** since that, and the short hash of VERSION. Only tags applied to a single
3801
+** check-in are considered.
3802
+**
3803
+** If no VERSION is provided, describe the current checked-out version.
3804
+**
3805
+** If VERSION and the found ancestor refer to the same commit, the last two
3806
+** components are omitted, unless --long is provided. When no fitting tagged
3807
+** ancestor is found, show only the short hash of VERSION.
3808
+**
3809
+** Options:
3810
+**
3811
+** --digits Display so many hex digits of the hash
3812
+** (default: the larger of 6 and the 'hash-digit' setting)
3813
+** -d|--dirty Show whether there are changes to be committed
3814
+** --long Always show all three components
3815
+** --match GLOB Consider only non-propagating tags matching GLOB
3816
+*/
3817
+void describe_cmd(void){
3818
+ const char *zName;
3819
+ const char *zMatchGlob;
3820
+ const char *zDigits;
3821
+ int nDigits;
3822
+ int bDirtyFlag = 0;
3823
+ int bLongFlag = 0;
3824
+ CommitDescr descr;
3825
+
3826
+ db_find_and_open_repository(0,0);
3827
+ bDirtyFlag = find_option("dirty","d",0)!=0;
3828
+ bLongFlag = find_option("long","",0)!=0;
3829
+ zMatchGlob = find_option("match", 0, 1);
3830
+ zDigits = find_option("digits", 0, 1);
3831
+
3832
+ if ( !zDigits || ((nDigits=atoi(zDigits))==0) ){
3833
+ nDigits = hash_digits(0);
3834
+ }
3835
+
3836
+ /* We should be done with options.. */
3837
+ verify_all_options();
3838
+ if( g.argc<3 ){
3839
+ zName = "current";
3840
+ }else{
3841
+ zName = g.argv[2];
3842
+ }
3843
+
3844
+ if( bDirtyFlag ){
3845
+ if ( g.argc>=3 ) fossil_fatal("cannot use --dirty with specific checkin");
3846
+ }
3847
+
3848
+ switch( describe_commit(zName, zMatchGlob, &descr) ){
3849
+ case -1:
3850
+ fossil_fatal("commit %s does not exist", zName);
3851
+ break;
3852
+ case -2:
3853
+ fossil_fatal("commit %s is ambiguous", zName);
3854
+ break;
3855
+ case -3:
3856
+ fossil_print("%.*s%s\n", nDigits, descr.zCommitHash,
3857
+ bDirtyFlag ? (descr.isDirty ? "-dirty" : "") : "");
3858
+ break;
3859
+ case 0:
3860
+ if( descr.nCommitsSince==0 && !bLongFlag ){
3861
+ fossil_print("%s%s\n", descr.zRelTagname,
3862
+ bDirtyFlag ? (descr.isDirty ? "-dirty" : "") : "");
3863
+ }else{
3864
+ fossil_print("%s-%d-%.*s%s\n", descr.zRelTagname,
3865
+ descr.nCommitsSince, nDigits, descr.zCommitHash,
3866
+ bDirtyFlag ? (descr.isDirty ? "-dirty" : "") : "");
3867
+ }
3868
+ break;
3869
+ default:
3870
+ fossil_fatal("cannot describe commit");
3871
+ break;
3872
+ }
3873
+}
36833874
--- src/info.c
+++ src/info.c
@@ -3678,5 +3678,196 @@
3678 db_column_text(&q,2),
3679 db_column_text(&q,3));
3680 }
3681 db_finalize(&q);
3682 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3683
--- src/info.c
+++ src/info.c
@@ -3678,5 +3678,196 @@
3678 db_column_text(&q,2),
3679 db_column_text(&q,3));
3680 }
3681 db_finalize(&q);
3682 }
3683
3684 #if INTERFACE
3685 /*
3686 ** Description of a check-in relative to an earlier, tagged check-in.
3687 */
3688 typedef struct CommitDescr {
3689 char *zRelTagname; /* Tag name on the relative check-in */
3690 int nCommitsSince; /* Number of commits since then */
3691 char *zCommitHash; /* Hash of the described check-in */
3692 int isDirty; /* Working directory has uncommitted changes */
3693 } CommitDescr;
3694 #endif
3695
3696 /*
3697 ** Describe the check-in given by 'zName', and possibly matching 'matchGlob',
3698 ** relative to an earlier, tagged check-in. Use 'descr' for the output.
3699 **
3700 ** Finds the closest ancestor (ignoring merge-ins) that has a non-propagating
3701 ** label tag and the number of steps backwards that we had to search in
3702 ** order to find that tag. Tags applied to more than one check-in are ignored.
3703 **
3704 ** Return values:
3705 ** 0: ok
3706 ** -1: zName does not resolve to a commit
3707 ** -2: zName resolves to more than a commit
3708 ** -3: no ancestor commit with a fitting non-propagating tag found
3709 */
3710 int describe_commit(
3711 const char *zName, /* Name of the commit to be described */
3712 const char *matchGlob, /* Glob pattern for the tag */
3713 CommitDescr *descr /* Write the description here */
3714 ){
3715 int rid; /* rid for zName */
3716 const char *zUuid; /* Hash of rid */
3717 int nRet = 0; /* Value to be returned */
3718 Stmt q; /* Query for tagged ancestors */
3719
3720 rid = symbolic_name_to_rid(zName, "ci"); /* only commits */
3721
3722 if( rid<=0 ){
3723 /* Commit does not exist or is ambiguous */
3724 descr->zRelTagname = mprintf("");
3725 descr->nCommitsSince = -1;
3726 descr->zCommitHash = mprintf("");
3727 descr->isDirty = -1;
3728 return (rid-1);
3729 }
3730
3731 zUuid = rid_to_uuid(rid);
3732 descr->zCommitHash = mprintf("%s", zUuid);
3733 descr->isDirty = unsaved_changes(0);
3734
3735 db_multi_exec(
3736 "DROP TABLE IF EXISTS temp.singletonTag;"
3737 "CREATE TEMP TABLE singletonTag("
3738 " rid INT,"
3739 " tagname TEXT,"
3740 " PRIMARY KEY (rid,tagname)"
3741 ") WITHOUT ROWID;"
3742 "INSERT OR IGNORE INTO singletonTag(rid, tagname)"
3743 " SELECT min(rid),"
3744 " substr(tagname,5)"
3745 " FROM tag, tagxref"
3746 " WHERE tag.tagid=tagxref.tagid"
3747 " AND tagxref.tagtype=1"
3748 " AND tagname GLOB 'sym-%q'"
3749 " GROUP BY tagname"
3750 " HAVING count(*)==1;",
3751 (matchGlob ? matchGlob : "*")
3752 );
3753
3754 db_prepare(&q,
3755 "WITH RECURSIVE"
3756 " ancestor(rid,mtime,tagname,n) AS ("
3757 " SELECT %d, event.mtime, singletonTag.tagname, 0 "
3758 " FROM event"
3759 " LEFT JOIN singletonTag ON singletonTag.rid=event.objid"
3760 " WHERE event.objid=%d"
3761 " UNION ALL"
3762 " SELECT plink.pid, event.mtime, singletonTag.tagname, n+1"
3763 " FROM ancestor, plink, event"
3764 " LEFT JOIN singletonTag ON singletonTag.rid=plink.pid"
3765 " WHERE plink.cid=ancestor.rid"
3766 " AND event.objid=plink.pid"
3767 " AND ancestor.tagname IS NULL"
3768 " ORDER BY mtime DESC"
3769 " )"
3770 "SELECT tagname, n"
3771 " FROM ancestor"
3772 " WHERE tagname IS NOT NULL"
3773 " ORDER BY n LIMIT 1;",
3774 rid, rid
3775 );
3776
3777 if( db_step(&q)==SQLITE_ROW ){
3778 const char *lastTag = db_column_text(&q, 0);
3779 descr->zRelTagname = mprintf("%s", lastTag);
3780 descr->nCommitsSince = db_column_int(&q, 1);
3781 nRet = 0;
3782 }else{
3783 /* no ancestor commit with a fitting singleton tag found */
3784 descr->zRelTagname = mprintf("");
3785 descr->nCommitsSince = -1;
3786 nRet = -3;
3787 }
3788
3789 db_finalize(&q);
3790 return nRet;
3791 }
3792
3793 /*
3794 ** COMMAND: describe
3795 **
3796 ** Usage: %fossil describe ?VERSION? ?OPTIONS?
3797 **
3798 ** Provide a description of the given VERSION by showing a non-propagating
3799 ** tag of the youngest tagged ancestor, followed by the number of commits
3800 ** since that, and the short hash of VERSION. Only tags applied to a single
3801 ** check-in are considered.
3802 **
3803 ** If no VERSION is provided, describe the current checked-out version.
3804 **
3805 ** If VERSION and the found ancestor refer to the same commit, the last two
3806 ** components are omitted, unless --long is provided. When no fitting tagged
3807 ** ancestor is found, show only the short hash of VERSION.
3808 **
3809 ** Options:
3810 **
3811 ** --digits Display so many hex digits of the hash
3812 ** (default: the larger of 6 and the 'hash-digit' setting)
3813 ** -d|--dirty Show whether there are changes to be committed
3814 ** --long Always show all three components
3815 ** --match GLOB Consider only non-propagating tags matching GLOB
3816 */
3817 void describe_cmd(void){
3818 const char *zName;
3819 const char *zMatchGlob;
3820 const char *zDigits;
3821 int nDigits;
3822 int bDirtyFlag = 0;
3823 int bLongFlag = 0;
3824 CommitDescr descr;
3825
3826 db_find_and_open_repository(0,0);
3827 bDirtyFlag = find_option("dirty","d",0)!=0;
3828 bLongFlag = find_option("long","",0)!=0;
3829 zMatchGlob = find_option("match", 0, 1);
3830 zDigits = find_option("digits", 0, 1);
3831
3832 if ( !zDigits || ((nDigits=atoi(zDigits))==0) ){
3833 nDigits = hash_digits(0);
3834 }
3835
3836 /* We should be done with options.. */
3837 verify_all_options();
3838 if( g.argc<3 ){
3839 zName = "current";
3840 }else{
3841 zName = g.argv[2];
3842 }
3843
3844 if( bDirtyFlag ){
3845 if ( g.argc>=3 ) fossil_fatal("cannot use --dirty with specific checkin");
3846 }
3847
3848 switch( describe_commit(zName, zMatchGlob, &descr) ){
3849 case -1:
3850 fossil_fatal("commit %s does not exist", zName);
3851 break;
3852 case -2:
3853 fossil_fatal("commit %s is ambiguous", zName);
3854 break;
3855 case -3:
3856 fossil_print("%.*s%s\n", nDigits, descr.zCommitHash,
3857 bDirtyFlag ? (descr.isDirty ? "-dirty" : "") : "");
3858 break;
3859 case 0:
3860 if( descr.nCommitsSince==0 && !bLongFlag ){
3861 fossil_print("%s%s\n", descr.zRelTagname,
3862 bDirtyFlag ? (descr.isDirty ? "-dirty" : "") : "");
3863 }else{
3864 fossil_print("%s-%d-%.*s%s\n", descr.zRelTagname,
3865 descr.nCommitsSince, nDigits, descr.zCommitHash,
3866 bDirtyFlag ? (descr.isDirty ? "-dirty" : "") : "");
3867 }
3868 break;
3869 default:
3870 fossil_fatal("cannot describe commit");
3871 break;
3872 }
3873 }
3874
+1 -1
--- src/main.c
+++ src/main.c
@@ -911,11 +911,11 @@
911911
fossil_exit(0);
912912
#endif
913913
}else if( rc==2 ){
914914
Blob couldbe;
915915
blob_init(&couldbe,0,0);
916
- dispatch_matching_names(zCmdName, &couldbe);
916
+ dispatch_matching_names(zCmdName, CMDFLAG_COMMAND, &couldbe);
917917
fossil_print("%s: ambiguous command prefix: %s\n"
918918
"%s: could be any of:%s\n"
919919
"%s: use \"help\" for more information\n",
920920
g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]);
921921
fossil_exit(1);
922922
--- src/main.c
+++ src/main.c
@@ -911,11 +911,11 @@
911 fossil_exit(0);
912 #endif
913 }else if( rc==2 ){
914 Blob couldbe;
915 blob_init(&couldbe,0,0);
916 dispatch_matching_names(zCmdName, &couldbe);
917 fossil_print("%s: ambiguous command prefix: %s\n"
918 "%s: could be any of:%s\n"
919 "%s: use \"help\" for more information\n",
920 g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]);
921 fossil_exit(1);
922
--- src/main.c
+++ src/main.c
@@ -911,11 +911,11 @@
911 fossil_exit(0);
912 #endif
913 }else if( rc==2 ){
914 Blob couldbe;
915 blob_init(&couldbe,0,0);
916 dispatch_matching_names(zCmdName, CMDFLAG_COMMAND, &couldbe);
917 fossil_print("%s: ambiguous command prefix: %s\n"
918 "%s: could be any of:%s\n"
919 "%s: use \"help\" for more information\n",
920 g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]);
921 fossil_exit(1);
922
+4 -1
--- src/main.mk
+++ src/main.mk
@@ -675,10 +675,13 @@
675675
-DSQLITE_SHELL_IS_UTF8=1 \
676676
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
677677
-DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
678678
-DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
679679
-DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc
680
+
681
+# Setup the options used to compile the included Pikchr formatter.
682
+PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
680683
681684
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0 or 1.
682685
# If it is set to 1, then there is no need to build or link
683686
# the sqlite3.o object. Instead, the system SQLite will be linked
684687
# using -lsqlite3.
@@ -2101,11 +2104,11 @@
21012104
$(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
21022105
$(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
21032106
21042107
21052108
$(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2106
- $(XTCC) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2109
+ $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
21072110
21082111
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
21092112
$(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
21102113
21112114
#
21122115
--- src/main.mk
+++ src/main.mk
@@ -675,10 +675,13 @@
675 -DSQLITE_SHELL_IS_UTF8=1 \
676 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
677 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
678 -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
679 -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc
 
 
 
680
681 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0 or 1.
682 # If it is set to 1, then there is no need to build or link
683 # the sqlite3.o object. Instead, the system SQLite will be linked
684 # using -lsqlite3.
@@ -2101,11 +2104,11 @@
2101 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
2102 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
2103
2104
2105 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2106 $(XTCC) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2107
2108 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
2109 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
2110
2111 #
2112
--- src/main.mk
+++ src/main.mk
@@ -675,10 +675,13 @@
675 -DSQLITE_SHELL_IS_UTF8=1 \
676 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
677 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
678 -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
679 -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc
680
681 # Setup the options used to compile the included Pikchr formatter.
682 PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
683
684 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0 or 1.
685 # If it is set to 1, then there is no need to build or link
686 # the sqlite3.o object. Instead, the system SQLite will be linked
687 # using -lsqlite3.
@@ -2101,11 +2104,11 @@
2104 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
2105 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
2106
2107
2108 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2109 $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2110
2111 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
2112 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
2113
2114 #
2115
+3 -3
--- src/tag.c
+++ src/tag.c
@@ -656,11 +656,11 @@
656656
"SELECT tagname FROM tag"
657657
" WHERE EXISTS(SELECT 1 FROM tagxref"
658658
" WHERE tagid=tag.tagid"
659659
" AND tagtype%s%d)"
660660
" AND CASE WHEN %Q IS NULL THEN 1 ELSE tagname GLOB %Q||'*' "
661
- " END ORDER BY tagname",
661
+ " END ORDER BY tagname COLLATE uintnocase",
662662
zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
663663
nTagType, zTagPrefix, zTagPrefix
664664
);
665665
while( db_step(&q)==SQLITE_ROW ){
666666
const char *zName = db_column_text(&q, 0);
@@ -698,11 +698,11 @@
698698
}
699699
db_prepare(&q,
700700
"SELECT tagname, value FROM tagxref, tag"
701701
" WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
702702
" AND tagtype%s%d"
703
- " ORDER BY tagname",
703
+ " ORDER BY tagname COLLATE uintnocase",
704704
rid,
705705
zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
706706
nTagType
707707
);
708708
while( db_step(&q)==SQLITE_ROW ){
@@ -817,11 +817,11 @@
817817
" FROM tag"
818818
" WHERE EXISTS(SELECT 1 FROM tagxref"
819819
" WHERE tagid=tag.tagid"
820820
" AND tagtype=1)"
821821
" AND tagname GLOB 'sym-*'"
822
- " ORDER BY tagname"
822
+ " ORDER BY tagname COLLATE uintnocase"
823823
);
824824
@ <ul>
825825
while( db_step(&q)==SQLITE_ROW ){
826826
const char *zName = db_column_text(&q, 0);
827827
if( g.perm.Hyperlink ){
828828
--- src/tag.c
+++ src/tag.c
@@ -656,11 +656,11 @@
656 "SELECT tagname FROM tag"
657 " WHERE EXISTS(SELECT 1 FROM tagxref"
658 " WHERE tagid=tag.tagid"
659 " AND tagtype%s%d)"
660 " AND CASE WHEN %Q IS NULL THEN 1 ELSE tagname GLOB %Q||'*' "
661 " END ORDER BY tagname",
662 zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
663 nTagType, zTagPrefix, zTagPrefix
664 );
665 while( db_step(&q)==SQLITE_ROW ){
666 const char *zName = db_column_text(&q, 0);
@@ -698,11 +698,11 @@
698 }
699 db_prepare(&q,
700 "SELECT tagname, value FROM tagxref, tag"
701 " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
702 " AND tagtype%s%d"
703 " ORDER BY tagname",
704 rid,
705 zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
706 nTagType
707 );
708 while( db_step(&q)==SQLITE_ROW ){
@@ -817,11 +817,11 @@
817 " FROM tag"
818 " WHERE EXISTS(SELECT 1 FROM tagxref"
819 " WHERE tagid=tag.tagid"
820 " AND tagtype=1)"
821 " AND tagname GLOB 'sym-*'"
822 " ORDER BY tagname"
823 );
824 @ <ul>
825 while( db_step(&q)==SQLITE_ROW ){
826 const char *zName = db_column_text(&q, 0);
827 if( g.perm.Hyperlink ){
828
--- src/tag.c
+++ src/tag.c
@@ -656,11 +656,11 @@
656 "SELECT tagname FROM tag"
657 " WHERE EXISTS(SELECT 1 FROM tagxref"
658 " WHERE tagid=tag.tagid"
659 " AND tagtype%s%d)"
660 " AND CASE WHEN %Q IS NULL THEN 1 ELSE tagname GLOB %Q||'*' "
661 " END ORDER BY tagname COLLATE uintnocase",
662 zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
663 nTagType, zTagPrefix, zTagPrefix
664 );
665 while( db_step(&q)==SQLITE_ROW ){
666 const char *zName = db_column_text(&q, 0);
@@ -698,11 +698,11 @@
698 }
699 db_prepare(&q,
700 "SELECT tagname, value FROM tagxref, tag"
701 " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
702 " AND tagtype%s%d"
703 " ORDER BY tagname COLLATE uintnocase",
704 rid,
705 zTagType!=0 ? (fInverse!=0?"<>":"=") : ">"/*safe-for-%s*/,
706 nTagType
707 );
708 while( db_step(&q)==SQLITE_ROW ){
@@ -817,11 +817,11 @@
817 " FROM tag"
818 " WHERE EXISTS(SELECT 1 FROM tagxref"
819 " WHERE tagid=tag.tagid"
820 " AND tagtype=1)"
821 " AND tagname GLOB 'sym-*'"
822 " ORDER BY tagname COLLATE uintnocase"
823 );
824 @ <ul>
825 while( db_step(&q)==SQLITE_ROW ){
826 const char *zName = db_column_text(&q, 0);
827 if( g.perm.Hyperlink ){
828
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -249,10 +249,16 @@
249249
}
250250
#lappend SQLITE_OPTIONS -DSQLITE_ENABLE_FTS3=1
251251
#lappend SQLITE_OPTIONS -DSQLITE_ENABLE_STAT4
252252
#lappend SQLITE_OPTIONS -DSQLITE_WIN32_NO_ANSI
253253
#lappend SQLITE_OPTIONS -DSQLITE_WINNT_MAX_PATH_CHARS=4096
254
+
255
+# Options used to compile the Pikchr library.
256
+#
257
+set PIKCHR_OPTIONS {
258
+ -DPIKCHR_TOKEN_LIMIT=10000
259
+}
254260
255261
# Options used to compile the included SQLite shell.
256262
#
257263
set SHELL_OPTIONS [concat $SQLITE_OPTIONS {
258264
-Dmain=sqlite3_shell
@@ -354,10 +360,11 @@
354360
}
355361
356362
writeln [string map [list \
357363
<<<SQLITE_OPTIONS>>> [join $SQLITE_OPTIONS " \\\n "] \
358364
<<<SHELL_OPTIONS>>> [join $SHELL_OPTIONS " \\\n "] \
365
+ <<<PIKCHR_OPTIONS>>> [join $PIKCHR_OPTIONS " \\\n "] \
359366
<<<NEXT_LINE>>> \\] {
360367
all: $(OBJDIR) $(APPNAME)
361368
362369
install: all
363370
mkdir -p $(INSTALLDIR)
@@ -414,10 +421,13 @@
414421
# Setup the options used to compile the included SQLite library.
415422
SQLITE_OPTIONS = <<<SQLITE_OPTIONS>>>
416423
417424
# Setup the options used to compile the included SQLite shell.
418425
SHELL_OPTIONS = <<<SHELL_OPTIONS>>>
426
+
427
+# Setup the options used to compile the included Pikchr formatter.
428
+PIKCHR_OPTIONS = <<<PIKCHR_OPTIONS>>>
419429
420430
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0 or 1.
421431
# If it is set to 1, then there is no need to build or link
422432
# the sqlite3.o object. Instead, the system SQLite will be linked
423433
# using -lsqlite3.
@@ -544,11 +554,11 @@
544554
writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
545555
writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
546556
547557
writeln {
548558
$(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
549
- $(XTCC) -c $(SRCDIR_extsrc)/pikchr.c -o $@
559
+ $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
550560
551561
$(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
552562
$(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
553563
554564
#
@@ -1247,14 +1257,16 @@
12471257
set MINGW_SQLITE_OPTIONS $SQLITE_WIN32_OPTIONS
12481258
lappend MINGW_SQLITE_OPTIONS {$(MINGW_OPTIONS)}
12491259
lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
12501260
lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
12511261
1262
+set MINGW_PIKCHR_OPTIONS $PIKCHR_OPTIONS
1263
+
12521264
set j " \\\n "
12531265
writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
1254
-set j " \\\n "
12551266
writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS $j]\n"
1267
+writeln "PIKCHR_OPTIONS = [join $MINGW_PIKCHR_OPTIONS $j]\n"
12561268
12571269
writeln "\$(OBJDIR)/sqlite3.o:\t\$(SQLITE3_SRC) \$(SRCDIR)/../win/Makefile.mingw"
12581270
writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) \$(SEE_FLAGS) \\"
12591271
writeln "\t\t-c \$(SQLITE3_SRC) -o \$@\n"
12601272
@@ -1273,11 +1285,11 @@
12731285
12741286
writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
12751287
writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
12761288
12771289
writeln "\$(OBJDIR)/pikchr.o:\t\$(SRCDIR_extsrc)/pikchr.c"
1278
-writeln "\t\$(XTCC) -c \$(SRCDIR_extsrc)/pikchr.c -o \$@\n"
1290
+writeln "\t\$(XTCC) \$(PIKCHR_OPTIONS) -c \$(SRCDIR_extsrc)/pikchr.c -o \$@\n"
12791291
12801292
close $output_file
12811293
#
12821294
# End of the win/Makefile.mingw output
12831295
##############################################################################
@@ -1319,10 +1331,11 @@
13191331
TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
13201332
LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
13211333
}
13221334
writeln "SQLITE_OPTIONS = [join $SQLITE_OPTIONS { }]\n"
13231335
writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS { }]\n"
1336
+writeln "PIKCHR_OPTIONS = [join $PIKCHR_OPTIONS { }]\n"
13241337
writeln -nonewline "SRC ="
13251338
foreach s [lsort $src] {
13261339
writeln -nonewline " ${s}_.c"
13271340
}
13281341
writeln "\n"
@@ -1763,10 +1776,14 @@
17631776
17641777
regsub -all {[-]D} [join $SHELL_WIN32_OPTIONS { }] {/D} MSC_SHELL_OPTIONS
17651778
set j " \\\n "
17661779
writeln "SHELL_OPTIONS = [join $MSC_SHELL_OPTIONS $j]\n"
17671780
1781
+regsub -all {[-]D} [join $PIKCHR_OPTIONS { }] {/D} MSC_PIKCHR_OPTIONS
1782
+set j " \\\n "
1783
+writeln "PIKCHR_OPTIONS = [join $MSC_PIKCHR_OPTIONS $j]\n"
1784
+
17681785
writeln -nonewline "SRC = "
17691786
set i 0
17701787
foreach s [lsort $src] {
17711788
if {$i > 0} {
17721789
writeln " \\"
@@ -1948,11 +1965,11 @@
19481965
19491966
"$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
19501967
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
19511968
19521969
"$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1953
- $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1970
+ $(TCC) $(PIKCHR_OPTIONS) /Fo$@ /Fd$(@D)\ -c $**
19541971
19551972
"$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
19561973
"$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
19571974
19581975
"$(B)\phony.h" :
19591976
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -249,10 +249,16 @@
249 }
250 #lappend SQLITE_OPTIONS -DSQLITE_ENABLE_FTS3=1
251 #lappend SQLITE_OPTIONS -DSQLITE_ENABLE_STAT4
252 #lappend SQLITE_OPTIONS -DSQLITE_WIN32_NO_ANSI
253 #lappend SQLITE_OPTIONS -DSQLITE_WINNT_MAX_PATH_CHARS=4096
 
 
 
 
 
 
254
255 # Options used to compile the included SQLite shell.
256 #
257 set SHELL_OPTIONS [concat $SQLITE_OPTIONS {
258 -Dmain=sqlite3_shell
@@ -354,10 +360,11 @@
354 }
355
356 writeln [string map [list \
357 <<<SQLITE_OPTIONS>>> [join $SQLITE_OPTIONS " \\\n "] \
358 <<<SHELL_OPTIONS>>> [join $SHELL_OPTIONS " \\\n "] \
 
359 <<<NEXT_LINE>>> \\] {
360 all: $(OBJDIR) $(APPNAME)
361
362 install: all
363 mkdir -p $(INSTALLDIR)
@@ -414,10 +421,13 @@
414 # Setup the options used to compile the included SQLite library.
415 SQLITE_OPTIONS = <<<SQLITE_OPTIONS>>>
416
417 # Setup the options used to compile the included SQLite shell.
418 SHELL_OPTIONS = <<<SHELL_OPTIONS>>>
 
 
 
419
420 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0 or 1.
421 # If it is set to 1, then there is no need to build or link
422 # the sqlite3.o object. Instead, the system SQLite will be linked
423 # using -lsqlite3.
@@ -544,11 +554,11 @@
544 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
545 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
546
547 writeln {
548 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
549 $(XTCC) -c $(SRCDIR_extsrc)/pikchr.c -o $@
550
551 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
552 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
553
554 #
@@ -1247,14 +1257,16 @@
1247 set MINGW_SQLITE_OPTIONS $SQLITE_WIN32_OPTIONS
1248 lappend MINGW_SQLITE_OPTIONS {$(MINGW_OPTIONS)}
1249 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
1250 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
1251
 
 
1252 set j " \\\n "
1253 writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
1254 set j " \\\n "
1255 writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS $j]\n"
 
1256
1257 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SQLITE3_SRC) \$(SRCDIR)/../win/Makefile.mingw"
1258 writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) \$(SEE_FLAGS) \\"
1259 writeln "\t\t-c \$(SQLITE3_SRC) -o \$@\n"
1260
@@ -1273,11 +1285,11 @@
1273
1274 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
1275 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
1276
1277 writeln "\$(OBJDIR)/pikchr.o:\t\$(SRCDIR_extsrc)/pikchr.c"
1278 writeln "\t\$(XTCC) -c \$(SRCDIR_extsrc)/pikchr.c -o \$@\n"
1279
1280 close $output_file
1281 #
1282 # End of the win/Makefile.mingw output
1283 ##############################################################################
@@ -1319,10 +1331,11 @@
1319 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
1320 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
1321 }
1322 writeln "SQLITE_OPTIONS = [join $SQLITE_OPTIONS { }]\n"
1323 writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS { }]\n"
 
1324 writeln -nonewline "SRC ="
1325 foreach s [lsort $src] {
1326 writeln -nonewline " ${s}_.c"
1327 }
1328 writeln "\n"
@@ -1763,10 +1776,14 @@
1763
1764 regsub -all {[-]D} [join $SHELL_WIN32_OPTIONS { }] {/D} MSC_SHELL_OPTIONS
1765 set j " \\\n "
1766 writeln "SHELL_OPTIONS = [join $MSC_SHELL_OPTIONS $j]\n"
1767
 
 
 
 
1768 writeln -nonewline "SRC = "
1769 set i 0
1770 foreach s [lsort $src] {
1771 if {$i > 0} {
1772 writeln " \\"
@@ -1948,11 +1965,11 @@
1948
1949 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1950 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1951
1952 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1953 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1954
1955 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1956 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1957
1958 "$(B)\phony.h" :
1959
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -249,10 +249,16 @@
249 }
250 #lappend SQLITE_OPTIONS -DSQLITE_ENABLE_FTS3=1
251 #lappend SQLITE_OPTIONS -DSQLITE_ENABLE_STAT4
252 #lappend SQLITE_OPTIONS -DSQLITE_WIN32_NO_ANSI
253 #lappend SQLITE_OPTIONS -DSQLITE_WINNT_MAX_PATH_CHARS=4096
254
255 # Options used to compile the Pikchr library.
256 #
257 set PIKCHR_OPTIONS {
258 -DPIKCHR_TOKEN_LIMIT=10000
259 }
260
261 # Options used to compile the included SQLite shell.
262 #
263 set SHELL_OPTIONS [concat $SQLITE_OPTIONS {
264 -Dmain=sqlite3_shell
@@ -354,10 +360,11 @@
360 }
361
362 writeln [string map [list \
363 <<<SQLITE_OPTIONS>>> [join $SQLITE_OPTIONS " \\\n "] \
364 <<<SHELL_OPTIONS>>> [join $SHELL_OPTIONS " \\\n "] \
365 <<<PIKCHR_OPTIONS>>> [join $PIKCHR_OPTIONS " \\\n "] \
366 <<<NEXT_LINE>>> \\] {
367 all: $(OBJDIR) $(APPNAME)
368
369 install: all
370 mkdir -p $(INSTALLDIR)
@@ -414,10 +421,13 @@
421 # Setup the options used to compile the included SQLite library.
422 SQLITE_OPTIONS = <<<SQLITE_OPTIONS>>>
423
424 # Setup the options used to compile the included SQLite shell.
425 SHELL_OPTIONS = <<<SHELL_OPTIONS>>>
426
427 # Setup the options used to compile the included Pikchr formatter.
428 PIKCHR_OPTIONS = <<<PIKCHR_OPTIONS>>>
429
430 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0 or 1.
431 # If it is set to 1, then there is no need to build or link
432 # the sqlite3.o object. Instead, the system SQLite will be linked
433 # using -lsqlite3.
@@ -544,11 +554,11 @@
554 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
555 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
556
557 writeln {
558 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
559 $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
560
561 $(OBJDIR)/cson_amalgamation.o: $(SRCDIR_extsrc)/cson_amalgamation.c
562 $(XTCC) -c $(SRCDIR_extsrc)/cson_amalgamation.c -o $@
563
564 #
@@ -1247,14 +1257,16 @@
1257 set MINGW_SQLITE_OPTIONS $SQLITE_WIN32_OPTIONS
1258 lappend MINGW_SQLITE_OPTIONS {$(MINGW_OPTIONS)}
1259 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
1260 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
1261
1262 set MINGW_PIKCHR_OPTIONS $PIKCHR_OPTIONS
1263
1264 set j " \\\n "
1265 writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
 
1266 writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS $j]\n"
1267 writeln "PIKCHR_OPTIONS = [join $MINGW_PIKCHR_OPTIONS $j]\n"
1268
1269 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SQLITE3_SRC) \$(SRCDIR)/../win/Makefile.mingw"
1270 writeln "\t\$(XTCC) \$(SQLITE_OPTIONS) \$(SQLITE_CFLAGS) \$(SEE_FLAGS) \\"
1271 writeln "\t\t-c \$(SQLITE3_SRC) -o \$@\n"
1272
@@ -1273,11 +1285,11 @@
1285
1286 writeln "\$(OBJDIR)/th_tcl.o:\t\$(SRCDIR)/th_tcl.c"
1287 writeln "\t\$(XTCC) -c \$(SRCDIR)/th_tcl.c -o \$@\n"
1288
1289 writeln "\$(OBJDIR)/pikchr.o:\t\$(SRCDIR_extsrc)/pikchr.c"
1290 writeln "\t\$(XTCC) \$(PIKCHR_OPTIONS) -c \$(SRCDIR_extsrc)/pikchr.c -o \$@\n"
1291
1292 close $output_file
1293 #
1294 # End of the win/Makefile.mingw output
1295 ##############################################################################
@@ -1319,10 +1331,11 @@
1331 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
1332 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
1333 }
1334 writeln "SQLITE_OPTIONS = [join $SQLITE_OPTIONS { }]\n"
1335 writeln "SHELL_OPTIONS = [join $SHELL_WIN32_OPTIONS { }]\n"
1336 writeln "PIKCHR_OPTIONS = [join $PIKCHR_OPTIONS { }]\n"
1337 writeln -nonewline "SRC ="
1338 foreach s [lsort $src] {
1339 writeln -nonewline " ${s}_.c"
1340 }
1341 writeln "\n"
@@ -1763,10 +1776,14 @@
1776
1777 regsub -all {[-]D} [join $SHELL_WIN32_OPTIONS { }] {/D} MSC_SHELL_OPTIONS
1778 set j " \\\n "
1779 writeln "SHELL_OPTIONS = [join $MSC_SHELL_OPTIONS $j]\n"
1780
1781 regsub -all {[-]D} [join $PIKCHR_OPTIONS { }] {/D} MSC_PIKCHR_OPTIONS
1782 set j " \\\n "
1783 writeln "PIKCHR_OPTIONS = [join $MSC_PIKCHR_OPTIONS $j]\n"
1784
1785 writeln -nonewline "SRC = "
1786 set i 0
1787 foreach s [lsort $src] {
1788 if {$i > 0} {
1789 writeln " \\"
@@ -1948,11 +1965,11 @@
1965
1966 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1967 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1968
1969 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1970 $(TCC) $(PIKCHR_OPTIONS) /Fo$@ /Fd$(@D)\ -c $**
1971
1972 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1973 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1974
1975 "$(B)\phony.h" :
1976
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -29,10 +29,12 @@
2929
LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
3030
3131
SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0
3232
3333
SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
34
+
35
+PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
3436
3537
SRC = add_.c ajax_.c alerts_.c allrepo_.c attach_.c backlink_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c chat_.c checkin_.c checkout_.c clearsign_.c clone_.c color_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c fileedit_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c hook_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c interwiki_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c patch_.c path_.c piechart_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c terminal_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c zip_.c
3638
3739
OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\chat$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\color$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\interwiki$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\patch$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pikchrshow$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
3840
3941
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -29,10 +29,12 @@
29 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
30
31 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0
32
33 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
 
 
34
35 SRC = add_.c ajax_.c alerts_.c allrepo_.c attach_.c backlink_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c chat_.c checkin_.c checkout_.c clearsign_.c clone_.c color_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c fileedit_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c hook_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c interwiki_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c patch_.c path_.c piechart_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c terminal_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c zip_.c
36
37 OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\chat$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\color$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\interwiki$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\patch$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pikchrshow$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
38
39
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -29,10 +29,12 @@
29 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi
30
31 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0
32
33 SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_TRUSTED_SCHEMA=0 -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
34
35 PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
36
37 SRC = add_.c ajax_.c alerts_.c allrepo_.c attach_.c backlink_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c chat_.c checkin_.c checkout_.c clearsign_.c clone_.c color_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c fileedit_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c hook_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c interwiki_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c patch_.c path_.c piechart_.c pikchrshow_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c terminal_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c xfer_.c xfersetup_.c zip_.c
38
39 OBJ = $(OBJDIR)\add$O $(OBJDIR)\ajax$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backlink$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\chat$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\color$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\fileedit$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\hook$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\interwiki$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\patch$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pikchrshow$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\terminal$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O
40
41
+34 -32
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2528,41 +2528,43 @@
25282528
$(MINGW_OPTIONS) \
25292529
-DSQLITE_USE_MALLOC_H \
25302530
-DSQLITE_USE_MSIZE
25312531
25322532
SHELL_OPTIONS = -DNDEBUG=1 \
2533
- -DSQLITE_DQS=0 \
2534
- -DSQLITE_THREADSAFE=0 \
2535
- -DSQLITE_DEFAULT_MEMSTATUS=0 \
2536
- -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
2537
- -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
2538
- -DSQLITE_OMIT_DECLTYPE \
2539
- -DSQLITE_OMIT_DEPRECATED \
2540
- -DSQLITE_OMIT_PROGRESS_CALLBACK \
2541
- -DSQLITE_OMIT_SHARED_CACHE \
2542
- -DSQLITE_OMIT_LOAD_EXTENSION \
2543
- -DSQLITE_MAX_EXPR_DEPTH=0 \
2544
- -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2545
- -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2546
- -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2547
- -DSQLITE_ENABLE_FTS4 \
2548
- -DSQLITE_ENABLE_DBSTAT_VTAB \
2549
- -DSQLITE_ENABLE_FTS5 \
2550
- -DSQLITE_ENABLE_STMTVTAB \
2551
- -DSQLITE_HAVE_ZLIB \
2552
- -DSQLITE_ENABLE_DBPAGE_VTAB \
2553
- -DSQLITE_TRUSTED_SCHEMA=0 \
2554
- -Dmain=sqlite3_shell \
2555
- -DSQLITE_SHELL_IS_UTF8=1 \
2556
- -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2557
- -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
2558
- -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
2559
- -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
2560
- -Daccess=file_access \
2561
- -Dsystem=fossil_system \
2562
- -Dgetenv=fossil_getenv \
2563
- -Dfopen=fossil_fopen
2533
+ -DSQLITE_DQS=0 \
2534
+ -DSQLITE_THREADSAFE=0 \
2535
+ -DSQLITE_DEFAULT_MEMSTATUS=0 \
2536
+ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
2537
+ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
2538
+ -DSQLITE_OMIT_DECLTYPE \
2539
+ -DSQLITE_OMIT_DEPRECATED \
2540
+ -DSQLITE_OMIT_PROGRESS_CALLBACK \
2541
+ -DSQLITE_OMIT_SHARED_CACHE \
2542
+ -DSQLITE_OMIT_LOAD_EXTENSION \
2543
+ -DSQLITE_MAX_EXPR_DEPTH=0 \
2544
+ -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2545
+ -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2546
+ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2547
+ -DSQLITE_ENABLE_FTS4 \
2548
+ -DSQLITE_ENABLE_DBSTAT_VTAB \
2549
+ -DSQLITE_ENABLE_FTS5 \
2550
+ -DSQLITE_ENABLE_STMTVTAB \
2551
+ -DSQLITE_HAVE_ZLIB \
2552
+ -DSQLITE_ENABLE_DBPAGE_VTAB \
2553
+ -DSQLITE_TRUSTED_SCHEMA=0 \
2554
+ -Dmain=sqlite3_shell \
2555
+ -DSQLITE_SHELL_IS_UTF8=1 \
2556
+ -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2557
+ -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
2558
+ -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
2559
+ -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
2560
+ -Daccess=file_access \
2561
+ -Dsystem=fossil_system \
2562
+ -Dgetenv=fossil_getenv \
2563
+ -Dfopen=fossil_fopen
2564
+
2565
+PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
25642566
25652567
$(OBJDIR)/sqlite3.o: $(SQLITE3_SRC) $(SRCDIR)/../win/Makefile.mingw
25662568
$(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) $(SEE_FLAGS) \
25672569
-c $(SQLITE3_SRC) -o $@
25682570
@@ -2582,7 +2584,7 @@
25822584
25832585
$(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
25842586
$(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
25852587
25862588
$(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2587
- $(XTCC) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2589
+ $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
25882590
25892591
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2528,41 +2528,43 @@
2528 $(MINGW_OPTIONS) \
2529 -DSQLITE_USE_MALLOC_H \
2530 -DSQLITE_USE_MSIZE
2531
2532 SHELL_OPTIONS = -DNDEBUG=1 \
2533 -DSQLITE_DQS=0 \
2534 -DSQLITE_THREADSAFE=0 \
2535 -DSQLITE_DEFAULT_MEMSTATUS=0 \
2536 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
2537 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
2538 -DSQLITE_OMIT_DECLTYPE \
2539 -DSQLITE_OMIT_DEPRECATED \
2540 -DSQLITE_OMIT_PROGRESS_CALLBACK \
2541 -DSQLITE_OMIT_SHARED_CACHE \
2542 -DSQLITE_OMIT_LOAD_EXTENSION \
2543 -DSQLITE_MAX_EXPR_DEPTH=0 \
2544 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2545 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2546 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2547 -DSQLITE_ENABLE_FTS4 \
2548 -DSQLITE_ENABLE_DBSTAT_VTAB \
2549 -DSQLITE_ENABLE_FTS5 \
2550 -DSQLITE_ENABLE_STMTVTAB \
2551 -DSQLITE_HAVE_ZLIB \
2552 -DSQLITE_ENABLE_DBPAGE_VTAB \
2553 -DSQLITE_TRUSTED_SCHEMA=0 \
2554 -Dmain=sqlite3_shell \
2555 -DSQLITE_SHELL_IS_UTF8=1 \
2556 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2557 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
2558 -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
2559 -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
2560 -Daccess=file_access \
2561 -Dsystem=fossil_system \
2562 -Dgetenv=fossil_getenv \
2563 -Dfopen=fossil_fopen
 
 
2564
2565 $(OBJDIR)/sqlite3.o: $(SQLITE3_SRC) $(SRCDIR)/../win/Makefile.mingw
2566 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) $(SEE_FLAGS) \
2567 -c $(SQLITE3_SRC) -o $@
2568
@@ -2582,7 +2584,7 @@
2582
2583 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
2584 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
2585
2586 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2587 $(XTCC) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2588
2589
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2528,41 +2528,43 @@
2528 $(MINGW_OPTIONS) \
2529 -DSQLITE_USE_MALLOC_H \
2530 -DSQLITE_USE_MSIZE
2531
2532 SHELL_OPTIONS = -DNDEBUG=1 \
2533 -DSQLITE_DQS=0 \
2534 -DSQLITE_THREADSAFE=0 \
2535 -DSQLITE_DEFAULT_MEMSTATUS=0 \
2536 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
2537 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
2538 -DSQLITE_OMIT_DECLTYPE \
2539 -DSQLITE_OMIT_DEPRECATED \
2540 -DSQLITE_OMIT_PROGRESS_CALLBACK \
2541 -DSQLITE_OMIT_SHARED_CACHE \
2542 -DSQLITE_OMIT_LOAD_EXTENSION \
2543 -DSQLITE_MAX_EXPR_DEPTH=0 \
2544 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2545 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2546 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2547 -DSQLITE_ENABLE_FTS4 \
2548 -DSQLITE_ENABLE_DBSTAT_VTAB \
2549 -DSQLITE_ENABLE_FTS5 \
2550 -DSQLITE_ENABLE_STMTVTAB \
2551 -DSQLITE_HAVE_ZLIB \
2552 -DSQLITE_ENABLE_DBPAGE_VTAB \
2553 -DSQLITE_TRUSTED_SCHEMA=0 \
2554 -Dmain=sqlite3_shell \
2555 -DSQLITE_SHELL_IS_UTF8=1 \
2556 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
2557 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
2558 -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \
2559 -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \
2560 -Daccess=file_access \
2561 -Dsystem=fossil_system \
2562 -Dgetenv=fossil_getenv \
2563 -Dfopen=fossil_fopen
2564
2565 PIKCHR_OPTIONS = -DPIKCHR_TOKEN_LIMIT=10000
2566
2567 $(OBJDIR)/sqlite3.o: $(SQLITE3_SRC) $(SRCDIR)/../win/Makefile.mingw
2568 $(XTCC) $(SQLITE_OPTIONS) $(SQLITE_CFLAGS) $(SEE_FLAGS) \
2569 -c $(SQLITE3_SRC) -o $@
2570
@@ -2582,7 +2584,7 @@
2584
2585 $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c
2586 $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@
2587
2588 $(OBJDIR)/pikchr.o: $(SRCDIR_extsrc)/pikchr.c
2589 $(XTCC) $(PIKCHR_OPTIONS) -c $(SRCDIR_extsrc)/pikchr.c -o $@
2590
2591
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -354,10 +354,12 @@
354354
/Daccess=file_access \
355355
/Dsystem=fossil_system \
356356
/Dgetenv=fossil_getenv \
357357
/Dfopen=fossil_fopen
358358
359
+PIKCHR_OPTIONS = /DPIKCHR_TOKEN_LIMIT=10000
360
+
359361
SRC = "$(OX)\add_.c" \
360362
"$(OX)\ajax_.c" \
361363
"$(OX)\alerts_.c" \
362364
"$(OX)\allrepo_.c" \
363365
"$(OX)\attach_.c" \
@@ -1060,11 +1062,11 @@
10601062
10611063
"$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
10621064
$(TCC) /Fo$@ /Fd$(@D)\ -c $**
10631065
10641066
"$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1065
- $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1067
+ $(TCC) $(PIKCHR_OPTIONS) /Fo$@ /Fd$(@D)\ -c $**
10661068
10671069
"$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
10681070
"$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
10691071
10701072
"$(B)\phony.h" :
10711073
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -354,10 +354,12 @@
354 /Daccess=file_access \
355 /Dsystem=fossil_system \
356 /Dgetenv=fossil_getenv \
357 /Dfopen=fossil_fopen
358
 
 
359 SRC = "$(OX)\add_.c" \
360 "$(OX)\ajax_.c" \
361 "$(OX)\alerts_.c" \
362 "$(OX)\allrepo_.c" \
363 "$(OX)\attach_.c" \
@@ -1060,11 +1062,11 @@
1060
1061 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1062 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1063
1064 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1065 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1066
1067 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1068 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1069
1070 "$(B)\phony.h" :
1071
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -354,10 +354,12 @@
354 /Daccess=file_access \
355 /Dsystem=fossil_system \
356 /Dgetenv=fossil_getenv \
357 /Dfopen=fossil_fopen
358
359 PIKCHR_OPTIONS = /DPIKCHR_TOKEN_LIMIT=10000
360
361 SRC = "$(OX)\add_.c" \
362 "$(OX)\ajax_.c" \
363 "$(OX)\alerts_.c" \
364 "$(OX)\allrepo_.c" \
365 "$(OX)\attach_.c" \
@@ -1060,11 +1062,11 @@
1062
1063 "$(OX)\th_tcl$O" : "$(SRCDIR)\th_tcl.c"
1064 $(TCC) /Fo$@ /Fd$(@D)\ -c $**
1065
1066 "$(OX)\pikchr$O" : "$(SRCDIR_extsrc)\pikchr.c"
1067 $(TCC) $(PIKCHR_OPTIONS) /Fo$@ /Fd$(@D)\ -c $**
1068
1069 "$(OX)\VERSION.h" : "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" "$(B)\phony.h"
1070 "$(OBJDIR)\mkversion$E" "$(B)\manifest.uuid" "$(B)\manifest" "$(B)\VERSION" > $@
1071
1072 "$(B)\phony.h" :
1073
--- www/changes.wiki
+++ www/changes.wiki
@@ -9,10 +9,11 @@
99
* Enhancements to the graph layout algorithm design to improve readability
1010
and promote better situational awareness.
1111
* Performance enhancement for the
1212
[./checkin_names.wiki#root|"root:BRANCHNAME" style of tag],
1313
accomplished using a Common Table Expression in the underlying SQL.
14
+ * Add the new "[/help?cmd=describe|fossil describe]" command.
1415
1516
<h2 id='v2_18'>Changes for version 2.18 (2022-02-23)</h2>
1617
* Added support for [./ssl-server.md|SSL/TLS server mode] for commands
1718
like "[/help?cmd=server|fossil server]" and "[/help?cmd=http|fossil http]"
1819
* The new [/help?cmd=cherry-pick|cherry-pick command] is an alias for
1920
--- www/changes.wiki
+++ www/changes.wiki
@@ -9,10 +9,11 @@
9 * Enhancements to the graph layout algorithm design to improve readability
10 and promote better situational awareness.
11 * Performance enhancement for the
12 [./checkin_names.wiki#root|"root:BRANCHNAME" style of tag],
13 accomplished using a Common Table Expression in the underlying SQL.
 
14
15 <h2 id='v2_18'>Changes for version 2.18 (2022-02-23)</h2>
16 * Added support for [./ssl-server.md|SSL/TLS server mode] for commands
17 like "[/help?cmd=server|fossil server]" and "[/help?cmd=http|fossil http]"
18 * The new [/help?cmd=cherry-pick|cherry-pick command] is an alias for
19
--- www/changes.wiki
+++ www/changes.wiki
@@ -9,10 +9,11 @@
9 * Enhancements to the graph layout algorithm design to improve readability
10 and promote better situational awareness.
11 * Performance enhancement for the
12 [./checkin_names.wiki#root|"root:BRANCHNAME" style of tag],
13 accomplished using a Common Table Expression in the underlying SQL.
14 * Add the new "[/help?cmd=describe|fossil describe]" command.
15
16 <h2 id='v2_18'>Changes for version 2.18 (2022-02-23)</h2>
17 * Added support for [./ssl-server.md|SSL/TLS server mode] for commands
18 like "[/help?cmd=server|fossil server]" and "[/help?cmd=http|fossil http]"
19 * The new [/help?cmd=cherry-pick|cherry-pick command] is an alias for
20

Keyboard Shortcuts

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