Fossil SCM

Update the built-in SQLite and Pikchr to the latest code, for testing.

drh 2020-09-16 13:45 trunk
Commit ecf679b28956ccb39787f9915e7446b3ee2577c03426f268af72c57afdf23d05
4 files changed +246 -224 +494 -23 +483 -162 +3 -2
+246 -224
--- src/pikchr.c
+++ src/pikchr.c
@@ -275,10 +275,11 @@
275275
#define A_COLOR 0x0040
276276
#define A_ARROW 0x0080
277277
#define A_FROM 0x0100
278278
#define A_CW 0x0200
279279
#define A_AT 0x0400
280
+#define A_TO 0x0800 /* one or more movement attributes */
280281
281282
282283
/* A single element */
283284
struct PElem {
284285
const PClass *type; /* Element type */
@@ -341,12 +342,13 @@
341342
PNum fontScale; /* Scale fonts by this percent */
342343
PNum charWidth; /* Character width */
343344
PNum charHeight; /* Character height */
344345
PNum wArrow; /* Width of arrowhead at the fat end */
345346
PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */
346
- int bLayoutVars; /* True if cache is valid */
347
+ char bLayoutVars; /* True if cache is valid */
347348
char thenFlag; /* True if "then" seen */
349
+ char samePath; /* aTPath copied by "same" */
348350
const char *zClass; /* Class name for the <svg> */
349351
int wSVG, hSVG; /* Width and height of the <svg> */
350352
/* Paths for lines are constructed here first, then transferred into
351353
** the PElem object at the end: */
352354
int nTPath; /* Number of entries on aTPath[] */
@@ -450,11 +452,11 @@
450452
static void pik_behind(Pik*,PElem*);
451453
static PElem *pik_assert(Pik*,PNum,PToken*,PNum);
452454
static PElem *pik_place_assert(Pik*,PPoint*,PToken*,PPoint*);
453455
454456
455
-#line 481 "pikchr.c"
457
+#line 483 "pikchr.c"
456458
/**************** End of %include directives **********************************/
457459
/* These constants specify the various numeric values for terminal symbols.
458460
***************** Begin token definitions *************************************/
459461
#ifndef T_ID
460462
#define T_ID 1
@@ -1626,22 +1628,22 @@
16261628
** inside the C code.
16271629
*/
16281630
/********* Begin destructor definitions ***************************************/
16291631
case 94: /* element_list */
16301632
{
1631
-#line 470 "pikchr.y"
1633
+#line 472 "pikchr.y"
16321634
pik_elist_free(p,(yypminor->yy72));
1633
-#line 1658 "pikchr.c"
1635
+#line 1660 "pikchr.c"
16341636
}
16351637
break;
16361638
case 95: /* element */
16371639
case 96: /* unnamed_element */
16381640
case 97: /* basetype */
16391641
{
1640
-#line 472 "pikchr.y"
1642
+#line 474 "pikchr.y"
16411643
pik_elem_free(p,(yypminor->yy254));
1642
-#line 1667 "pikchr.c"
1644
+#line 1669 "pikchr.c"
16431645
}
16441646
break;
16451647
/********* End destructor definitions *****************************************/
16461648
default: break; /* If no destructor action specified: do nothing */
16471649
}
@@ -1855,14 +1857,14 @@
18551857
#endif
18561858
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
18571859
/* Here code is inserted which will execute if the parser
18581860
** stack every overflows */
18591861
/******** Begin %stack_overflow code ******************************************/
1860
-#line 503 "pikchr.y"
1862
+#line 505 "pikchr.y"
18611863
18621864
pik_error(p, 0, "parser stack overflow");
1863
-#line 1888 "pikchr.c"
1865
+#line 1890 "pikchr.c"
18641866
/******** End %stack_overflow code ********************************************/
18651867
pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
18661868
pik_parserCTX_STORE
18671869
}
18681870
@@ -2327,593 +2329,593 @@
23272329
** break;
23282330
*/
23292331
/********** Begin reduce actions **********************************************/
23302332
YYMINORTYPE yylhsminor;
23312333
case 0: /* document ::= element_list */
2332
-#line 507 "pikchr.y"
2334
+#line 509 "pikchr.y"
23332335
{pik_render(p,yymsp[0].minor.yy72);}
2334
-#line 2359 "pikchr.c"
2336
+#line 2361 "pikchr.c"
23352337
break;
23362338
case 1: /* element_list ::= element */
2337
-#line 510 "pikchr.y"
2339
+#line 512 "pikchr.y"
23382340
{ yylhsminor.yy72 = pik_elist_append(p,0,yymsp[0].minor.yy254); }
2339
-#line 2364 "pikchr.c"
2341
+#line 2366 "pikchr.c"
23402342
yymsp[0].minor.yy72 = yylhsminor.yy72;
23412343
break;
23422344
case 2: /* element_list ::= element_list EOL element */
2343
-#line 512 "pikchr.y"
2345
+#line 514 "pikchr.y"
23442346
{ yylhsminor.yy72 = pik_elist_append(p,yymsp[-2].minor.yy72,yymsp[0].minor.yy254); }
2345
-#line 2370 "pikchr.c"
2347
+#line 2372 "pikchr.c"
23462348
yymsp[-2].minor.yy72 = yylhsminor.yy72;
23472349
break;
23482350
case 3: /* element ::= */
2349
-#line 515 "pikchr.y"
2351
+#line 517 "pikchr.y"
23502352
{ yymsp[1].minor.yy254 = 0; }
2351
-#line 2376 "pikchr.c"
2353
+#line 2378 "pikchr.c"
23522354
break;
23532355
case 4: /* element ::= direction */
2354
-#line 516 "pikchr.y"
2356
+#line 518 "pikchr.y"
23552357
{ pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy254=0; }
2356
-#line 2381 "pikchr.c"
2358
+#line 2383 "pikchr.c"
23572359
yymsp[0].minor.yy254 = yylhsminor.yy254;
23582360
break;
23592361
case 5: /* element ::= lvalue ASSIGN rvalue */
2360
-#line 517 "pikchr.y"
2362
+#line 519 "pikchr.y"
23612363
{pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy73,&yymsp[-1].minor.yy0); yylhsminor.yy254=0;}
2362
-#line 2387 "pikchr.c"
2364
+#line 2389 "pikchr.c"
23632365
yymsp[-2].minor.yy254 = yylhsminor.yy254;
23642366
break;
23652367
case 6: /* element ::= PLACENAME COLON unnamed_element */
2366
-#line 519 "pikchr.y"
2368
+#line 521 "pikchr.y"
23672369
{ yylhsminor.yy254 = yymsp[0].minor.yy254; pik_elem_setname(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0); }
2368
-#line 2393 "pikchr.c"
2370
+#line 2395 "pikchr.c"
23692371
yymsp[-2].minor.yy254 = yylhsminor.yy254;
23702372
break;
23712373
case 7: /* element ::= PLACENAME COLON position */
2372
-#line 521 "pikchr.y"
2374
+#line 523 "pikchr.y"
23732375
{ yylhsminor.yy254 = pik_elem_new(p,0,0,0);
23742376
if(yylhsminor.yy254){ yylhsminor.yy254->ptAt = yymsp[0].minor.yy139; pik_elem_setname(p,yylhsminor.yy254,&yymsp[-2].minor.yy0); }}
2375
-#line 2400 "pikchr.c"
2377
+#line 2402 "pikchr.c"
23762378
yymsp[-2].minor.yy254 = yylhsminor.yy254;
23772379
break;
23782380
case 8: /* element ::= unnamed_element */
2379
-#line 523 "pikchr.y"
2381
+#line 525 "pikchr.y"
23802382
{yylhsminor.yy254 = yymsp[0].minor.yy254;}
2381
-#line 2406 "pikchr.c"
2383
+#line 2408 "pikchr.c"
23822384
yymsp[0].minor.yy254 = yylhsminor.yy254;
23832385
break;
23842386
case 9: /* element ::= print prlist */
2385
-#line 524 "pikchr.y"
2387
+#line 526 "pikchr.y"
23862388
{pik_append(p,"<br>\n",5); yymsp[-1].minor.yy254=0;}
2387
-#line 2412 "pikchr.c"
2389
+#line 2414 "pikchr.c"
23882390
break;
23892391
case 10: /* element ::= ASSERT LP expr EQ expr RP */
2390
-#line 529 "pikchr.y"
2392
+#line 531 "pikchr.y"
23912393
{yymsp[-5].minor.yy254=pik_assert(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy73);}
2392
-#line 2417 "pikchr.c"
2394
+#line 2419 "pikchr.c"
23932395
break;
23942396
case 11: /* element ::= ASSERT LP place EQ place RP */
2395
-#line 531 "pikchr.y"
2397
+#line 533 "pikchr.y"
23962398
{yymsp[-5].minor.yy254=pik_place_assert(p,&yymsp[-3].minor.yy139,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy139);}
2397
-#line 2422 "pikchr.c"
2399
+#line 2424 "pikchr.c"
23982400
break;
23992401
case 12: /* rvalue ::= PLACENAME */
2400
-#line 542 "pikchr.y"
2402
+#line 544 "pikchr.y"
24012403
{yylhsminor.yy73 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2402
-#line 2427 "pikchr.c"
2404
+#line 2429 "pikchr.c"
24032405
yymsp[0].minor.yy73 = yylhsminor.yy73;
24042406
break;
24052407
case 13: /* pritem ::= FILL */
24062408
case 14: /* pritem ::= COLOR */ yytestcase(yyruleno==14);
24072409
case 15: /* pritem ::= THICKNESS */ yytestcase(yyruleno==15);
2408
-#line 547 "pikchr.y"
2410
+#line 549 "pikchr.y"
24092411
{pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2410
-#line 2435 "pikchr.c"
2412
+#line 2437 "pikchr.c"
24112413
break;
24122414
case 16: /* pritem ::= rvalue */
2413
-#line 550 "pikchr.y"
2415
+#line 552 "pikchr.y"
24142416
{pik_append_num(p,"",yymsp[0].minor.yy73);}
2415
-#line 2440 "pikchr.c"
2417
+#line 2442 "pikchr.c"
24162418
break;
24172419
case 17: /* pritem ::= STRING */
2418
-#line 551 "pikchr.y"
2420
+#line 553 "pikchr.y"
24192421
{pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2420
-#line 2445 "pikchr.c"
2422
+#line 2447 "pikchr.c"
24212423
break;
24222424
case 18: /* prsep ::= COMMA */
2423
-#line 552 "pikchr.y"
2425
+#line 554 "pikchr.y"
24242426
{pik_append(p, " ", 1);}
2425
-#line 2450 "pikchr.c"
2427
+#line 2452 "pikchr.c"
24262428
break;
24272429
case 19: /* unnamed_element ::= basetype attribute_list */
2428
-#line 555 "pikchr.y"
2430
+#line 557 "pikchr.y"
24292431
{yylhsminor.yy254 = yymsp[-1].minor.yy254; pik_after_adding_attributes(p,yylhsminor.yy254);}
2430
-#line 2455 "pikchr.c"
2432
+#line 2457 "pikchr.c"
24312433
yymsp[-1].minor.yy254 = yylhsminor.yy254;
24322434
break;
24332435
case 20: /* basetype ::= CLASSNAME */
2434
-#line 557 "pikchr.y"
2436
+#line 559 "pikchr.y"
24352437
{yylhsminor.yy254 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2436
-#line 2461 "pikchr.c"
2438
+#line 2463 "pikchr.c"
24372439
yymsp[0].minor.yy254 = yylhsminor.yy254;
24382440
break;
24392441
case 21: /* basetype ::= STRING textposition */
2440
-#line 559 "pikchr.y"
2442
+#line 561 "pikchr.y"
24412443
{yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy74; yylhsminor.yy254 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2442
-#line 2467 "pikchr.c"
2444
+#line 2469 "pikchr.c"
24432445
yymsp[-1].minor.yy254 = yylhsminor.yy254;
24442446
break;
24452447
case 22: /* basetype ::= LB savelist element_list RB */
2446
-#line 561 "pikchr.y"
2448
+#line 563 "pikchr.y"
24472449
{ p->list = yymsp[-2].minor.yy72; yymsp[-3].minor.yy254 = pik_elem_new(p,0,0,yymsp[-1].minor.yy72); if(yymsp[-3].minor.yy254) yymsp[-3].minor.yy254->errTok = yymsp[0].minor.yy0; }
2448
-#line 2473 "pikchr.c"
2450
+#line 2475 "pikchr.c"
24492451
break;
24502452
case 23: /* savelist ::= */
2451
-#line 566 "pikchr.y"
2453
+#line 568 "pikchr.y"
24522454
{yymsp[1].minor.yy72 = p->list; p->list = 0;}
2453
-#line 2478 "pikchr.c"
2455
+#line 2480 "pikchr.c"
24542456
break;
24552457
case 24: /* relexpr ::= expr */
2456
-#line 573 "pikchr.y"
2458
+#line 575 "pikchr.y"
24572459
{yylhsminor.yy60.rAbs = yymsp[0].minor.yy73; yylhsminor.yy60.rRel = 0;}
2458
-#line 2483 "pikchr.c"
2460
+#line 2485 "pikchr.c"
24592461
yymsp[0].minor.yy60 = yylhsminor.yy60;
24602462
break;
24612463
case 25: /* relexpr ::= expr PERCENT */
2462
-#line 574 "pikchr.y"
2464
+#line 576 "pikchr.y"
24632465
{yylhsminor.yy60.rAbs = 0; yylhsminor.yy60.rRel = yymsp[-1].minor.yy73/100;}
2464
-#line 2489 "pikchr.c"
2466
+#line 2491 "pikchr.c"
24652467
yymsp[-1].minor.yy60 = yylhsminor.yy60;
24662468
break;
24672469
case 26: /* optrelexpr ::= */
2468
-#line 576 "pikchr.y"
2470
+#line 578 "pikchr.y"
24692471
{yymsp[1].minor.yy60.rAbs = 0; yymsp[1].minor.yy60.rRel = 1.0;}
2470
-#line 2495 "pikchr.c"
2472
+#line 2497 "pikchr.c"
24712473
break;
24722474
case 27: /* attribute_list ::= relexpr alist */
2473
-#line 578 "pikchr.y"
2475
+#line 580 "pikchr.y"
24742476
{pik_add_direction(p,0,&yymsp[-1].minor.yy60);}
2475
-#line 2500 "pikchr.c"
2477
+#line 2502 "pikchr.c"
24762478
break;
24772479
case 28: /* attribute ::= numproperty relexpr */
2478
-#line 582 "pikchr.y"
2480
+#line 584 "pikchr.y"
24792481
{ pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60); }
2480
-#line 2505 "pikchr.c"
2482
+#line 2507 "pikchr.c"
24812483
break;
24822484
case 29: /* attribute ::= dashproperty expr */
2483
-#line 583 "pikchr.y"
2485
+#line 585 "pikchr.y"
24842486
{ pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy73); }
2485
-#line 2510 "pikchr.c"
2487
+#line 2512 "pikchr.c"
24862488
break;
24872489
case 30: /* attribute ::= dashproperty */
2488
-#line 584 "pikchr.y"
2490
+#line 586 "pikchr.y"
24892491
{ pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2490
-#line 2515 "pikchr.c"
2492
+#line 2517 "pikchr.c"
24912493
break;
24922494
case 31: /* attribute ::= colorproperty rvalue */
2493
-#line 585 "pikchr.y"
2495
+#line 587 "pikchr.y"
24942496
{ pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73); }
2495
-#line 2520 "pikchr.c"
2497
+#line 2522 "pikchr.c"
24962498
break;
24972499
case 32: /* attribute ::= go direction optrelexpr */
2498
-#line 586 "pikchr.y"
2500
+#line 588 "pikchr.y"
24992501
{ pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60);}
2500
-#line 2525 "pikchr.c"
2502
+#line 2527 "pikchr.c"
25012503
break;
25022504
case 33: /* attribute ::= go direction even position */
2503
-#line 587 "pikchr.y"
2505
+#line 589 "pikchr.y"
25042506
{pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139);}
2505
-#line 2530 "pikchr.c"
2507
+#line 2532 "pikchr.c"
25062508
break;
25072509
case 34: /* attribute ::= CLOSE */
2508
-#line 588 "pikchr.y"
2510
+#line 590 "pikchr.y"
25092511
{ pik_close_path(p,&yymsp[0].minor.yy0); }
2510
-#line 2535 "pikchr.c"
2512
+#line 2537 "pikchr.c"
25112513
break;
25122514
case 35: /* attribute ::= CHOP */
2513
-#line 589 "pikchr.y"
2515
+#line 591 "pikchr.y"
25142516
{ p->cur->bChop = 1; }
2515
-#line 2540 "pikchr.c"
2517
+#line 2542 "pikchr.c"
25162518
break;
25172519
case 36: /* attribute ::= FROM position */
2518
-#line 590 "pikchr.y"
2520
+#line 592 "pikchr.y"
25192521
{ pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
2520
-#line 2545 "pikchr.c"
2522
+#line 2547 "pikchr.c"
25212523
break;
25222524
case 37: /* attribute ::= TO position */
2523
-#line 591 "pikchr.y"
2525
+#line 593 "pikchr.y"
25242526
{ pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
2525
-#line 2550 "pikchr.c"
2527
+#line 2552 "pikchr.c"
25262528
break;
25272529
case 38: /* attribute ::= THEN */
2528
-#line 592 "pikchr.y"
2530
+#line 594 "pikchr.y"
25292531
{ pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2530
-#line 2555 "pikchr.c"
2532
+#line 2557 "pikchr.c"
25312533
break;
25322534
case 39: /* attribute ::= THEN optrelexpr HEADING expr */
25332535
case 41: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==41);
2534
-#line 594 "pikchr.y"
2536
+#line 596 "pikchr.y"
25352537
{pik_move_hdg(p,&yymsp[-2].minor.yy60,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73,0,&yymsp[-3].minor.yy0);}
2536
-#line 2561 "pikchr.c"
2538
+#line 2563 "pikchr.c"
25372539
break;
25382540
case 40: /* attribute ::= THEN optrelexpr EDGEPT */
25392541
case 42: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==42);
2540
-#line 595 "pikchr.y"
2542
+#line 597 "pikchr.y"
25412543
{pik_move_hdg(p,&yymsp[-1].minor.yy60,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2542
-#line 2567 "pikchr.c"
2544
+#line 2569 "pikchr.c"
25432545
break;
25442546
case 43: /* attribute ::= AT position */
2545
-#line 600 "pikchr.y"
2547
+#line 602 "pikchr.y"
25462548
{ pik_set_at(p,0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
2547
-#line 2572 "pikchr.c"
2549
+#line 2574 "pikchr.c"
25482550
break;
25492551
case 44: /* attribute ::= SAME */
2550
-#line 602 "pikchr.y"
2552
+#line 604 "pikchr.y"
25512553
{pik_same(p,0,&yymsp[0].minor.yy0);}
2552
-#line 2577 "pikchr.c"
2554
+#line 2579 "pikchr.c"
25532555
break;
25542556
case 45: /* attribute ::= SAME AS object */
2555
-#line 603 "pikchr.y"
2557
+#line 605 "pikchr.y"
25562558
{pik_same(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2557
-#line 2582 "pikchr.c"
2559
+#line 2584 "pikchr.c"
25582560
break;
25592561
case 46: /* attribute ::= STRING textposition */
2560
-#line 604 "pikchr.y"
2562
+#line 606 "pikchr.y"
25612563
{pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy74);}
2562
-#line 2587 "pikchr.c"
2564
+#line 2589 "pikchr.c"
25632565
break;
25642566
case 47: /* attribute ::= FIT */
2565
-#line 605 "pikchr.y"
2567
+#line 607 "pikchr.y"
25662568
{pik_size_to_fit(p,&yymsp[0].minor.yy0); }
2567
-#line 2592 "pikchr.c"
2569
+#line 2594 "pikchr.c"
25682570
break;
25692571
case 48: /* attribute ::= BEHIND object */
2570
-#line 606 "pikchr.y"
2572
+#line 608 "pikchr.y"
25712573
{pik_behind(p,yymsp[0].minor.yy254);}
2572
-#line 2597 "pikchr.c"
2574
+#line 2599 "pikchr.c"
25732575
break;
25742576
case 49: /* withclause ::= DOT_E edge AT position */
25752577
case 50: /* withclause ::= edge AT position */ yytestcase(yyruleno==50);
2576
-#line 614 "pikchr.y"
2578
+#line 616 "pikchr.y"
25772579
{ pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
2578
-#line 2603 "pikchr.c"
2580
+#line 2605 "pikchr.c"
25792581
break;
25802582
case 51: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2581
-#line 618 "pikchr.y"
2583
+#line 620 "pikchr.y"
25822584
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
2583
-#line 2608 "pikchr.c"
2585
+#line 2610 "pikchr.c"
25842586
yymsp[0].minor.yy0 = yylhsminor.yy0;
25852587
break;
25862588
case 52: /* boolproperty ::= CW */
2587
-#line 629 "pikchr.y"
2589
+#line 631 "pikchr.y"
25882590
{p->cur->cw = 1;}
2589
-#line 2614 "pikchr.c"
2591
+#line 2616 "pikchr.c"
25902592
break;
25912593
case 53: /* boolproperty ::= CCW */
2592
-#line 630 "pikchr.y"
2594
+#line 632 "pikchr.y"
25932595
{p->cur->cw = 0;}
2594
-#line 2619 "pikchr.c"
2596
+#line 2621 "pikchr.c"
25952597
break;
25962598
case 54: /* boolproperty ::= LARROW */
2597
-#line 631 "pikchr.y"
2599
+#line 633 "pikchr.y"
25982600
{p->cur->larrow=1; p->cur->rarrow=0; }
2599
-#line 2624 "pikchr.c"
2601
+#line 2626 "pikchr.c"
26002602
break;
26012603
case 55: /* boolproperty ::= RARROW */
2602
-#line 632 "pikchr.y"
2604
+#line 634 "pikchr.y"
26032605
{p->cur->larrow=0; p->cur->rarrow=1; }
2604
-#line 2629 "pikchr.c"
2606
+#line 2631 "pikchr.c"
26052607
break;
26062608
case 56: /* boolproperty ::= LRARROW */
2607
-#line 633 "pikchr.y"
2609
+#line 635 "pikchr.y"
26082610
{p->cur->larrow=1; p->cur->rarrow=1; }
2609
-#line 2634 "pikchr.c"
2611
+#line 2636 "pikchr.c"
26102612
break;
26112613
case 57: /* boolproperty ::= INVIS */
2612
-#line 634 "pikchr.y"
2614
+#line 636 "pikchr.y"
26132615
{p->cur->sw = 0.0;}
2614
-#line 2639 "pikchr.c"
2616
+#line 2641 "pikchr.c"
26152617
break;
26162618
case 58: /* boolproperty ::= THICK */
2617
-#line 635 "pikchr.y"
2619
+#line 637 "pikchr.y"
26182620
{p->cur->sw *= 1.5;}
2619
-#line 2644 "pikchr.c"
2621
+#line 2646 "pikchr.c"
26202622
break;
26212623
case 59: /* boolproperty ::= THIN */
2622
-#line 636 "pikchr.y"
2624
+#line 638 "pikchr.y"
26232625
{p->cur->sw *= 0.67;}
2624
-#line 2649 "pikchr.c"
2626
+#line 2651 "pikchr.c"
26252627
break;
26262628
case 60: /* textposition ::= */
2627
-#line 638 "pikchr.y"
2629
+#line 640 "pikchr.y"
26282630
{yymsp[1].minor.yy74 = 0;}
2629
-#line 2654 "pikchr.c"
2631
+#line 2656 "pikchr.c"
26302632
break;
26312633
case 61: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2632
-#line 641 "pikchr.y"
2634
+#line 643 "pikchr.y"
26332635
{yylhsminor.yy74 = pik_text_position(p,yymsp[-1].minor.yy74,&yymsp[0].minor.yy0);}
2634
-#line 2659 "pikchr.c"
2636
+#line 2661 "pikchr.c"
26352637
yymsp[-1].minor.yy74 = yylhsminor.yy74;
26362638
break;
26372639
case 62: /* position ::= expr COMMA expr */
2638
-#line 644 "pikchr.y"
2640
+#line 646 "pikchr.y"
26392641
{yylhsminor.yy139.x=yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[0].minor.yy73;}
2640
-#line 2665 "pikchr.c"
2642
+#line 2667 "pikchr.c"
26412643
yymsp[-2].minor.yy139 = yylhsminor.yy139;
26422644
break;
26432645
case 63: /* position ::= place PLUS expr COMMA expr */
2644
-#line 646 "pikchr.y"
2646
+#line 648 "pikchr.y"
26452647
{yylhsminor.yy139.x=yymsp[-4].minor.yy139.x+yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y+yymsp[0].minor.yy73;}
2646
-#line 2671 "pikchr.c"
2648
+#line 2673 "pikchr.c"
26472649
yymsp[-4].minor.yy139 = yylhsminor.yy139;
26482650
break;
26492651
case 64: /* position ::= place MINUS expr COMMA expr */
2650
-#line 647 "pikchr.y"
2652
+#line 649 "pikchr.y"
26512653
{yylhsminor.yy139.x=yymsp[-4].minor.yy139.x-yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y-yymsp[0].minor.yy73;}
2652
-#line 2677 "pikchr.c"
2654
+#line 2679 "pikchr.c"
26532655
yymsp[-4].minor.yy139 = yylhsminor.yy139;
26542656
break;
26552657
case 65: /* position ::= place PLUS LP expr COMMA expr RP */
2656
-#line 649 "pikchr.y"
2658
+#line 651 "pikchr.y"
26572659
{yylhsminor.yy139.x=yymsp[-6].minor.yy139.x+yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y+yymsp[-1].minor.yy73;}
2658
-#line 2683 "pikchr.c"
2660
+#line 2685 "pikchr.c"
26592661
yymsp[-6].minor.yy139 = yylhsminor.yy139;
26602662
break;
26612663
case 66: /* position ::= place MINUS LP expr COMMA expr RP */
2662
-#line 651 "pikchr.y"
2664
+#line 653 "pikchr.y"
26632665
{yylhsminor.yy139.x=yymsp[-6].minor.yy139.x-yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y-yymsp[-1].minor.yy73;}
2664
-#line 2689 "pikchr.c"
2666
+#line 2691 "pikchr.c"
26652667
yymsp[-6].minor.yy139 = yylhsminor.yy139;
26662668
break;
26672669
case 67: /* position ::= LP position COMMA position RP */
2668
-#line 652 "pikchr.y"
2670
+#line 654 "pikchr.y"
26692671
{yymsp[-4].minor.yy139.x=yymsp[-3].minor.yy139.x; yymsp[-4].minor.yy139.y=yymsp[-1].minor.yy139.y;}
2670
-#line 2695 "pikchr.c"
2672
+#line 2697 "pikchr.c"
26712673
break;
26722674
case 68: /* position ::= LP position RP */
2673
-#line 653 "pikchr.y"
2675
+#line 655 "pikchr.y"
26742676
{yymsp[-2].minor.yy139=yymsp[-1].minor.yy139;}
2675
-#line 2700 "pikchr.c"
2677
+#line 2702 "pikchr.c"
26762678
break;
26772679
case 69: /* position ::= expr between position AND position */
2678
-#line 655 "pikchr.y"
2680
+#line 657 "pikchr.y"
26792681
{yylhsminor.yy139 = pik_position_between(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy139,yymsp[0].minor.yy139);}
2680
-#line 2705 "pikchr.c"
2682
+#line 2707 "pikchr.c"
26812683
yymsp[-4].minor.yy139 = yylhsminor.yy139;
26822684
break;
26832685
case 70: /* position ::= expr LT position COMMA position GT */
2684
-#line 657 "pikchr.y"
2686
+#line 659 "pikchr.y"
26852687
{yylhsminor.yy139 = pik_position_between(p,yymsp[-5].minor.yy73,yymsp[-3].minor.yy139,yymsp[-1].minor.yy139);}
2686
-#line 2711 "pikchr.c"
2688
+#line 2713 "pikchr.c"
26872689
yymsp[-5].minor.yy139 = yylhsminor.yy139;
26882690
break;
26892691
case 71: /* position ::= expr ABOVE position */
2690
-#line 658 "pikchr.y"
2692
+#line 660 "pikchr.y"
26912693
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y += yymsp[-2].minor.yy73;}
2692
-#line 2717 "pikchr.c"
2694
+#line 2719 "pikchr.c"
26932695
yymsp[-2].minor.yy139 = yylhsminor.yy139;
26942696
break;
26952697
case 72: /* position ::= expr BELOW position */
2696
-#line 659 "pikchr.y"
2698
+#line 661 "pikchr.y"
26972699
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y -= yymsp[-2].minor.yy73;}
2698
-#line 2723 "pikchr.c"
2700
+#line 2725 "pikchr.c"
26992701
yymsp[-2].minor.yy139 = yylhsminor.yy139;
27002702
break;
27012703
case 73: /* position ::= expr LEFT OF position */
2702
-#line 660 "pikchr.y"
2704
+#line 662 "pikchr.y"
27032705
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x -= yymsp[-3].minor.yy73;}
2704
-#line 2729 "pikchr.c"
2706
+#line 2731 "pikchr.c"
27052707
yymsp[-3].minor.yy139 = yylhsminor.yy139;
27062708
break;
27072709
case 74: /* position ::= expr RIGHT OF position */
2708
-#line 661 "pikchr.y"
2710
+#line 663 "pikchr.y"
27092711
{yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x += yymsp[-3].minor.yy73;}
2710
-#line 2735 "pikchr.c"
2712
+#line 2737 "pikchr.c"
27112713
yymsp[-3].minor.yy139 = yylhsminor.yy139;
27122714
break;
27132715
case 75: /* position ::= expr ON HEADING EDGEPT OF position */
2714
-#line 663 "pikchr.y"
2716
+#line 665 "pikchr.y"
27152717
{yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-5].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2716
-#line 2741 "pikchr.c"
2718
+#line 2743 "pikchr.c"
27172719
yymsp[-5].minor.yy139 = yylhsminor.yy139;
27182720
break;
27192721
case 76: /* position ::= expr HEADING EDGEPT OF position */
2720
-#line 665 "pikchr.y"
2722
+#line 667 "pikchr.y"
27212723
{yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-4].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2722
-#line 2747 "pikchr.c"
2724
+#line 2749 "pikchr.c"
27232725
yymsp[-4].minor.yy139 = yylhsminor.yy139;
27242726
break;
27252727
case 77: /* position ::= expr EDGEPT OF position */
2726
-#line 667 "pikchr.y"
2728
+#line 669 "pikchr.y"
27272729
{yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2728
-#line 2753 "pikchr.c"
2730
+#line 2755 "pikchr.c"
27292731
yymsp[-3].minor.yy139 = yylhsminor.yy139;
27302732
break;
27312733
case 78: /* position ::= expr ON HEADING expr FROM position */
2732
-#line 669 "pikchr.y"
2734
+#line 671 "pikchr.y"
27332735
{yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-5].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
2734
-#line 2759 "pikchr.c"
2736
+#line 2761 "pikchr.c"
27352737
yymsp[-5].minor.yy139 = yylhsminor.yy139;
27362738
break;
27372739
case 79: /* position ::= expr HEADING expr FROM position */
2738
-#line 671 "pikchr.y"
2740
+#line 673 "pikchr.y"
27392741
{yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
2740
-#line 2765 "pikchr.c"
2742
+#line 2767 "pikchr.c"
27412743
yymsp[-4].minor.yy139 = yylhsminor.yy139;
27422744
break;
27432745
case 80: /* place ::= edge OF object */
2744
-#line 683 "pikchr.y"
2746
+#line 685 "pikchr.y"
27452747
{yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2746
-#line 2771 "pikchr.c"
2748
+#line 2773 "pikchr.c"
27472749
yymsp[-2].minor.yy139 = yylhsminor.yy139;
27482750
break;
27492751
case 81: /* place2 ::= object */
2750
-#line 684 "pikchr.y"
2752
+#line 686 "pikchr.y"
27512753
{yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,0);}
2752
-#line 2777 "pikchr.c"
2754
+#line 2779 "pikchr.c"
27532755
yymsp[0].minor.yy139 = yylhsminor.yy139;
27542756
break;
27552757
case 82: /* place2 ::= object DOT_E edge */
2756
-#line 685 "pikchr.y"
2758
+#line 687 "pikchr.y"
27572759
{yylhsminor.yy139 = pik_place_of_elem(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2758
-#line 2783 "pikchr.c"
2760
+#line 2785 "pikchr.c"
27592761
yymsp[-2].minor.yy139 = yylhsminor.yy139;
27602762
break;
27612763
case 83: /* place2 ::= NTH VERTEX OF object */
2762
-#line 686 "pikchr.y"
2764
+#line 688 "pikchr.y"
27632765
{yylhsminor.yy139 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy254);}
2764
-#line 2789 "pikchr.c"
2766
+#line 2791 "pikchr.c"
27652767
yymsp[-3].minor.yy139 = yylhsminor.yy139;
27662768
break;
27672769
case 84: /* object ::= nth */
2768
-#line 698 "pikchr.y"
2770
+#line 700 "pikchr.y"
27692771
{yylhsminor.yy254 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2770
-#line 2795 "pikchr.c"
2772
+#line 2797 "pikchr.c"
27712773
yymsp[0].minor.yy254 = yylhsminor.yy254;
27722774
break;
27732775
case 85: /* object ::= nth OF|IN object */
2774
-#line 699 "pikchr.y"
2776
+#line 701 "pikchr.y"
27752777
{yylhsminor.yy254 = pik_find_nth(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2776
-#line 2801 "pikchr.c"
2778
+#line 2803 "pikchr.c"
27772779
yymsp[-2].minor.yy254 = yylhsminor.yy254;
27782780
break;
27792781
case 86: /* objectname ::= PLACENAME */
2780
-#line 701 "pikchr.y"
2782
+#line 703 "pikchr.y"
27812783
{yylhsminor.yy254 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2782
-#line 2807 "pikchr.c"
2784
+#line 2809 "pikchr.c"
27832785
yymsp[0].minor.yy254 = yylhsminor.yy254;
27842786
break;
27852787
case 87: /* objectname ::= objectname DOT_U PLACENAME */
2786
-#line 703 "pikchr.y"
2788
+#line 705 "pikchr.y"
27872789
{yylhsminor.yy254 = pik_find_byname(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2788
-#line 2813 "pikchr.c"
2790
+#line 2815 "pikchr.c"
27892791
yymsp[-2].minor.yy254 = yylhsminor.yy254;
27902792
break;
27912793
case 88: /* nth ::= NTH CLASSNAME */
2792
-#line 705 "pikchr.y"
2794
+#line 707 "pikchr.y"
27932795
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2794
-#line 2819 "pikchr.c"
2796
+#line 2821 "pikchr.c"
27952797
yymsp[-1].minor.yy0 = yylhsminor.yy0;
27962798
break;
27972799
case 89: /* nth ::= NTH LAST CLASSNAME */
2798
-#line 706 "pikchr.y"
2800
+#line 708 "pikchr.y"
27992801
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2800
-#line 2825 "pikchr.c"
2802
+#line 2827 "pikchr.c"
28012803
yymsp[-2].minor.yy0 = yylhsminor.yy0;
28022804
break;
28032805
case 90: /* nth ::= LAST CLASSNAME */
2804
-#line 707 "pikchr.y"
2806
+#line 709 "pikchr.y"
28052807
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2806
-#line 2831 "pikchr.c"
2808
+#line 2833 "pikchr.c"
28072809
break;
28082810
case 91: /* nth ::= LAST */
2809
-#line 708 "pikchr.y"
2811
+#line 710 "pikchr.y"
28102812
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2811
-#line 2836 "pikchr.c"
2813
+#line 2838 "pikchr.c"
28122814
yymsp[0].minor.yy0 = yylhsminor.yy0;
28132815
break;
28142816
case 92: /* nth ::= NTH LB RB */
2815
-#line 709 "pikchr.y"
2817
+#line 711 "pikchr.y"
28162818
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2817
-#line 2842 "pikchr.c"
2819
+#line 2844 "pikchr.c"
28182820
yymsp[-2].minor.yy0 = yylhsminor.yy0;
28192821
break;
28202822
case 93: /* nth ::= NTH LAST LB RB */
2821
-#line 710 "pikchr.y"
2823
+#line 712 "pikchr.y"
28222824
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2823
-#line 2848 "pikchr.c"
2825
+#line 2850 "pikchr.c"
28242826
yymsp[-3].minor.yy0 = yylhsminor.yy0;
28252827
break;
28262828
case 94: /* nth ::= LAST LB RB */
2827
-#line 711 "pikchr.y"
2829
+#line 713 "pikchr.y"
28282830
{yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2829
-#line 2854 "pikchr.c"
2831
+#line 2856 "pikchr.c"
28302832
break;
28312833
case 95: /* expr ::= expr PLUS expr */
2832
-#line 713 "pikchr.y"
2834
+#line 715 "pikchr.y"
28332835
{yylhsminor.yy73=yymsp[-2].minor.yy73+yymsp[0].minor.yy73;}
2834
-#line 2859 "pikchr.c"
2836
+#line 2861 "pikchr.c"
28352837
yymsp[-2].minor.yy73 = yylhsminor.yy73;
28362838
break;
28372839
case 96: /* expr ::= expr MINUS expr */
2838
-#line 714 "pikchr.y"
2840
+#line 716 "pikchr.y"
28392841
{yylhsminor.yy73=yymsp[-2].minor.yy73-yymsp[0].minor.yy73;}
2840
-#line 2865 "pikchr.c"
2842
+#line 2867 "pikchr.c"
28412843
yymsp[-2].minor.yy73 = yylhsminor.yy73;
28422844
break;
28432845
case 97: /* expr ::= expr STAR expr */
2844
-#line 715 "pikchr.y"
2846
+#line 717 "pikchr.y"
28452847
{yylhsminor.yy73=yymsp[-2].minor.yy73*yymsp[0].minor.yy73;}
2846
-#line 2871 "pikchr.c"
2848
+#line 2873 "pikchr.c"
28472849
yymsp[-2].minor.yy73 = yylhsminor.yy73;
28482850
break;
28492851
case 98: /* expr ::= expr SLASH expr */
2850
-#line 716 "pikchr.y"
2852
+#line 718 "pikchr.y"
28512853
{
28522854
if( yymsp[0].minor.yy73==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy73 = 0.0; }
28532855
else{ yylhsminor.yy73 = yymsp[-2].minor.yy73/yymsp[0].minor.yy73; }
28542856
}
2855
-#line 2880 "pikchr.c"
2857
+#line 2882 "pikchr.c"
28562858
yymsp[-2].minor.yy73 = yylhsminor.yy73;
28572859
break;
28582860
case 99: /* expr ::= MINUS expr */
2859
-#line 720 "pikchr.y"
2861
+#line 722 "pikchr.y"
28602862
{yymsp[-1].minor.yy73=-yymsp[0].minor.yy73;}
2861
-#line 2886 "pikchr.c"
2863
+#line 2888 "pikchr.c"
28622864
break;
28632865
case 100: /* expr ::= PLUS expr */
2864
-#line 721 "pikchr.y"
2866
+#line 723 "pikchr.y"
28652867
{yymsp[-1].minor.yy73=yymsp[0].minor.yy73;}
2866
-#line 2891 "pikchr.c"
2868
+#line 2893 "pikchr.c"
28672869
break;
28682870
case 101: /* expr ::= LP expr RP */
2869
-#line 722 "pikchr.y"
2871
+#line 724 "pikchr.y"
28702872
{yymsp[-2].minor.yy73=yymsp[-1].minor.yy73;}
2871
-#line 2896 "pikchr.c"
2873
+#line 2898 "pikchr.c"
28722874
break;
28732875
case 102: /* expr ::= NUMBER */
2874
-#line 723 "pikchr.y"
2876
+#line 725 "pikchr.y"
28752877
{yylhsminor.yy73=pik_atof(p,&yymsp[0].minor.yy0);}
2876
-#line 2901 "pikchr.c"
2878
+#line 2903 "pikchr.c"
28772879
yymsp[0].minor.yy73 = yylhsminor.yy73;
28782880
break;
28792881
case 103: /* expr ::= ID */
2880
-#line 724 "pikchr.y"
2882
+#line 726 "pikchr.y"
28812883
{yylhsminor.yy73=pik_get_var(p,&yymsp[0].minor.yy0);}
2882
-#line 2907 "pikchr.c"
2884
+#line 2909 "pikchr.c"
28832885
yymsp[0].minor.yy73 = yylhsminor.yy73;
28842886
break;
28852887
case 104: /* expr ::= FUNC1 LP expr RP */
2886
-#line 725 "pikchr.y"
2888
+#line 727 "pikchr.y"
28872889
{yylhsminor.yy73 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy73,0.0);}
2888
-#line 2913 "pikchr.c"
2890
+#line 2915 "pikchr.c"
28892891
yymsp[-3].minor.yy73 = yylhsminor.yy73;
28902892
break;
28912893
case 105: /* expr ::= FUNC2 LP expr COMMA expr RP */
2892
-#line 726 "pikchr.y"
2894
+#line 728 "pikchr.y"
28932895
{yylhsminor.yy73 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy73,yymsp[-1].minor.yy73);}
2894
-#line 2919 "pikchr.c"
2896
+#line 2921 "pikchr.c"
28952897
yymsp[-5].minor.yy73 = yylhsminor.yy73;
28962898
break;
28972899
case 106: /* expr ::= place2 DOT_XY X */
2898
-#line 727 "pikchr.y"
2900
+#line 729 "pikchr.y"
28992901
{yylhsminor.yy73 = yymsp[-2].minor.yy139.x;}
2900
-#line 2925 "pikchr.c"
2902
+#line 2927 "pikchr.c"
29012903
yymsp[-2].minor.yy73 = yylhsminor.yy73;
29022904
break;
29032905
case 107: /* expr ::= place2 DOT_XY Y */
2904
-#line 728 "pikchr.y"
2906
+#line 730 "pikchr.y"
29052907
{yylhsminor.yy73 = yymsp[-2].minor.yy139.y;}
2906
-#line 2931 "pikchr.c"
2908
+#line 2933 "pikchr.c"
29072909
yymsp[-2].minor.yy73 = yylhsminor.yy73;
29082910
break;
29092911
case 108: /* expr ::= object DOT_L numproperty */
29102912
case 109: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==109);
29112913
case 110: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==110);
2912
-#line 729 "pikchr.y"
2914
+#line 731 "pikchr.y"
29132915
{yylhsminor.yy73=pik_property_of(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2914
-#line 2939 "pikchr.c"
2916
+#line 2941 "pikchr.c"
29152917
yymsp[-2].minor.yy73 = yylhsminor.yy73;
29162918
break;
29172919
default:
29182920
/* (111) lvalue ::= ID */ yytestcase(yyruleno==111);
29192921
/* (112) lvalue ::= FILL */ yytestcase(yyruleno==112);
@@ -3012,18 +3014,18 @@
30123014
){
30133015
pik_parserARG_FETCH
30143016
pik_parserCTX_FETCH
30153017
#define TOKEN yyminor
30163018
/************ Begin %syntax_error code ****************************************/
3017
-#line 496 "pikchr.y"
3019
+#line 498 "pikchr.y"
30183020
30193021
if( TOKEN.z && TOKEN.z[0] ){
30203022
pik_error(p, &TOKEN, "syntax error");
30213023
}else{
30223024
pik_error(p, 0, "syntax error");
30233025
}
3024
-#line 3049 "pikchr.c"
3026
+#line 3051 "pikchr.c"
30253027
/************ End %syntax_error code ******************************************/
30263028
pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
30273029
pik_parserCTX_STORE
30283030
}
30293031
@@ -3252,11 +3254,11 @@
32523254
#else
32533255
(void)iToken;
32543256
return 0;
32553257
#endif
32563258
}
3257
-#line 734 "pikchr.y"
3259
+#line 736 "pikchr.y"
32583260
32593261
32603262
32613263
/* Chart of the 140 official HTML color names with their
32623264
** corresponding RGB value.
@@ -4513,10 +4515,13 @@
45134515
pik_append(p,"fill:none;",-1);
45144516
}
45154517
if( pElem->sw>0.0 && pElem->color>=0.0 ){
45164518
PNum sw = pElem->sw;
45174519
pik_append_dis(p, "stroke-width:", sw, ";");
4520
+ if( pElem->nPath>2 && pElem->rad<=pElem->sw ){
4521
+ pik_append(p, "stroke-linejoin:round;", -1);
4522
+ }
45184523
pik_append_clr(p, "stroke:",pElem->color,";");
45194524
if( pElem->dotted>0.0 ){
45204525
PNum v = pElem->dotted;
45214526
if( sw<2.1/p->rScale ) sw = 2.1/p->rScale;
45224527
pik_append_dis(p,"stroke-dasharray:",sw,"");
@@ -5238,10 +5243,21 @@
52385243
break;
52395244
}
52405245
}
52415246
}
52425247
5248
+/*
5249
+** If the current path information came from a "same" or "same as"
5250
+** reset it.
5251
+*/
5252
+static void pik_reset_samepath(Pik *p, PElem *pElem){
5253
+ if( p->samePath ){
5254
+ p->samePath = 0;
5255
+ p->nTPath = 1;
5256
+ }
5257
+}
5258
+
52435259
52445260
/* Add a new term to the path for a line-oriented object by transferring
52455261
** the information in the ptTo field over onto the path and into ptFrom
52465262
** resetting the ptTo.
52475263
*/
@@ -5250,11 +5266,11 @@
52505266
if( !pElem->type->isLine ){
52515267
pik_error(p, pToken, "use with line-oriented objects only");
52525268
return;
52535269
}
52545270
n = p->nTPath - 1;
5255
- if( n<1 ){
5271
+ if( n<1 && (pElem->mProp & A_FROM)==0 ){
52565272
pik_error(p, pToken, "no prior path points");
52575273
return;
52585274
}
52595275
p->thenFlag = 1;
52605276
}
@@ -5288,10 +5304,11 @@
52885304
PToken x = pik_next_semantic_token(p, &pElem->errTok);
52895305
pik_error(p, &x, "syntax error");
52905306
}
52915307
return;
52925308
}
5309
+ pik_reset_samepath(p, pElem);
52935310
n = p->nTPath - 1;
52945311
if( p->thenFlag || p->mTPath==3 || n==0 ){
52955312
n = pik_next_rpath(p, pDir);
52965313
p->thenFlag = 0;
52975314
}
@@ -5340,10 +5357,11 @@
53405357
PNum rDist = pDist->rAbs + pik_value(p,"linewid",7,0)*pDist->rRel;
53415358
if( !pElem->type->isLine ){
53425359
pik_error(p, pErr, "use with line-oriented objects only");
53435360
return;
53445361
}
5362
+ pik_reset_samepath(p, pElem);
53455363
do{
53465364
n = pik_next_rpath(p, pErr);
53475365
}while( n<1 );
53485366
if( pHeading ){
53495367
if( rHdg<0.0 || rHdg>360.0 ){
@@ -5385,10 +5403,11 @@
53855403
int n;
53865404
if( !pElem->type->isLine ){
53875405
pik_error(p, pDir, "use with line-oriented objects only");
53885406
return;
53895407
}
5408
+ pik_reset_samepath(p, pElem);
53905409
n = p->nTPath - 1;
53915410
if( p->thenFlag || p->mTPath==3 || n==0 ){
53925411
n = pik_next_rpath(p, pDir);
53935412
p->thenFlag = 0;
53945413
}
@@ -5900,17 +5919,20 @@
59005919
p->aTPath[i].x = pOther->aPath[i].x + dx;
59015920
p->aTPath[i].y = pOther->aPath[i].y + dy;
59025921
}
59035922
p->nTPath = pOther->nPath;
59045923
p->mTPath = 3;
5924
+ p->samePath = 1;
59055925
}
5906
- pElem->w = pOther->w;
5907
- pElem->h = pOther->h;
5926
+ if( !pElem->type->isLine ){
5927
+ pElem->w = pOther->w;
5928
+ pElem->h = pOther->h;
5929
+ }
59085930
pElem->rad = pOther->rad;
59095931
pElem->sw = pOther->sw;
59105932
pElem->dashed = pOther->dashed;
5911
- pElem->dotted = pOther->dashed;
5933
+ pElem->dotted = pOther->dotted;
59125934
pElem->fill = pOther->fill;
59135935
pElem->color = pOther->color;
59145936
pElem->cw = pOther->cw;
59155937
pElem->larrow = pOther->larrow;
59165938
pElem->rarrow = pOther->rarrow;
@@ -7029,6 +7051,6 @@
70297051
printf("</body></html>\n");
70307052
return 0;
70317053
}
70327054
#endif /* PIKCHR_SHELL */
70337055
7034
-#line 7059 "pikchr.c"
7056
+#line 7081 "pikchr.c"
70357057
--- src/pikchr.c
+++ src/pikchr.c
@@ -275,10 +275,11 @@
275 #define A_COLOR 0x0040
276 #define A_ARROW 0x0080
277 #define A_FROM 0x0100
278 #define A_CW 0x0200
279 #define A_AT 0x0400
 
280
281
282 /* A single element */
283 struct PElem {
284 const PClass *type; /* Element type */
@@ -341,12 +342,13 @@
341 PNum fontScale; /* Scale fonts by this percent */
342 PNum charWidth; /* Character width */
343 PNum charHeight; /* Character height */
344 PNum wArrow; /* Width of arrowhead at the fat end */
345 PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */
346 int bLayoutVars; /* True if cache is valid */
347 char thenFlag; /* True if "then" seen */
 
348 const char *zClass; /* Class name for the <svg> */
349 int wSVG, hSVG; /* Width and height of the <svg> */
350 /* Paths for lines are constructed here first, then transferred into
351 ** the PElem object at the end: */
352 int nTPath; /* Number of entries on aTPath[] */
@@ -450,11 +452,11 @@
450 static void pik_behind(Pik*,PElem*);
451 static PElem *pik_assert(Pik*,PNum,PToken*,PNum);
452 static PElem *pik_place_assert(Pik*,PPoint*,PToken*,PPoint*);
453
454
455 #line 481 "pikchr.c"
456 /**************** End of %include directives **********************************/
457 /* These constants specify the various numeric values for terminal symbols.
458 ***************** Begin token definitions *************************************/
459 #ifndef T_ID
460 #define T_ID 1
@@ -1626,22 +1628,22 @@
1626 ** inside the C code.
1627 */
1628 /********* Begin destructor definitions ***************************************/
1629 case 94: /* element_list */
1630 {
1631 #line 470 "pikchr.y"
1632 pik_elist_free(p,(yypminor->yy72));
1633 #line 1658 "pikchr.c"
1634 }
1635 break;
1636 case 95: /* element */
1637 case 96: /* unnamed_element */
1638 case 97: /* basetype */
1639 {
1640 #line 472 "pikchr.y"
1641 pik_elem_free(p,(yypminor->yy254));
1642 #line 1667 "pikchr.c"
1643 }
1644 break;
1645 /********* End destructor definitions *****************************************/
1646 default: break; /* If no destructor action specified: do nothing */
1647 }
@@ -1855,14 +1857,14 @@
1855 #endif
1856 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1857 /* Here code is inserted which will execute if the parser
1858 ** stack every overflows */
1859 /******** Begin %stack_overflow code ******************************************/
1860 #line 503 "pikchr.y"
1861
1862 pik_error(p, 0, "parser stack overflow");
1863 #line 1888 "pikchr.c"
1864 /******** End %stack_overflow code ********************************************/
1865 pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
1866 pik_parserCTX_STORE
1867 }
1868
@@ -2327,593 +2329,593 @@
2327 ** break;
2328 */
2329 /********** Begin reduce actions **********************************************/
2330 YYMINORTYPE yylhsminor;
2331 case 0: /* document ::= element_list */
2332 #line 507 "pikchr.y"
2333 {pik_render(p,yymsp[0].minor.yy72);}
2334 #line 2359 "pikchr.c"
2335 break;
2336 case 1: /* element_list ::= element */
2337 #line 510 "pikchr.y"
2338 { yylhsminor.yy72 = pik_elist_append(p,0,yymsp[0].minor.yy254); }
2339 #line 2364 "pikchr.c"
2340 yymsp[0].minor.yy72 = yylhsminor.yy72;
2341 break;
2342 case 2: /* element_list ::= element_list EOL element */
2343 #line 512 "pikchr.y"
2344 { yylhsminor.yy72 = pik_elist_append(p,yymsp[-2].minor.yy72,yymsp[0].minor.yy254); }
2345 #line 2370 "pikchr.c"
2346 yymsp[-2].minor.yy72 = yylhsminor.yy72;
2347 break;
2348 case 3: /* element ::= */
2349 #line 515 "pikchr.y"
2350 { yymsp[1].minor.yy254 = 0; }
2351 #line 2376 "pikchr.c"
2352 break;
2353 case 4: /* element ::= direction */
2354 #line 516 "pikchr.y"
2355 { pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy254=0; }
2356 #line 2381 "pikchr.c"
2357 yymsp[0].minor.yy254 = yylhsminor.yy254;
2358 break;
2359 case 5: /* element ::= lvalue ASSIGN rvalue */
2360 #line 517 "pikchr.y"
2361 {pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy73,&yymsp[-1].minor.yy0); yylhsminor.yy254=0;}
2362 #line 2387 "pikchr.c"
2363 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2364 break;
2365 case 6: /* element ::= PLACENAME COLON unnamed_element */
2366 #line 519 "pikchr.y"
2367 { yylhsminor.yy254 = yymsp[0].minor.yy254; pik_elem_setname(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0); }
2368 #line 2393 "pikchr.c"
2369 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2370 break;
2371 case 7: /* element ::= PLACENAME COLON position */
2372 #line 521 "pikchr.y"
2373 { yylhsminor.yy254 = pik_elem_new(p,0,0,0);
2374 if(yylhsminor.yy254){ yylhsminor.yy254->ptAt = yymsp[0].minor.yy139; pik_elem_setname(p,yylhsminor.yy254,&yymsp[-2].minor.yy0); }}
2375 #line 2400 "pikchr.c"
2376 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2377 break;
2378 case 8: /* element ::= unnamed_element */
2379 #line 523 "pikchr.y"
2380 {yylhsminor.yy254 = yymsp[0].minor.yy254;}
2381 #line 2406 "pikchr.c"
2382 yymsp[0].minor.yy254 = yylhsminor.yy254;
2383 break;
2384 case 9: /* element ::= print prlist */
2385 #line 524 "pikchr.y"
2386 {pik_append(p,"<br>\n",5); yymsp[-1].minor.yy254=0;}
2387 #line 2412 "pikchr.c"
2388 break;
2389 case 10: /* element ::= ASSERT LP expr EQ expr RP */
2390 #line 529 "pikchr.y"
2391 {yymsp[-5].minor.yy254=pik_assert(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy73);}
2392 #line 2417 "pikchr.c"
2393 break;
2394 case 11: /* element ::= ASSERT LP place EQ place RP */
2395 #line 531 "pikchr.y"
2396 {yymsp[-5].minor.yy254=pik_place_assert(p,&yymsp[-3].minor.yy139,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy139);}
2397 #line 2422 "pikchr.c"
2398 break;
2399 case 12: /* rvalue ::= PLACENAME */
2400 #line 542 "pikchr.y"
2401 {yylhsminor.yy73 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2402 #line 2427 "pikchr.c"
2403 yymsp[0].minor.yy73 = yylhsminor.yy73;
2404 break;
2405 case 13: /* pritem ::= FILL */
2406 case 14: /* pritem ::= COLOR */ yytestcase(yyruleno==14);
2407 case 15: /* pritem ::= THICKNESS */ yytestcase(yyruleno==15);
2408 #line 547 "pikchr.y"
2409 {pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2410 #line 2435 "pikchr.c"
2411 break;
2412 case 16: /* pritem ::= rvalue */
2413 #line 550 "pikchr.y"
2414 {pik_append_num(p,"",yymsp[0].minor.yy73);}
2415 #line 2440 "pikchr.c"
2416 break;
2417 case 17: /* pritem ::= STRING */
2418 #line 551 "pikchr.y"
2419 {pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2420 #line 2445 "pikchr.c"
2421 break;
2422 case 18: /* prsep ::= COMMA */
2423 #line 552 "pikchr.y"
2424 {pik_append(p, " ", 1);}
2425 #line 2450 "pikchr.c"
2426 break;
2427 case 19: /* unnamed_element ::= basetype attribute_list */
2428 #line 555 "pikchr.y"
2429 {yylhsminor.yy254 = yymsp[-1].minor.yy254; pik_after_adding_attributes(p,yylhsminor.yy254);}
2430 #line 2455 "pikchr.c"
2431 yymsp[-1].minor.yy254 = yylhsminor.yy254;
2432 break;
2433 case 20: /* basetype ::= CLASSNAME */
2434 #line 557 "pikchr.y"
2435 {yylhsminor.yy254 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2436 #line 2461 "pikchr.c"
2437 yymsp[0].minor.yy254 = yylhsminor.yy254;
2438 break;
2439 case 21: /* basetype ::= STRING textposition */
2440 #line 559 "pikchr.y"
2441 {yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy74; yylhsminor.yy254 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2442 #line 2467 "pikchr.c"
2443 yymsp[-1].minor.yy254 = yylhsminor.yy254;
2444 break;
2445 case 22: /* basetype ::= LB savelist element_list RB */
2446 #line 561 "pikchr.y"
2447 { p->list = yymsp[-2].minor.yy72; yymsp[-3].minor.yy254 = pik_elem_new(p,0,0,yymsp[-1].minor.yy72); if(yymsp[-3].minor.yy254) yymsp[-3].minor.yy254->errTok = yymsp[0].minor.yy0; }
2448 #line 2473 "pikchr.c"
2449 break;
2450 case 23: /* savelist ::= */
2451 #line 566 "pikchr.y"
2452 {yymsp[1].minor.yy72 = p->list; p->list = 0;}
2453 #line 2478 "pikchr.c"
2454 break;
2455 case 24: /* relexpr ::= expr */
2456 #line 573 "pikchr.y"
2457 {yylhsminor.yy60.rAbs = yymsp[0].minor.yy73; yylhsminor.yy60.rRel = 0;}
2458 #line 2483 "pikchr.c"
2459 yymsp[0].minor.yy60 = yylhsminor.yy60;
2460 break;
2461 case 25: /* relexpr ::= expr PERCENT */
2462 #line 574 "pikchr.y"
2463 {yylhsminor.yy60.rAbs = 0; yylhsminor.yy60.rRel = yymsp[-1].minor.yy73/100;}
2464 #line 2489 "pikchr.c"
2465 yymsp[-1].minor.yy60 = yylhsminor.yy60;
2466 break;
2467 case 26: /* optrelexpr ::= */
2468 #line 576 "pikchr.y"
2469 {yymsp[1].minor.yy60.rAbs = 0; yymsp[1].minor.yy60.rRel = 1.0;}
2470 #line 2495 "pikchr.c"
2471 break;
2472 case 27: /* attribute_list ::= relexpr alist */
2473 #line 578 "pikchr.y"
2474 {pik_add_direction(p,0,&yymsp[-1].minor.yy60);}
2475 #line 2500 "pikchr.c"
2476 break;
2477 case 28: /* attribute ::= numproperty relexpr */
2478 #line 582 "pikchr.y"
2479 { pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60); }
2480 #line 2505 "pikchr.c"
2481 break;
2482 case 29: /* attribute ::= dashproperty expr */
2483 #line 583 "pikchr.y"
2484 { pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy73); }
2485 #line 2510 "pikchr.c"
2486 break;
2487 case 30: /* attribute ::= dashproperty */
2488 #line 584 "pikchr.y"
2489 { pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2490 #line 2515 "pikchr.c"
2491 break;
2492 case 31: /* attribute ::= colorproperty rvalue */
2493 #line 585 "pikchr.y"
2494 { pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73); }
2495 #line 2520 "pikchr.c"
2496 break;
2497 case 32: /* attribute ::= go direction optrelexpr */
2498 #line 586 "pikchr.y"
2499 { pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60);}
2500 #line 2525 "pikchr.c"
2501 break;
2502 case 33: /* attribute ::= go direction even position */
2503 #line 587 "pikchr.y"
2504 {pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139);}
2505 #line 2530 "pikchr.c"
2506 break;
2507 case 34: /* attribute ::= CLOSE */
2508 #line 588 "pikchr.y"
2509 { pik_close_path(p,&yymsp[0].minor.yy0); }
2510 #line 2535 "pikchr.c"
2511 break;
2512 case 35: /* attribute ::= CHOP */
2513 #line 589 "pikchr.y"
2514 { p->cur->bChop = 1; }
2515 #line 2540 "pikchr.c"
2516 break;
2517 case 36: /* attribute ::= FROM position */
2518 #line 590 "pikchr.y"
2519 { pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
2520 #line 2545 "pikchr.c"
2521 break;
2522 case 37: /* attribute ::= TO position */
2523 #line 591 "pikchr.y"
2524 { pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
2525 #line 2550 "pikchr.c"
2526 break;
2527 case 38: /* attribute ::= THEN */
2528 #line 592 "pikchr.y"
2529 { pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2530 #line 2555 "pikchr.c"
2531 break;
2532 case 39: /* attribute ::= THEN optrelexpr HEADING expr */
2533 case 41: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==41);
2534 #line 594 "pikchr.y"
2535 {pik_move_hdg(p,&yymsp[-2].minor.yy60,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73,0,&yymsp[-3].minor.yy0);}
2536 #line 2561 "pikchr.c"
2537 break;
2538 case 40: /* attribute ::= THEN optrelexpr EDGEPT */
2539 case 42: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==42);
2540 #line 595 "pikchr.y"
2541 {pik_move_hdg(p,&yymsp[-1].minor.yy60,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2542 #line 2567 "pikchr.c"
2543 break;
2544 case 43: /* attribute ::= AT position */
2545 #line 600 "pikchr.y"
2546 { pik_set_at(p,0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
2547 #line 2572 "pikchr.c"
2548 break;
2549 case 44: /* attribute ::= SAME */
2550 #line 602 "pikchr.y"
2551 {pik_same(p,0,&yymsp[0].minor.yy0);}
2552 #line 2577 "pikchr.c"
2553 break;
2554 case 45: /* attribute ::= SAME AS object */
2555 #line 603 "pikchr.y"
2556 {pik_same(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2557 #line 2582 "pikchr.c"
2558 break;
2559 case 46: /* attribute ::= STRING textposition */
2560 #line 604 "pikchr.y"
2561 {pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy74);}
2562 #line 2587 "pikchr.c"
2563 break;
2564 case 47: /* attribute ::= FIT */
2565 #line 605 "pikchr.y"
2566 {pik_size_to_fit(p,&yymsp[0].minor.yy0); }
2567 #line 2592 "pikchr.c"
2568 break;
2569 case 48: /* attribute ::= BEHIND object */
2570 #line 606 "pikchr.y"
2571 {pik_behind(p,yymsp[0].minor.yy254);}
2572 #line 2597 "pikchr.c"
2573 break;
2574 case 49: /* withclause ::= DOT_E edge AT position */
2575 case 50: /* withclause ::= edge AT position */ yytestcase(yyruleno==50);
2576 #line 614 "pikchr.y"
2577 { pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
2578 #line 2603 "pikchr.c"
2579 break;
2580 case 51: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2581 #line 618 "pikchr.y"
2582 {yylhsminor.yy0 = yymsp[0].minor.yy0;}
2583 #line 2608 "pikchr.c"
2584 yymsp[0].minor.yy0 = yylhsminor.yy0;
2585 break;
2586 case 52: /* boolproperty ::= CW */
2587 #line 629 "pikchr.y"
2588 {p->cur->cw = 1;}
2589 #line 2614 "pikchr.c"
2590 break;
2591 case 53: /* boolproperty ::= CCW */
2592 #line 630 "pikchr.y"
2593 {p->cur->cw = 0;}
2594 #line 2619 "pikchr.c"
2595 break;
2596 case 54: /* boolproperty ::= LARROW */
2597 #line 631 "pikchr.y"
2598 {p->cur->larrow=1; p->cur->rarrow=0; }
2599 #line 2624 "pikchr.c"
2600 break;
2601 case 55: /* boolproperty ::= RARROW */
2602 #line 632 "pikchr.y"
2603 {p->cur->larrow=0; p->cur->rarrow=1; }
2604 #line 2629 "pikchr.c"
2605 break;
2606 case 56: /* boolproperty ::= LRARROW */
2607 #line 633 "pikchr.y"
2608 {p->cur->larrow=1; p->cur->rarrow=1; }
2609 #line 2634 "pikchr.c"
2610 break;
2611 case 57: /* boolproperty ::= INVIS */
2612 #line 634 "pikchr.y"
2613 {p->cur->sw = 0.0;}
2614 #line 2639 "pikchr.c"
2615 break;
2616 case 58: /* boolproperty ::= THICK */
2617 #line 635 "pikchr.y"
2618 {p->cur->sw *= 1.5;}
2619 #line 2644 "pikchr.c"
2620 break;
2621 case 59: /* boolproperty ::= THIN */
2622 #line 636 "pikchr.y"
2623 {p->cur->sw *= 0.67;}
2624 #line 2649 "pikchr.c"
2625 break;
2626 case 60: /* textposition ::= */
2627 #line 638 "pikchr.y"
2628 {yymsp[1].minor.yy74 = 0;}
2629 #line 2654 "pikchr.c"
2630 break;
2631 case 61: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2632 #line 641 "pikchr.y"
2633 {yylhsminor.yy74 = pik_text_position(p,yymsp[-1].minor.yy74,&yymsp[0].minor.yy0);}
2634 #line 2659 "pikchr.c"
2635 yymsp[-1].minor.yy74 = yylhsminor.yy74;
2636 break;
2637 case 62: /* position ::= expr COMMA expr */
2638 #line 644 "pikchr.y"
2639 {yylhsminor.yy139.x=yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[0].minor.yy73;}
2640 #line 2665 "pikchr.c"
2641 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2642 break;
2643 case 63: /* position ::= place PLUS expr COMMA expr */
2644 #line 646 "pikchr.y"
2645 {yylhsminor.yy139.x=yymsp[-4].minor.yy139.x+yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y+yymsp[0].minor.yy73;}
2646 #line 2671 "pikchr.c"
2647 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2648 break;
2649 case 64: /* position ::= place MINUS expr COMMA expr */
2650 #line 647 "pikchr.y"
2651 {yylhsminor.yy139.x=yymsp[-4].minor.yy139.x-yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y-yymsp[0].minor.yy73;}
2652 #line 2677 "pikchr.c"
2653 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2654 break;
2655 case 65: /* position ::= place PLUS LP expr COMMA expr RP */
2656 #line 649 "pikchr.y"
2657 {yylhsminor.yy139.x=yymsp[-6].minor.yy139.x+yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y+yymsp[-1].minor.yy73;}
2658 #line 2683 "pikchr.c"
2659 yymsp[-6].minor.yy139 = yylhsminor.yy139;
2660 break;
2661 case 66: /* position ::= place MINUS LP expr COMMA expr RP */
2662 #line 651 "pikchr.y"
2663 {yylhsminor.yy139.x=yymsp[-6].minor.yy139.x-yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y-yymsp[-1].minor.yy73;}
2664 #line 2689 "pikchr.c"
2665 yymsp[-6].minor.yy139 = yylhsminor.yy139;
2666 break;
2667 case 67: /* position ::= LP position COMMA position RP */
2668 #line 652 "pikchr.y"
2669 {yymsp[-4].minor.yy139.x=yymsp[-3].minor.yy139.x; yymsp[-4].minor.yy139.y=yymsp[-1].minor.yy139.y;}
2670 #line 2695 "pikchr.c"
2671 break;
2672 case 68: /* position ::= LP position RP */
2673 #line 653 "pikchr.y"
2674 {yymsp[-2].minor.yy139=yymsp[-1].minor.yy139;}
2675 #line 2700 "pikchr.c"
2676 break;
2677 case 69: /* position ::= expr between position AND position */
2678 #line 655 "pikchr.y"
2679 {yylhsminor.yy139 = pik_position_between(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy139,yymsp[0].minor.yy139);}
2680 #line 2705 "pikchr.c"
2681 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2682 break;
2683 case 70: /* position ::= expr LT position COMMA position GT */
2684 #line 657 "pikchr.y"
2685 {yylhsminor.yy139 = pik_position_between(p,yymsp[-5].minor.yy73,yymsp[-3].minor.yy139,yymsp[-1].minor.yy139);}
2686 #line 2711 "pikchr.c"
2687 yymsp[-5].minor.yy139 = yylhsminor.yy139;
2688 break;
2689 case 71: /* position ::= expr ABOVE position */
2690 #line 658 "pikchr.y"
2691 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y += yymsp[-2].minor.yy73;}
2692 #line 2717 "pikchr.c"
2693 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2694 break;
2695 case 72: /* position ::= expr BELOW position */
2696 #line 659 "pikchr.y"
2697 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y -= yymsp[-2].minor.yy73;}
2698 #line 2723 "pikchr.c"
2699 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2700 break;
2701 case 73: /* position ::= expr LEFT OF position */
2702 #line 660 "pikchr.y"
2703 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x -= yymsp[-3].minor.yy73;}
2704 #line 2729 "pikchr.c"
2705 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2706 break;
2707 case 74: /* position ::= expr RIGHT OF position */
2708 #line 661 "pikchr.y"
2709 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x += yymsp[-3].minor.yy73;}
2710 #line 2735 "pikchr.c"
2711 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2712 break;
2713 case 75: /* position ::= expr ON HEADING EDGEPT OF position */
2714 #line 663 "pikchr.y"
2715 {yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-5].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2716 #line 2741 "pikchr.c"
2717 yymsp[-5].minor.yy139 = yylhsminor.yy139;
2718 break;
2719 case 76: /* position ::= expr HEADING EDGEPT OF position */
2720 #line 665 "pikchr.y"
2721 {yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-4].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2722 #line 2747 "pikchr.c"
2723 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2724 break;
2725 case 77: /* position ::= expr EDGEPT OF position */
2726 #line 667 "pikchr.y"
2727 {yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2728 #line 2753 "pikchr.c"
2729 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2730 break;
2731 case 78: /* position ::= expr ON HEADING expr FROM position */
2732 #line 669 "pikchr.y"
2733 {yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-5].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
2734 #line 2759 "pikchr.c"
2735 yymsp[-5].minor.yy139 = yylhsminor.yy139;
2736 break;
2737 case 79: /* position ::= expr HEADING expr FROM position */
2738 #line 671 "pikchr.y"
2739 {yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
2740 #line 2765 "pikchr.c"
2741 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2742 break;
2743 case 80: /* place ::= edge OF object */
2744 #line 683 "pikchr.y"
2745 {yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2746 #line 2771 "pikchr.c"
2747 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2748 break;
2749 case 81: /* place2 ::= object */
2750 #line 684 "pikchr.y"
2751 {yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,0);}
2752 #line 2777 "pikchr.c"
2753 yymsp[0].minor.yy139 = yylhsminor.yy139;
2754 break;
2755 case 82: /* place2 ::= object DOT_E edge */
2756 #line 685 "pikchr.y"
2757 {yylhsminor.yy139 = pik_place_of_elem(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2758 #line 2783 "pikchr.c"
2759 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2760 break;
2761 case 83: /* place2 ::= NTH VERTEX OF object */
2762 #line 686 "pikchr.y"
2763 {yylhsminor.yy139 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy254);}
2764 #line 2789 "pikchr.c"
2765 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2766 break;
2767 case 84: /* object ::= nth */
2768 #line 698 "pikchr.y"
2769 {yylhsminor.yy254 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2770 #line 2795 "pikchr.c"
2771 yymsp[0].minor.yy254 = yylhsminor.yy254;
2772 break;
2773 case 85: /* object ::= nth OF|IN object */
2774 #line 699 "pikchr.y"
2775 {yylhsminor.yy254 = pik_find_nth(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2776 #line 2801 "pikchr.c"
2777 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2778 break;
2779 case 86: /* objectname ::= PLACENAME */
2780 #line 701 "pikchr.y"
2781 {yylhsminor.yy254 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2782 #line 2807 "pikchr.c"
2783 yymsp[0].minor.yy254 = yylhsminor.yy254;
2784 break;
2785 case 87: /* objectname ::= objectname DOT_U PLACENAME */
2786 #line 703 "pikchr.y"
2787 {yylhsminor.yy254 = pik_find_byname(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2788 #line 2813 "pikchr.c"
2789 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2790 break;
2791 case 88: /* nth ::= NTH CLASSNAME */
2792 #line 705 "pikchr.y"
2793 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2794 #line 2819 "pikchr.c"
2795 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2796 break;
2797 case 89: /* nth ::= NTH LAST CLASSNAME */
2798 #line 706 "pikchr.y"
2799 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2800 #line 2825 "pikchr.c"
2801 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2802 break;
2803 case 90: /* nth ::= LAST CLASSNAME */
2804 #line 707 "pikchr.y"
2805 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2806 #line 2831 "pikchr.c"
2807 break;
2808 case 91: /* nth ::= LAST */
2809 #line 708 "pikchr.y"
2810 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2811 #line 2836 "pikchr.c"
2812 yymsp[0].minor.yy0 = yylhsminor.yy0;
2813 break;
2814 case 92: /* nth ::= NTH LB RB */
2815 #line 709 "pikchr.y"
2816 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2817 #line 2842 "pikchr.c"
2818 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2819 break;
2820 case 93: /* nth ::= NTH LAST LB RB */
2821 #line 710 "pikchr.y"
2822 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2823 #line 2848 "pikchr.c"
2824 yymsp[-3].minor.yy0 = yylhsminor.yy0;
2825 break;
2826 case 94: /* nth ::= LAST LB RB */
2827 #line 711 "pikchr.y"
2828 {yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2829 #line 2854 "pikchr.c"
2830 break;
2831 case 95: /* expr ::= expr PLUS expr */
2832 #line 713 "pikchr.y"
2833 {yylhsminor.yy73=yymsp[-2].minor.yy73+yymsp[0].minor.yy73;}
2834 #line 2859 "pikchr.c"
2835 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2836 break;
2837 case 96: /* expr ::= expr MINUS expr */
2838 #line 714 "pikchr.y"
2839 {yylhsminor.yy73=yymsp[-2].minor.yy73-yymsp[0].minor.yy73;}
2840 #line 2865 "pikchr.c"
2841 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2842 break;
2843 case 97: /* expr ::= expr STAR expr */
2844 #line 715 "pikchr.y"
2845 {yylhsminor.yy73=yymsp[-2].minor.yy73*yymsp[0].minor.yy73;}
2846 #line 2871 "pikchr.c"
2847 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2848 break;
2849 case 98: /* expr ::= expr SLASH expr */
2850 #line 716 "pikchr.y"
2851 {
2852 if( yymsp[0].minor.yy73==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy73 = 0.0; }
2853 else{ yylhsminor.yy73 = yymsp[-2].minor.yy73/yymsp[0].minor.yy73; }
2854 }
2855 #line 2880 "pikchr.c"
2856 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2857 break;
2858 case 99: /* expr ::= MINUS expr */
2859 #line 720 "pikchr.y"
2860 {yymsp[-1].minor.yy73=-yymsp[0].minor.yy73;}
2861 #line 2886 "pikchr.c"
2862 break;
2863 case 100: /* expr ::= PLUS expr */
2864 #line 721 "pikchr.y"
2865 {yymsp[-1].minor.yy73=yymsp[0].minor.yy73;}
2866 #line 2891 "pikchr.c"
2867 break;
2868 case 101: /* expr ::= LP expr RP */
2869 #line 722 "pikchr.y"
2870 {yymsp[-2].minor.yy73=yymsp[-1].minor.yy73;}
2871 #line 2896 "pikchr.c"
2872 break;
2873 case 102: /* expr ::= NUMBER */
2874 #line 723 "pikchr.y"
2875 {yylhsminor.yy73=pik_atof(p,&yymsp[0].minor.yy0);}
2876 #line 2901 "pikchr.c"
2877 yymsp[0].minor.yy73 = yylhsminor.yy73;
2878 break;
2879 case 103: /* expr ::= ID */
2880 #line 724 "pikchr.y"
2881 {yylhsminor.yy73=pik_get_var(p,&yymsp[0].minor.yy0);}
2882 #line 2907 "pikchr.c"
2883 yymsp[0].minor.yy73 = yylhsminor.yy73;
2884 break;
2885 case 104: /* expr ::= FUNC1 LP expr RP */
2886 #line 725 "pikchr.y"
2887 {yylhsminor.yy73 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy73,0.0);}
2888 #line 2913 "pikchr.c"
2889 yymsp[-3].minor.yy73 = yylhsminor.yy73;
2890 break;
2891 case 105: /* expr ::= FUNC2 LP expr COMMA expr RP */
2892 #line 726 "pikchr.y"
2893 {yylhsminor.yy73 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy73,yymsp[-1].minor.yy73);}
2894 #line 2919 "pikchr.c"
2895 yymsp[-5].minor.yy73 = yylhsminor.yy73;
2896 break;
2897 case 106: /* expr ::= place2 DOT_XY X */
2898 #line 727 "pikchr.y"
2899 {yylhsminor.yy73 = yymsp[-2].minor.yy139.x;}
2900 #line 2925 "pikchr.c"
2901 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2902 break;
2903 case 107: /* expr ::= place2 DOT_XY Y */
2904 #line 728 "pikchr.y"
2905 {yylhsminor.yy73 = yymsp[-2].minor.yy139.y;}
2906 #line 2931 "pikchr.c"
2907 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2908 break;
2909 case 108: /* expr ::= object DOT_L numproperty */
2910 case 109: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==109);
2911 case 110: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==110);
2912 #line 729 "pikchr.y"
2913 {yylhsminor.yy73=pik_property_of(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2914 #line 2939 "pikchr.c"
2915 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2916 break;
2917 default:
2918 /* (111) lvalue ::= ID */ yytestcase(yyruleno==111);
2919 /* (112) lvalue ::= FILL */ yytestcase(yyruleno==112);
@@ -3012,18 +3014,18 @@
3012 ){
3013 pik_parserARG_FETCH
3014 pik_parserCTX_FETCH
3015 #define TOKEN yyminor
3016 /************ Begin %syntax_error code ****************************************/
3017 #line 496 "pikchr.y"
3018
3019 if( TOKEN.z && TOKEN.z[0] ){
3020 pik_error(p, &TOKEN, "syntax error");
3021 }else{
3022 pik_error(p, 0, "syntax error");
3023 }
3024 #line 3049 "pikchr.c"
3025 /************ End %syntax_error code ******************************************/
3026 pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
3027 pik_parserCTX_STORE
3028 }
3029
@@ -3252,11 +3254,11 @@
3252 #else
3253 (void)iToken;
3254 return 0;
3255 #endif
3256 }
3257 #line 734 "pikchr.y"
3258
3259
3260
3261 /* Chart of the 140 official HTML color names with their
3262 ** corresponding RGB value.
@@ -4513,10 +4515,13 @@
4513 pik_append(p,"fill:none;",-1);
4514 }
4515 if( pElem->sw>0.0 && pElem->color>=0.0 ){
4516 PNum sw = pElem->sw;
4517 pik_append_dis(p, "stroke-width:", sw, ";");
 
 
 
4518 pik_append_clr(p, "stroke:",pElem->color,";");
4519 if( pElem->dotted>0.0 ){
4520 PNum v = pElem->dotted;
4521 if( sw<2.1/p->rScale ) sw = 2.1/p->rScale;
4522 pik_append_dis(p,"stroke-dasharray:",sw,"");
@@ -5238,10 +5243,21 @@
5238 break;
5239 }
5240 }
5241 }
5242
 
 
 
 
 
 
 
 
 
 
 
5243
5244 /* Add a new term to the path for a line-oriented object by transferring
5245 ** the information in the ptTo field over onto the path and into ptFrom
5246 ** resetting the ptTo.
5247 */
@@ -5250,11 +5266,11 @@
5250 if( !pElem->type->isLine ){
5251 pik_error(p, pToken, "use with line-oriented objects only");
5252 return;
5253 }
5254 n = p->nTPath - 1;
5255 if( n<1 ){
5256 pik_error(p, pToken, "no prior path points");
5257 return;
5258 }
5259 p->thenFlag = 1;
5260 }
@@ -5288,10 +5304,11 @@
5288 PToken x = pik_next_semantic_token(p, &pElem->errTok);
5289 pik_error(p, &x, "syntax error");
5290 }
5291 return;
5292 }
 
5293 n = p->nTPath - 1;
5294 if( p->thenFlag || p->mTPath==3 || n==0 ){
5295 n = pik_next_rpath(p, pDir);
5296 p->thenFlag = 0;
5297 }
@@ -5340,10 +5357,11 @@
5340 PNum rDist = pDist->rAbs + pik_value(p,"linewid",7,0)*pDist->rRel;
5341 if( !pElem->type->isLine ){
5342 pik_error(p, pErr, "use with line-oriented objects only");
5343 return;
5344 }
 
5345 do{
5346 n = pik_next_rpath(p, pErr);
5347 }while( n<1 );
5348 if( pHeading ){
5349 if( rHdg<0.0 || rHdg>360.0 ){
@@ -5385,10 +5403,11 @@
5385 int n;
5386 if( !pElem->type->isLine ){
5387 pik_error(p, pDir, "use with line-oriented objects only");
5388 return;
5389 }
 
5390 n = p->nTPath - 1;
5391 if( p->thenFlag || p->mTPath==3 || n==0 ){
5392 n = pik_next_rpath(p, pDir);
5393 p->thenFlag = 0;
5394 }
@@ -5900,17 +5919,20 @@
5900 p->aTPath[i].x = pOther->aPath[i].x + dx;
5901 p->aTPath[i].y = pOther->aPath[i].y + dy;
5902 }
5903 p->nTPath = pOther->nPath;
5904 p->mTPath = 3;
 
5905 }
5906 pElem->w = pOther->w;
5907 pElem->h = pOther->h;
 
 
5908 pElem->rad = pOther->rad;
5909 pElem->sw = pOther->sw;
5910 pElem->dashed = pOther->dashed;
5911 pElem->dotted = pOther->dashed;
5912 pElem->fill = pOther->fill;
5913 pElem->color = pOther->color;
5914 pElem->cw = pOther->cw;
5915 pElem->larrow = pOther->larrow;
5916 pElem->rarrow = pOther->rarrow;
@@ -7029,6 +7051,6 @@
7029 printf("</body></html>\n");
7030 return 0;
7031 }
7032 #endif /* PIKCHR_SHELL */
7033
7034 #line 7059 "pikchr.c"
7035
--- src/pikchr.c
+++ src/pikchr.c
@@ -275,10 +275,11 @@
275 #define A_COLOR 0x0040
276 #define A_ARROW 0x0080
277 #define A_FROM 0x0100
278 #define A_CW 0x0200
279 #define A_AT 0x0400
280 #define A_TO 0x0800 /* one or more movement attributes */
281
282
283 /* A single element */
284 struct PElem {
285 const PClass *type; /* Element type */
@@ -341,12 +342,13 @@
342 PNum fontScale; /* Scale fonts by this percent */
343 PNum charWidth; /* Character width */
344 PNum charHeight; /* Character height */
345 PNum wArrow; /* Width of arrowhead at the fat end */
346 PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */
347 char bLayoutVars; /* True if cache is valid */
348 char thenFlag; /* True if "then" seen */
349 char samePath; /* aTPath copied by "same" */
350 const char *zClass; /* Class name for the <svg> */
351 int wSVG, hSVG; /* Width and height of the <svg> */
352 /* Paths for lines are constructed here first, then transferred into
353 ** the PElem object at the end: */
354 int nTPath; /* Number of entries on aTPath[] */
@@ -450,11 +452,11 @@
452 static void pik_behind(Pik*,PElem*);
453 static PElem *pik_assert(Pik*,PNum,PToken*,PNum);
454 static PElem *pik_place_assert(Pik*,PPoint*,PToken*,PPoint*);
455
456
457 #line 483 "pikchr.c"
458 /**************** End of %include directives **********************************/
459 /* These constants specify the various numeric values for terminal symbols.
460 ***************** Begin token definitions *************************************/
461 #ifndef T_ID
462 #define T_ID 1
@@ -1626,22 +1628,22 @@
1628 ** inside the C code.
1629 */
1630 /********* Begin destructor definitions ***************************************/
1631 case 94: /* element_list */
1632 {
1633 #line 472 "pikchr.y"
1634 pik_elist_free(p,(yypminor->yy72));
1635 #line 1660 "pikchr.c"
1636 }
1637 break;
1638 case 95: /* element */
1639 case 96: /* unnamed_element */
1640 case 97: /* basetype */
1641 {
1642 #line 474 "pikchr.y"
1643 pik_elem_free(p,(yypminor->yy254));
1644 #line 1669 "pikchr.c"
1645 }
1646 break;
1647 /********* End destructor definitions *****************************************/
1648 default: break; /* If no destructor action specified: do nothing */
1649 }
@@ -1855,14 +1857,14 @@
1857 #endif
1858 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1859 /* Here code is inserted which will execute if the parser
1860 ** stack every overflows */
1861 /******** Begin %stack_overflow code ******************************************/
1862 #line 505 "pikchr.y"
1863
1864 pik_error(p, 0, "parser stack overflow");
1865 #line 1890 "pikchr.c"
1866 /******** End %stack_overflow code ********************************************/
1867 pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
1868 pik_parserCTX_STORE
1869 }
1870
@@ -2327,593 +2329,593 @@
2329 ** break;
2330 */
2331 /********** Begin reduce actions **********************************************/
2332 YYMINORTYPE yylhsminor;
2333 case 0: /* document ::= element_list */
2334 #line 509 "pikchr.y"
2335 {pik_render(p,yymsp[0].minor.yy72);}
2336 #line 2361 "pikchr.c"
2337 break;
2338 case 1: /* element_list ::= element */
2339 #line 512 "pikchr.y"
2340 { yylhsminor.yy72 = pik_elist_append(p,0,yymsp[0].minor.yy254); }
2341 #line 2366 "pikchr.c"
2342 yymsp[0].minor.yy72 = yylhsminor.yy72;
2343 break;
2344 case 2: /* element_list ::= element_list EOL element */
2345 #line 514 "pikchr.y"
2346 { yylhsminor.yy72 = pik_elist_append(p,yymsp[-2].minor.yy72,yymsp[0].minor.yy254); }
2347 #line 2372 "pikchr.c"
2348 yymsp[-2].minor.yy72 = yylhsminor.yy72;
2349 break;
2350 case 3: /* element ::= */
2351 #line 517 "pikchr.y"
2352 { yymsp[1].minor.yy254 = 0; }
2353 #line 2378 "pikchr.c"
2354 break;
2355 case 4: /* element ::= direction */
2356 #line 518 "pikchr.y"
2357 { pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy254=0; }
2358 #line 2383 "pikchr.c"
2359 yymsp[0].minor.yy254 = yylhsminor.yy254;
2360 break;
2361 case 5: /* element ::= lvalue ASSIGN rvalue */
2362 #line 519 "pikchr.y"
2363 {pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy73,&yymsp[-1].minor.yy0); yylhsminor.yy254=0;}
2364 #line 2389 "pikchr.c"
2365 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2366 break;
2367 case 6: /* element ::= PLACENAME COLON unnamed_element */
2368 #line 521 "pikchr.y"
2369 { yylhsminor.yy254 = yymsp[0].minor.yy254; pik_elem_setname(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0); }
2370 #line 2395 "pikchr.c"
2371 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2372 break;
2373 case 7: /* element ::= PLACENAME COLON position */
2374 #line 523 "pikchr.y"
2375 { yylhsminor.yy254 = pik_elem_new(p,0,0,0);
2376 if(yylhsminor.yy254){ yylhsminor.yy254->ptAt = yymsp[0].minor.yy139; pik_elem_setname(p,yylhsminor.yy254,&yymsp[-2].minor.yy0); }}
2377 #line 2402 "pikchr.c"
2378 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2379 break;
2380 case 8: /* element ::= unnamed_element */
2381 #line 525 "pikchr.y"
2382 {yylhsminor.yy254 = yymsp[0].minor.yy254;}
2383 #line 2408 "pikchr.c"
2384 yymsp[0].minor.yy254 = yylhsminor.yy254;
2385 break;
2386 case 9: /* element ::= print prlist */
2387 #line 526 "pikchr.y"
2388 {pik_append(p,"<br>\n",5); yymsp[-1].minor.yy254=0;}
2389 #line 2414 "pikchr.c"
2390 break;
2391 case 10: /* element ::= ASSERT LP expr EQ expr RP */
2392 #line 531 "pikchr.y"
2393 {yymsp[-5].minor.yy254=pik_assert(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy73);}
2394 #line 2419 "pikchr.c"
2395 break;
2396 case 11: /* element ::= ASSERT LP place EQ place RP */
2397 #line 533 "pikchr.y"
2398 {yymsp[-5].minor.yy254=pik_place_assert(p,&yymsp[-3].minor.yy139,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy139);}
2399 #line 2424 "pikchr.c"
2400 break;
2401 case 12: /* rvalue ::= PLACENAME */
2402 #line 544 "pikchr.y"
2403 {yylhsminor.yy73 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2404 #line 2429 "pikchr.c"
2405 yymsp[0].minor.yy73 = yylhsminor.yy73;
2406 break;
2407 case 13: /* pritem ::= FILL */
2408 case 14: /* pritem ::= COLOR */ yytestcase(yyruleno==14);
2409 case 15: /* pritem ::= THICKNESS */ yytestcase(yyruleno==15);
2410 #line 549 "pikchr.y"
2411 {pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2412 #line 2437 "pikchr.c"
2413 break;
2414 case 16: /* pritem ::= rvalue */
2415 #line 552 "pikchr.y"
2416 {pik_append_num(p,"",yymsp[0].minor.yy73);}
2417 #line 2442 "pikchr.c"
2418 break;
2419 case 17: /* pritem ::= STRING */
2420 #line 553 "pikchr.y"
2421 {pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2422 #line 2447 "pikchr.c"
2423 break;
2424 case 18: /* prsep ::= COMMA */
2425 #line 554 "pikchr.y"
2426 {pik_append(p, " ", 1);}
2427 #line 2452 "pikchr.c"
2428 break;
2429 case 19: /* unnamed_element ::= basetype attribute_list */
2430 #line 557 "pikchr.y"
2431 {yylhsminor.yy254 = yymsp[-1].minor.yy254; pik_after_adding_attributes(p,yylhsminor.yy254);}
2432 #line 2457 "pikchr.c"
2433 yymsp[-1].minor.yy254 = yylhsminor.yy254;
2434 break;
2435 case 20: /* basetype ::= CLASSNAME */
2436 #line 559 "pikchr.y"
2437 {yylhsminor.yy254 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2438 #line 2463 "pikchr.c"
2439 yymsp[0].minor.yy254 = yylhsminor.yy254;
2440 break;
2441 case 21: /* basetype ::= STRING textposition */
2442 #line 561 "pikchr.y"
2443 {yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy74; yylhsminor.yy254 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2444 #line 2469 "pikchr.c"
2445 yymsp[-1].minor.yy254 = yylhsminor.yy254;
2446 break;
2447 case 22: /* basetype ::= LB savelist element_list RB */
2448 #line 563 "pikchr.y"
2449 { p->list = yymsp[-2].minor.yy72; yymsp[-3].minor.yy254 = pik_elem_new(p,0,0,yymsp[-1].minor.yy72); if(yymsp[-3].minor.yy254) yymsp[-3].minor.yy254->errTok = yymsp[0].minor.yy0; }
2450 #line 2475 "pikchr.c"
2451 break;
2452 case 23: /* savelist ::= */
2453 #line 568 "pikchr.y"
2454 {yymsp[1].minor.yy72 = p->list; p->list = 0;}
2455 #line 2480 "pikchr.c"
2456 break;
2457 case 24: /* relexpr ::= expr */
2458 #line 575 "pikchr.y"
2459 {yylhsminor.yy60.rAbs = yymsp[0].minor.yy73; yylhsminor.yy60.rRel = 0;}
2460 #line 2485 "pikchr.c"
2461 yymsp[0].minor.yy60 = yylhsminor.yy60;
2462 break;
2463 case 25: /* relexpr ::= expr PERCENT */
2464 #line 576 "pikchr.y"
2465 {yylhsminor.yy60.rAbs = 0; yylhsminor.yy60.rRel = yymsp[-1].minor.yy73/100;}
2466 #line 2491 "pikchr.c"
2467 yymsp[-1].minor.yy60 = yylhsminor.yy60;
2468 break;
2469 case 26: /* optrelexpr ::= */
2470 #line 578 "pikchr.y"
2471 {yymsp[1].minor.yy60.rAbs = 0; yymsp[1].minor.yy60.rRel = 1.0;}
2472 #line 2497 "pikchr.c"
2473 break;
2474 case 27: /* attribute_list ::= relexpr alist */
2475 #line 580 "pikchr.y"
2476 {pik_add_direction(p,0,&yymsp[-1].minor.yy60);}
2477 #line 2502 "pikchr.c"
2478 break;
2479 case 28: /* attribute ::= numproperty relexpr */
2480 #line 584 "pikchr.y"
2481 { pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60); }
2482 #line 2507 "pikchr.c"
2483 break;
2484 case 29: /* attribute ::= dashproperty expr */
2485 #line 585 "pikchr.y"
2486 { pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy73); }
2487 #line 2512 "pikchr.c"
2488 break;
2489 case 30: /* attribute ::= dashproperty */
2490 #line 586 "pikchr.y"
2491 { pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2492 #line 2517 "pikchr.c"
2493 break;
2494 case 31: /* attribute ::= colorproperty rvalue */
2495 #line 587 "pikchr.y"
2496 { pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73); }
2497 #line 2522 "pikchr.c"
2498 break;
2499 case 32: /* attribute ::= go direction optrelexpr */
2500 #line 588 "pikchr.y"
2501 { pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy60);}
2502 #line 2527 "pikchr.c"
2503 break;
2504 case 33: /* attribute ::= go direction even position */
2505 #line 589 "pikchr.y"
2506 {pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139);}
2507 #line 2532 "pikchr.c"
2508 break;
2509 case 34: /* attribute ::= CLOSE */
2510 #line 590 "pikchr.y"
2511 { pik_close_path(p,&yymsp[0].minor.yy0); }
2512 #line 2537 "pikchr.c"
2513 break;
2514 case 35: /* attribute ::= CHOP */
2515 #line 591 "pikchr.y"
2516 { p->cur->bChop = 1; }
2517 #line 2542 "pikchr.c"
2518 break;
2519 case 36: /* attribute ::= FROM position */
2520 #line 592 "pikchr.y"
2521 { pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
2522 #line 2547 "pikchr.c"
2523 break;
2524 case 37: /* attribute ::= TO position */
2525 #line 593 "pikchr.y"
2526 { pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy139); }
2527 #line 2552 "pikchr.c"
2528 break;
2529 case 38: /* attribute ::= THEN */
2530 #line 594 "pikchr.y"
2531 { pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2532 #line 2557 "pikchr.c"
2533 break;
2534 case 39: /* attribute ::= THEN optrelexpr HEADING expr */
2535 case 41: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==41);
2536 #line 596 "pikchr.y"
2537 {pik_move_hdg(p,&yymsp[-2].minor.yy60,&yymsp[-1].minor.yy0,yymsp[0].minor.yy73,0,&yymsp[-3].minor.yy0);}
2538 #line 2563 "pikchr.c"
2539 break;
2540 case 40: /* attribute ::= THEN optrelexpr EDGEPT */
2541 case 42: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==42);
2542 #line 597 "pikchr.y"
2543 {pik_move_hdg(p,&yymsp[-1].minor.yy60,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2544 #line 2569 "pikchr.c"
2545 break;
2546 case 43: /* attribute ::= AT position */
2547 #line 602 "pikchr.y"
2548 { pik_set_at(p,0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
2549 #line 2574 "pikchr.c"
2550 break;
2551 case 44: /* attribute ::= SAME */
2552 #line 604 "pikchr.y"
2553 {pik_same(p,0,&yymsp[0].minor.yy0);}
2554 #line 2579 "pikchr.c"
2555 break;
2556 case 45: /* attribute ::= SAME AS object */
2557 #line 605 "pikchr.y"
2558 {pik_same(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2559 #line 2584 "pikchr.c"
2560 break;
2561 case 46: /* attribute ::= STRING textposition */
2562 #line 606 "pikchr.y"
2563 {pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy74);}
2564 #line 2589 "pikchr.c"
2565 break;
2566 case 47: /* attribute ::= FIT */
2567 #line 607 "pikchr.y"
2568 {pik_size_to_fit(p,&yymsp[0].minor.yy0); }
2569 #line 2594 "pikchr.c"
2570 break;
2571 case 48: /* attribute ::= BEHIND object */
2572 #line 608 "pikchr.y"
2573 {pik_behind(p,yymsp[0].minor.yy254);}
2574 #line 2599 "pikchr.c"
2575 break;
2576 case 49: /* withclause ::= DOT_E edge AT position */
2577 case 50: /* withclause ::= edge AT position */ yytestcase(yyruleno==50);
2578 #line 616 "pikchr.y"
2579 { pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy139,&yymsp[-1].minor.yy0); }
2580 #line 2605 "pikchr.c"
2581 break;
2582 case 51: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2583 #line 620 "pikchr.y"
2584 {yylhsminor.yy0 = yymsp[0].minor.yy0;}
2585 #line 2610 "pikchr.c"
2586 yymsp[0].minor.yy0 = yylhsminor.yy0;
2587 break;
2588 case 52: /* boolproperty ::= CW */
2589 #line 631 "pikchr.y"
2590 {p->cur->cw = 1;}
2591 #line 2616 "pikchr.c"
2592 break;
2593 case 53: /* boolproperty ::= CCW */
2594 #line 632 "pikchr.y"
2595 {p->cur->cw = 0;}
2596 #line 2621 "pikchr.c"
2597 break;
2598 case 54: /* boolproperty ::= LARROW */
2599 #line 633 "pikchr.y"
2600 {p->cur->larrow=1; p->cur->rarrow=0; }
2601 #line 2626 "pikchr.c"
2602 break;
2603 case 55: /* boolproperty ::= RARROW */
2604 #line 634 "pikchr.y"
2605 {p->cur->larrow=0; p->cur->rarrow=1; }
2606 #line 2631 "pikchr.c"
2607 break;
2608 case 56: /* boolproperty ::= LRARROW */
2609 #line 635 "pikchr.y"
2610 {p->cur->larrow=1; p->cur->rarrow=1; }
2611 #line 2636 "pikchr.c"
2612 break;
2613 case 57: /* boolproperty ::= INVIS */
2614 #line 636 "pikchr.y"
2615 {p->cur->sw = 0.0;}
2616 #line 2641 "pikchr.c"
2617 break;
2618 case 58: /* boolproperty ::= THICK */
2619 #line 637 "pikchr.y"
2620 {p->cur->sw *= 1.5;}
2621 #line 2646 "pikchr.c"
2622 break;
2623 case 59: /* boolproperty ::= THIN */
2624 #line 638 "pikchr.y"
2625 {p->cur->sw *= 0.67;}
2626 #line 2651 "pikchr.c"
2627 break;
2628 case 60: /* textposition ::= */
2629 #line 640 "pikchr.y"
2630 {yymsp[1].minor.yy74 = 0;}
2631 #line 2656 "pikchr.c"
2632 break;
2633 case 61: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2634 #line 643 "pikchr.y"
2635 {yylhsminor.yy74 = pik_text_position(p,yymsp[-1].minor.yy74,&yymsp[0].minor.yy0);}
2636 #line 2661 "pikchr.c"
2637 yymsp[-1].minor.yy74 = yylhsminor.yy74;
2638 break;
2639 case 62: /* position ::= expr COMMA expr */
2640 #line 646 "pikchr.y"
2641 {yylhsminor.yy139.x=yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[0].minor.yy73;}
2642 #line 2667 "pikchr.c"
2643 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2644 break;
2645 case 63: /* position ::= place PLUS expr COMMA expr */
2646 #line 648 "pikchr.y"
2647 {yylhsminor.yy139.x=yymsp[-4].minor.yy139.x+yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y+yymsp[0].minor.yy73;}
2648 #line 2673 "pikchr.c"
2649 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2650 break;
2651 case 64: /* position ::= place MINUS expr COMMA expr */
2652 #line 649 "pikchr.y"
2653 {yylhsminor.yy139.x=yymsp[-4].minor.yy139.x-yymsp[-2].minor.yy73; yylhsminor.yy139.y=yymsp[-4].minor.yy139.y-yymsp[0].minor.yy73;}
2654 #line 2679 "pikchr.c"
2655 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2656 break;
2657 case 65: /* position ::= place PLUS LP expr COMMA expr RP */
2658 #line 651 "pikchr.y"
2659 {yylhsminor.yy139.x=yymsp[-6].minor.yy139.x+yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y+yymsp[-1].minor.yy73;}
2660 #line 2685 "pikchr.c"
2661 yymsp[-6].minor.yy139 = yylhsminor.yy139;
2662 break;
2663 case 66: /* position ::= place MINUS LP expr COMMA expr RP */
2664 #line 653 "pikchr.y"
2665 {yylhsminor.yy139.x=yymsp[-6].minor.yy139.x-yymsp[-3].minor.yy73; yylhsminor.yy139.y=yymsp[-6].minor.yy139.y-yymsp[-1].minor.yy73;}
2666 #line 2691 "pikchr.c"
2667 yymsp[-6].minor.yy139 = yylhsminor.yy139;
2668 break;
2669 case 67: /* position ::= LP position COMMA position RP */
2670 #line 654 "pikchr.y"
2671 {yymsp[-4].minor.yy139.x=yymsp[-3].minor.yy139.x; yymsp[-4].minor.yy139.y=yymsp[-1].minor.yy139.y;}
2672 #line 2697 "pikchr.c"
2673 break;
2674 case 68: /* position ::= LP position RP */
2675 #line 655 "pikchr.y"
2676 {yymsp[-2].minor.yy139=yymsp[-1].minor.yy139;}
2677 #line 2702 "pikchr.c"
2678 break;
2679 case 69: /* position ::= expr between position AND position */
2680 #line 657 "pikchr.y"
2681 {yylhsminor.yy139 = pik_position_between(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy139,yymsp[0].minor.yy139);}
2682 #line 2707 "pikchr.c"
2683 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2684 break;
2685 case 70: /* position ::= expr LT position COMMA position GT */
2686 #line 659 "pikchr.y"
2687 {yylhsminor.yy139 = pik_position_between(p,yymsp[-5].minor.yy73,yymsp[-3].minor.yy139,yymsp[-1].minor.yy139);}
2688 #line 2713 "pikchr.c"
2689 yymsp[-5].minor.yy139 = yylhsminor.yy139;
2690 break;
2691 case 71: /* position ::= expr ABOVE position */
2692 #line 660 "pikchr.y"
2693 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y += yymsp[-2].minor.yy73;}
2694 #line 2719 "pikchr.c"
2695 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2696 break;
2697 case 72: /* position ::= expr BELOW position */
2698 #line 661 "pikchr.y"
2699 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.y -= yymsp[-2].minor.yy73;}
2700 #line 2725 "pikchr.c"
2701 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2702 break;
2703 case 73: /* position ::= expr LEFT OF position */
2704 #line 662 "pikchr.y"
2705 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x -= yymsp[-3].minor.yy73;}
2706 #line 2731 "pikchr.c"
2707 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2708 break;
2709 case 74: /* position ::= expr RIGHT OF position */
2710 #line 663 "pikchr.y"
2711 {yylhsminor.yy139=yymsp[0].minor.yy139; yylhsminor.yy139.x += yymsp[-3].minor.yy73;}
2712 #line 2737 "pikchr.c"
2713 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2714 break;
2715 case 75: /* position ::= expr ON HEADING EDGEPT OF position */
2716 #line 665 "pikchr.y"
2717 {yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-5].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2718 #line 2743 "pikchr.c"
2719 yymsp[-5].minor.yy139 = yylhsminor.yy139;
2720 break;
2721 case 76: /* position ::= expr HEADING EDGEPT OF position */
2722 #line 667 "pikchr.y"
2723 {yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-4].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2724 #line 2749 "pikchr.c"
2725 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2726 break;
2727 case 77: /* position ::= expr EDGEPT OF position */
2728 #line 669 "pikchr.y"
2729 {yylhsminor.yy139 = pik_position_at_hdg(p,yymsp[-3].minor.yy73,&yymsp[-2].minor.yy0,yymsp[0].minor.yy139);}
2730 #line 2755 "pikchr.c"
2731 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2732 break;
2733 case 78: /* position ::= expr ON HEADING expr FROM position */
2734 #line 671 "pikchr.y"
2735 {yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-5].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
2736 #line 2761 "pikchr.c"
2737 yymsp[-5].minor.yy139 = yylhsminor.yy139;
2738 break;
2739 case 79: /* position ::= expr HEADING expr FROM position */
2740 #line 673 "pikchr.y"
2741 {yylhsminor.yy139 = pik_position_at_angle(p,yymsp[-4].minor.yy73,yymsp[-2].minor.yy73,yymsp[0].minor.yy139);}
2742 #line 2767 "pikchr.c"
2743 yymsp[-4].minor.yy139 = yylhsminor.yy139;
2744 break;
2745 case 80: /* place ::= edge OF object */
2746 #line 685 "pikchr.y"
2747 {yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2748 #line 2773 "pikchr.c"
2749 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2750 break;
2751 case 81: /* place2 ::= object */
2752 #line 686 "pikchr.y"
2753 {yylhsminor.yy139 = pik_place_of_elem(p,yymsp[0].minor.yy254,0);}
2754 #line 2779 "pikchr.c"
2755 yymsp[0].minor.yy139 = yylhsminor.yy139;
2756 break;
2757 case 82: /* place2 ::= object DOT_E edge */
2758 #line 687 "pikchr.y"
2759 {yylhsminor.yy139 = pik_place_of_elem(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2760 #line 2785 "pikchr.c"
2761 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2762 break;
2763 case 83: /* place2 ::= NTH VERTEX OF object */
2764 #line 688 "pikchr.y"
2765 {yylhsminor.yy139 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy254);}
2766 #line 2791 "pikchr.c"
2767 yymsp[-3].minor.yy139 = yylhsminor.yy139;
2768 break;
2769 case 84: /* object ::= nth */
2770 #line 700 "pikchr.y"
2771 {yylhsminor.yy254 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2772 #line 2797 "pikchr.c"
2773 yymsp[0].minor.yy254 = yylhsminor.yy254;
2774 break;
2775 case 85: /* object ::= nth OF|IN object */
2776 #line 701 "pikchr.y"
2777 {yylhsminor.yy254 = pik_find_nth(p,yymsp[0].minor.yy254,&yymsp[-2].minor.yy0);}
2778 #line 2803 "pikchr.c"
2779 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2780 break;
2781 case 86: /* objectname ::= PLACENAME */
2782 #line 703 "pikchr.y"
2783 {yylhsminor.yy254 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2784 #line 2809 "pikchr.c"
2785 yymsp[0].minor.yy254 = yylhsminor.yy254;
2786 break;
2787 case 87: /* objectname ::= objectname DOT_U PLACENAME */
2788 #line 705 "pikchr.y"
2789 {yylhsminor.yy254 = pik_find_byname(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2790 #line 2815 "pikchr.c"
2791 yymsp[-2].minor.yy254 = yylhsminor.yy254;
2792 break;
2793 case 88: /* nth ::= NTH CLASSNAME */
2794 #line 707 "pikchr.y"
2795 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2796 #line 2821 "pikchr.c"
2797 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2798 break;
2799 case 89: /* nth ::= NTH LAST CLASSNAME */
2800 #line 708 "pikchr.y"
2801 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2802 #line 2827 "pikchr.c"
2803 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2804 break;
2805 case 90: /* nth ::= LAST CLASSNAME */
2806 #line 709 "pikchr.y"
2807 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2808 #line 2833 "pikchr.c"
2809 break;
2810 case 91: /* nth ::= LAST */
2811 #line 710 "pikchr.y"
2812 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2813 #line 2838 "pikchr.c"
2814 yymsp[0].minor.yy0 = yylhsminor.yy0;
2815 break;
2816 case 92: /* nth ::= NTH LB RB */
2817 #line 711 "pikchr.y"
2818 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2819 #line 2844 "pikchr.c"
2820 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2821 break;
2822 case 93: /* nth ::= NTH LAST LB RB */
2823 #line 712 "pikchr.y"
2824 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2825 #line 2850 "pikchr.c"
2826 yymsp[-3].minor.yy0 = yylhsminor.yy0;
2827 break;
2828 case 94: /* nth ::= LAST LB RB */
2829 #line 713 "pikchr.y"
2830 {yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2831 #line 2856 "pikchr.c"
2832 break;
2833 case 95: /* expr ::= expr PLUS expr */
2834 #line 715 "pikchr.y"
2835 {yylhsminor.yy73=yymsp[-2].minor.yy73+yymsp[0].minor.yy73;}
2836 #line 2861 "pikchr.c"
2837 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2838 break;
2839 case 96: /* expr ::= expr MINUS expr */
2840 #line 716 "pikchr.y"
2841 {yylhsminor.yy73=yymsp[-2].minor.yy73-yymsp[0].minor.yy73;}
2842 #line 2867 "pikchr.c"
2843 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2844 break;
2845 case 97: /* expr ::= expr STAR expr */
2846 #line 717 "pikchr.y"
2847 {yylhsminor.yy73=yymsp[-2].minor.yy73*yymsp[0].minor.yy73;}
2848 #line 2873 "pikchr.c"
2849 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2850 break;
2851 case 98: /* expr ::= expr SLASH expr */
2852 #line 718 "pikchr.y"
2853 {
2854 if( yymsp[0].minor.yy73==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy73 = 0.0; }
2855 else{ yylhsminor.yy73 = yymsp[-2].minor.yy73/yymsp[0].minor.yy73; }
2856 }
2857 #line 2882 "pikchr.c"
2858 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2859 break;
2860 case 99: /* expr ::= MINUS expr */
2861 #line 722 "pikchr.y"
2862 {yymsp[-1].minor.yy73=-yymsp[0].minor.yy73;}
2863 #line 2888 "pikchr.c"
2864 break;
2865 case 100: /* expr ::= PLUS expr */
2866 #line 723 "pikchr.y"
2867 {yymsp[-1].minor.yy73=yymsp[0].minor.yy73;}
2868 #line 2893 "pikchr.c"
2869 break;
2870 case 101: /* expr ::= LP expr RP */
2871 #line 724 "pikchr.y"
2872 {yymsp[-2].minor.yy73=yymsp[-1].minor.yy73;}
2873 #line 2898 "pikchr.c"
2874 break;
2875 case 102: /* expr ::= NUMBER */
2876 #line 725 "pikchr.y"
2877 {yylhsminor.yy73=pik_atof(p,&yymsp[0].minor.yy0);}
2878 #line 2903 "pikchr.c"
2879 yymsp[0].minor.yy73 = yylhsminor.yy73;
2880 break;
2881 case 103: /* expr ::= ID */
2882 #line 726 "pikchr.y"
2883 {yylhsminor.yy73=pik_get_var(p,&yymsp[0].minor.yy0);}
2884 #line 2909 "pikchr.c"
2885 yymsp[0].minor.yy73 = yylhsminor.yy73;
2886 break;
2887 case 104: /* expr ::= FUNC1 LP expr RP */
2888 #line 727 "pikchr.y"
2889 {yylhsminor.yy73 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy73,0.0);}
2890 #line 2915 "pikchr.c"
2891 yymsp[-3].minor.yy73 = yylhsminor.yy73;
2892 break;
2893 case 105: /* expr ::= FUNC2 LP expr COMMA expr RP */
2894 #line 728 "pikchr.y"
2895 {yylhsminor.yy73 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy73,yymsp[-1].minor.yy73);}
2896 #line 2921 "pikchr.c"
2897 yymsp[-5].minor.yy73 = yylhsminor.yy73;
2898 break;
2899 case 106: /* expr ::= place2 DOT_XY X */
2900 #line 729 "pikchr.y"
2901 {yylhsminor.yy73 = yymsp[-2].minor.yy139.x;}
2902 #line 2927 "pikchr.c"
2903 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2904 break;
2905 case 107: /* expr ::= place2 DOT_XY Y */
2906 #line 730 "pikchr.y"
2907 {yylhsminor.yy73 = yymsp[-2].minor.yy139.y;}
2908 #line 2933 "pikchr.c"
2909 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2910 break;
2911 case 108: /* expr ::= object DOT_L numproperty */
2912 case 109: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==109);
2913 case 110: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==110);
2914 #line 731 "pikchr.y"
2915 {yylhsminor.yy73=pik_property_of(p,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
2916 #line 2941 "pikchr.c"
2917 yymsp[-2].minor.yy73 = yylhsminor.yy73;
2918 break;
2919 default:
2920 /* (111) lvalue ::= ID */ yytestcase(yyruleno==111);
2921 /* (112) lvalue ::= FILL */ yytestcase(yyruleno==112);
@@ -3012,18 +3014,18 @@
3014 ){
3015 pik_parserARG_FETCH
3016 pik_parserCTX_FETCH
3017 #define TOKEN yyminor
3018 /************ Begin %syntax_error code ****************************************/
3019 #line 498 "pikchr.y"
3020
3021 if( TOKEN.z && TOKEN.z[0] ){
3022 pik_error(p, &TOKEN, "syntax error");
3023 }else{
3024 pik_error(p, 0, "syntax error");
3025 }
3026 #line 3051 "pikchr.c"
3027 /************ End %syntax_error code ******************************************/
3028 pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
3029 pik_parserCTX_STORE
3030 }
3031
@@ -3252,11 +3254,11 @@
3254 #else
3255 (void)iToken;
3256 return 0;
3257 #endif
3258 }
3259 #line 736 "pikchr.y"
3260
3261
3262
3263 /* Chart of the 140 official HTML color names with their
3264 ** corresponding RGB value.
@@ -4513,10 +4515,13 @@
4515 pik_append(p,"fill:none;",-1);
4516 }
4517 if( pElem->sw>0.0 && pElem->color>=0.0 ){
4518 PNum sw = pElem->sw;
4519 pik_append_dis(p, "stroke-width:", sw, ";");
4520 if( pElem->nPath>2 && pElem->rad<=pElem->sw ){
4521 pik_append(p, "stroke-linejoin:round;", -1);
4522 }
4523 pik_append_clr(p, "stroke:",pElem->color,";");
4524 if( pElem->dotted>0.0 ){
4525 PNum v = pElem->dotted;
4526 if( sw<2.1/p->rScale ) sw = 2.1/p->rScale;
4527 pik_append_dis(p,"stroke-dasharray:",sw,"");
@@ -5238,10 +5243,21 @@
5243 break;
5244 }
5245 }
5246 }
5247
5248 /*
5249 ** If the current path information came from a "same" or "same as"
5250 ** reset it.
5251 */
5252 static void pik_reset_samepath(Pik *p, PElem *pElem){
5253 if( p->samePath ){
5254 p->samePath = 0;
5255 p->nTPath = 1;
5256 }
5257 }
5258
5259
5260 /* Add a new term to the path for a line-oriented object by transferring
5261 ** the information in the ptTo field over onto the path and into ptFrom
5262 ** resetting the ptTo.
5263 */
@@ -5250,11 +5266,11 @@
5266 if( !pElem->type->isLine ){
5267 pik_error(p, pToken, "use with line-oriented objects only");
5268 return;
5269 }
5270 n = p->nTPath - 1;
5271 if( n<1 && (pElem->mProp & A_FROM)==0 ){
5272 pik_error(p, pToken, "no prior path points");
5273 return;
5274 }
5275 p->thenFlag = 1;
5276 }
@@ -5288,10 +5304,11 @@
5304 PToken x = pik_next_semantic_token(p, &pElem->errTok);
5305 pik_error(p, &x, "syntax error");
5306 }
5307 return;
5308 }
5309 pik_reset_samepath(p, pElem);
5310 n = p->nTPath - 1;
5311 if( p->thenFlag || p->mTPath==3 || n==0 ){
5312 n = pik_next_rpath(p, pDir);
5313 p->thenFlag = 0;
5314 }
@@ -5340,10 +5357,11 @@
5357 PNum rDist = pDist->rAbs + pik_value(p,"linewid",7,0)*pDist->rRel;
5358 if( !pElem->type->isLine ){
5359 pik_error(p, pErr, "use with line-oriented objects only");
5360 return;
5361 }
5362 pik_reset_samepath(p, pElem);
5363 do{
5364 n = pik_next_rpath(p, pErr);
5365 }while( n<1 );
5366 if( pHeading ){
5367 if( rHdg<0.0 || rHdg>360.0 ){
@@ -5385,10 +5403,11 @@
5403 int n;
5404 if( !pElem->type->isLine ){
5405 pik_error(p, pDir, "use with line-oriented objects only");
5406 return;
5407 }
5408 pik_reset_samepath(p, pElem);
5409 n = p->nTPath - 1;
5410 if( p->thenFlag || p->mTPath==3 || n==0 ){
5411 n = pik_next_rpath(p, pDir);
5412 p->thenFlag = 0;
5413 }
@@ -5900,17 +5919,20 @@
5919 p->aTPath[i].x = pOther->aPath[i].x + dx;
5920 p->aTPath[i].y = pOther->aPath[i].y + dy;
5921 }
5922 p->nTPath = pOther->nPath;
5923 p->mTPath = 3;
5924 p->samePath = 1;
5925 }
5926 if( !pElem->type->isLine ){
5927 pElem->w = pOther->w;
5928 pElem->h = pOther->h;
5929 }
5930 pElem->rad = pOther->rad;
5931 pElem->sw = pOther->sw;
5932 pElem->dashed = pOther->dashed;
5933 pElem->dotted = pOther->dotted;
5934 pElem->fill = pOther->fill;
5935 pElem->color = pOther->color;
5936 pElem->cw = pOther->cw;
5937 pElem->larrow = pOther->larrow;
5938 pElem->rarrow = pOther->rarrow;
@@ -7029,6 +7051,6 @@
7051 printf("</body></html>\n");
7052 return 0;
7053 }
7054 #endif /* PIKCHR_SHELL */
7055
7056 #line 7081 "pikchr.c"
7057
+494 -23
--- src/shell.c
+++ src/shell.c
@@ -569,12 +569,10 @@
569569
*/
570570
static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
571571
int i;
572572
int n;
573573
int aw = w<0 ? -w : w;
574
- char zBuf[1000];
575
- if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3;
576574
for(i=n=0; zUtf[i]; i++){
577575
if( (zUtf[i]&0xc0)!=0x80 ){
578576
n++;
579577
if( n==aw ){
580578
do{ i++; }while( (zUtf[i]&0xc0)==0x80 );
@@ -5313,10 +5311,437 @@
53135311
}
53145312
return rc;
53155313
}
53165314
53175315
/************************* End ../ext/misc/ieee754.c ********************/
5316
+/************************* Begin ../ext/misc/series.c ******************/
5317
+/*
5318
+** 2015-08-18
5319
+**
5320
+** The author disclaims copyright to this source code. In place of
5321
+** a legal notice, here is a blessing:
5322
+**
5323
+** May you do good and not evil.
5324
+** May you find forgiveness for yourself and forgive others.
5325
+** May you share freely, never taking more than you give.
5326
+**
5327
+*************************************************************************
5328
+**
5329
+** This file demonstrates how to create a table-valued-function using
5330
+** a virtual table. This demo implements the generate_series() function
5331
+** which gives similar results to the eponymous function in PostgreSQL.
5332
+** Examples:
5333
+**
5334
+** SELECT * FROM generate_series(0,100,5);
5335
+**
5336
+** The query above returns integers from 0 through 100 counting by steps
5337
+** of 5.
5338
+**
5339
+** SELECT * FROM generate_series(0,100);
5340
+**
5341
+** Integers from 0 through 100 with a step size of 1.
5342
+**
5343
+** SELECT * FROM generate_series(20) LIMIT 10;
5344
+**
5345
+** Integers 20 through 29.
5346
+**
5347
+** HOW IT WORKS
5348
+**
5349
+** The generate_series "function" is really a virtual table with the
5350
+** following schema:
5351
+**
5352
+** CREATE TABLE generate_series(
5353
+** value,
5354
+** start HIDDEN,
5355
+** stop HIDDEN,
5356
+** step HIDDEN
5357
+** );
5358
+**
5359
+** Function arguments in queries against this virtual table are translated
5360
+** into equality constraints against successive hidden columns. In other
5361
+** words, the following pairs of queries are equivalent to each other:
5362
+**
5363
+** SELECT * FROM generate_series(0,100,5);
5364
+** SELECT * FROM generate_series WHERE start=0 AND stop=100 AND step=5;
5365
+**
5366
+** SELECT * FROM generate_series(0,100);
5367
+** SELECT * FROM generate_series WHERE start=0 AND stop=100;
5368
+**
5369
+** SELECT * FROM generate_series(20) LIMIT 10;
5370
+** SELECT * FROM generate_series WHERE start=20 LIMIT 10;
5371
+**
5372
+** The generate_series virtual table implementation leaves the xCreate method
5373
+** set to NULL. This means that it is not possible to do a CREATE VIRTUAL
5374
+** TABLE command with "generate_series" as the USING argument. Instead, there
5375
+** is a single generate_series virtual table that is always available without
5376
+** having to be created first.
5377
+**
5378
+** The xBestIndex method looks for equality constraints against the hidden
5379
+** start, stop, and step columns, and if present, it uses those constraints
5380
+** to bound the sequence of generated values. If the equality constraints
5381
+** are missing, it uses 0 for start, 4294967295 for stop, and 1 for step.
5382
+** xBestIndex returns a small cost when both start and stop are available,
5383
+** and a very large cost if either start or stop are unavailable. This
5384
+** encourages the query planner to order joins such that the bounds of the
5385
+** series are well-defined.
5386
+*/
5387
+/* #include "sqlite3ext.h" */
5388
+SQLITE_EXTENSION_INIT1
5389
+#include <assert.h>
5390
+#include <string.h>
5391
+
5392
+#ifndef SQLITE_OMIT_VIRTUALTABLE
5393
+
5394
+
5395
+/* series_cursor is a subclass of sqlite3_vtab_cursor which will
5396
+** serve as the underlying representation of a cursor that scans
5397
+** over rows of the result
5398
+*/
5399
+typedef struct series_cursor series_cursor;
5400
+struct series_cursor {
5401
+ sqlite3_vtab_cursor base; /* Base class - must be first */
5402
+ int isDesc; /* True to count down rather than up */
5403
+ sqlite3_int64 iRowid; /* The rowid */
5404
+ sqlite3_int64 iValue; /* Current value ("value") */
5405
+ sqlite3_int64 mnValue; /* Mimimum value ("start") */
5406
+ sqlite3_int64 mxValue; /* Maximum value ("stop") */
5407
+ sqlite3_int64 iStep; /* Increment ("step") */
5408
+};
5409
+
5410
+/*
5411
+** The seriesConnect() method is invoked to create a new
5412
+** series_vtab that describes the generate_series virtual table.
5413
+**
5414
+** Think of this routine as the constructor for series_vtab objects.
5415
+**
5416
+** All this routine needs to do is:
5417
+**
5418
+** (1) Allocate the series_vtab object and initialize all fields.
5419
+**
5420
+** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
5421
+** result set of queries against generate_series will look like.
5422
+*/
5423
+static int seriesConnect(
5424
+ sqlite3 *db,
5425
+ void *pAux,
5426
+ int argc, const char *const*argv,
5427
+ sqlite3_vtab **ppVtab,
5428
+ char **pzErr
5429
+){
5430
+ sqlite3_vtab *pNew;
5431
+ int rc;
5432
+
5433
+/* Column numbers */
5434
+#define SERIES_COLUMN_VALUE 0
5435
+#define SERIES_COLUMN_START 1
5436
+#define SERIES_COLUMN_STOP 2
5437
+#define SERIES_COLUMN_STEP 3
5438
+
5439
+ rc = sqlite3_declare_vtab(db,
5440
+ "CREATE TABLE x(value,start hidden,stop hidden,step hidden)");
5441
+ if( rc==SQLITE_OK ){
5442
+ pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
5443
+ if( pNew==0 ) return SQLITE_NOMEM;
5444
+ memset(pNew, 0, sizeof(*pNew));
5445
+ sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
5446
+ }
5447
+ return rc;
5448
+}
5449
+
5450
+/*
5451
+** This method is the destructor for series_cursor objects.
5452
+*/
5453
+static int seriesDisconnect(sqlite3_vtab *pVtab){
5454
+ sqlite3_free(pVtab);
5455
+ return SQLITE_OK;
5456
+}
5457
+
5458
+/*
5459
+** Constructor for a new series_cursor object.
5460
+*/
5461
+static int seriesOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
5462
+ series_cursor *pCur;
5463
+ pCur = sqlite3_malloc( sizeof(*pCur) );
5464
+ if( pCur==0 ) return SQLITE_NOMEM;
5465
+ memset(pCur, 0, sizeof(*pCur));
5466
+ *ppCursor = &pCur->base;
5467
+ return SQLITE_OK;
5468
+}
5469
+
5470
+/*
5471
+** Destructor for a series_cursor.
5472
+*/
5473
+static int seriesClose(sqlite3_vtab_cursor *cur){
5474
+ sqlite3_free(cur);
5475
+ return SQLITE_OK;
5476
+}
5477
+
5478
+
5479
+/*
5480
+** Advance a series_cursor to its next row of output.
5481
+*/
5482
+static int seriesNext(sqlite3_vtab_cursor *cur){
5483
+ series_cursor *pCur = (series_cursor*)cur;
5484
+ if( pCur->isDesc ){
5485
+ pCur->iValue -= pCur->iStep;
5486
+ }else{
5487
+ pCur->iValue += pCur->iStep;
5488
+ }
5489
+ pCur->iRowid++;
5490
+ return SQLITE_OK;
5491
+}
5492
+
5493
+/*
5494
+** Return values of columns for the row at which the series_cursor
5495
+** is currently pointing.
5496
+*/
5497
+static int seriesColumn(
5498
+ sqlite3_vtab_cursor *cur, /* The cursor */
5499
+ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
5500
+ int i /* Which column to return */
5501
+){
5502
+ series_cursor *pCur = (series_cursor*)cur;
5503
+ sqlite3_int64 x = 0;
5504
+ switch( i ){
5505
+ case SERIES_COLUMN_START: x = pCur->mnValue; break;
5506
+ case SERIES_COLUMN_STOP: x = pCur->mxValue; break;
5507
+ case SERIES_COLUMN_STEP: x = pCur->iStep; break;
5508
+ default: x = pCur->iValue; break;
5509
+ }
5510
+ sqlite3_result_int64(ctx, x);
5511
+ return SQLITE_OK;
5512
+}
5513
+
5514
+/*
5515
+** Return the rowid for the current row. In this implementation, the
5516
+** first row returned is assigned rowid value 1, and each subsequent
5517
+** row a value 1 more than that of the previous.
5518
+*/
5519
+static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
5520
+ series_cursor *pCur = (series_cursor*)cur;
5521
+ *pRowid = pCur->iRowid;
5522
+ return SQLITE_OK;
5523
+}
5524
+
5525
+/*
5526
+** Return TRUE if the cursor has been moved off of the last
5527
+** row of output.
5528
+*/
5529
+static int seriesEof(sqlite3_vtab_cursor *cur){
5530
+ series_cursor *pCur = (series_cursor*)cur;
5531
+ if( pCur->isDesc ){
5532
+ return pCur->iValue < pCur->mnValue;
5533
+ }else{
5534
+ return pCur->iValue > pCur->mxValue;
5535
+ }
5536
+}
5537
+
5538
+/* True to cause run-time checking of the start=, stop=, and/or step=
5539
+** parameters. The only reason to do this is for testing the
5540
+** constraint checking logic for virtual tables in the SQLite core.
5541
+*/
5542
+#ifndef SQLITE_SERIES_CONSTRAINT_VERIFY
5543
+# define SQLITE_SERIES_CONSTRAINT_VERIFY 0
5544
+#endif
5545
+
5546
+/*
5547
+** This method is called to "rewind" the series_cursor object back
5548
+** to the first row of output. This method is always called at least
5549
+** once prior to any call to seriesColumn() or seriesRowid() or
5550
+** seriesEof().
5551
+**
5552
+** The query plan selected by seriesBestIndex is passed in the idxNum
5553
+** parameter. (idxStr is not used in this implementation.) idxNum
5554
+** is a bitmask showing which constraints are available:
5555
+**
5556
+** 1: start=VALUE
5557
+** 2: stop=VALUE
5558
+** 4: step=VALUE
5559
+**
5560
+** Also, if bit 8 is set, that means that the series should be output
5561
+** in descending order rather than in ascending order.
5562
+**
5563
+** This routine should initialize the cursor and position it so that it
5564
+** is pointing at the first row, or pointing off the end of the table
5565
+** (so that seriesEof() will return true) if the table is empty.
5566
+*/
5567
+static int seriesFilter(
5568
+ sqlite3_vtab_cursor *pVtabCursor,
5569
+ int idxNum, const char *idxStr,
5570
+ int argc, sqlite3_value **argv
5571
+){
5572
+ series_cursor *pCur = (series_cursor *)pVtabCursor;
5573
+ int i = 0;
5574
+ if( idxNum & 1 ){
5575
+ pCur->mnValue = sqlite3_value_int64(argv[i++]);
5576
+ }else{
5577
+ pCur->mnValue = 0;
5578
+ }
5579
+ if( idxNum & 2 ){
5580
+ pCur->mxValue = sqlite3_value_int64(argv[i++]);
5581
+ }else{
5582
+ pCur->mxValue = 0xffffffff;
5583
+ }
5584
+ if( idxNum & 4 ){
5585
+ pCur->iStep = sqlite3_value_int64(argv[i++]);
5586
+ if( pCur->iStep<1 ) pCur->iStep = 1;
5587
+ }else{
5588
+ pCur->iStep = 1;
5589
+ }
5590
+ for(i=0; i<argc; i++){
5591
+ if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
5592
+ /* If any of the constraints have a NULL value, then return no rows.
5593
+ ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
5594
+ pCur->mnValue = 1;
5595
+ pCur->mxValue = 0;
5596
+ break;
5597
+ }
5598
+ }
5599
+ if( idxNum & 8 ){
5600
+ pCur->isDesc = 1;
5601
+ pCur->iValue = pCur->mxValue;
5602
+ if( pCur->iStep>0 ){
5603
+ pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
5604
+ }
5605
+ }else{
5606
+ pCur->isDesc = 0;
5607
+ pCur->iValue = pCur->mnValue;
5608
+ }
5609
+ pCur->iRowid = 1;
5610
+ return SQLITE_OK;
5611
+}
5612
+
5613
+/*
5614
+** SQLite will invoke this method one or more times while planning a query
5615
+** that uses the generate_series virtual table. This routine needs to create
5616
+** a query plan for each invocation and compute an estimated cost for that
5617
+** plan.
5618
+**
5619
+** In this implementation idxNum is used to represent the
5620
+** query plan. idxStr is unused.
5621
+**
5622
+** The query plan is represented by bits in idxNum:
5623
+**
5624
+** (1) start = $value -- constraint exists
5625
+** (2) stop = $value -- constraint exists
5626
+** (4) step = $value -- constraint exists
5627
+** (8) output in descending order
5628
+*/
5629
+static int seriesBestIndex(
5630
+ sqlite3_vtab *tab,
5631
+ sqlite3_index_info *pIdxInfo
5632
+){
5633
+ int i, j; /* Loop over constraints */
5634
+ int idxNum = 0; /* The query plan bitmask */
5635
+ int unusableMask = 0; /* Mask of unusable constraints */
5636
+ int nArg = 0; /* Number of arguments that seriesFilter() expects */
5637
+ int aIdx[3]; /* Constraints on start, stop, and step */
5638
+ const struct sqlite3_index_constraint *pConstraint;
5639
+
5640
+ /* This implementation assumes that the start, stop, and step columns
5641
+ ** are the last three columns in the virtual table. */
5642
+ assert( SERIES_COLUMN_STOP == SERIES_COLUMN_START+1 );
5643
+ assert( SERIES_COLUMN_STEP == SERIES_COLUMN_START+2 );
5644
+ aIdx[0] = aIdx[1] = aIdx[2] = -1;
5645
+ pConstraint = pIdxInfo->aConstraint;
5646
+ for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
5647
+ int iCol; /* 0 for start, 1 for stop, 2 for step */
5648
+ int iMask; /* bitmask for those column */
5649
+ if( pConstraint->iColumn<SERIES_COLUMN_START ) continue;
5650
+ iCol = pConstraint->iColumn - SERIES_COLUMN_START;
5651
+ assert( iCol>=0 && iCol<=2 );
5652
+ iMask = 1 << iCol;
5653
+ if( pConstraint->usable==0 ){
5654
+ unusableMask |= iMask;
5655
+ continue;
5656
+ }else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
5657
+ idxNum |= iMask;
5658
+ aIdx[iCol] = i;
5659
+ }
5660
+ }
5661
+ for(i=0; i<3; i++){
5662
+ if( (j = aIdx[i])>=0 ){
5663
+ pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg;
5664
+ pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY;
5665
+ }
5666
+ }
5667
+ if( (unusableMask & ~idxNum)!=0 ){
5668
+ /* The start, stop, and step columns are inputs. Therefore if there
5669
+ ** are unusable constraints on any of start, stop, or step then
5670
+ ** this plan is unusable */
5671
+ return SQLITE_CONSTRAINT;
5672
+ }
5673
+ if( (idxNum & 3)==3 ){
5674
+ /* Both start= and stop= boundaries are available. This is the
5675
+ ** the preferred case */
5676
+ pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
5677
+ pIdxInfo->estimatedRows = 1000;
5678
+ if( pIdxInfo->nOrderBy==1 ){
5679
+ if( pIdxInfo->aOrderBy[0].desc ) idxNum |= 8;
5680
+ pIdxInfo->orderByConsumed = 1;
5681
+ }
5682
+ }else{
5683
+ /* If either boundary is missing, we have to generate a huge span
5684
+ ** of numbers. Make this case very expensive so that the query
5685
+ ** planner will work hard to avoid it. */
5686
+ pIdxInfo->estimatedRows = 2147483647;
5687
+ }
5688
+ pIdxInfo->idxNum = idxNum;
5689
+ return SQLITE_OK;
5690
+}
5691
+
5692
+/*
5693
+** This following structure defines all the methods for the
5694
+** generate_series virtual table.
5695
+*/
5696
+static sqlite3_module seriesModule = {
5697
+ 0, /* iVersion */
5698
+ 0, /* xCreate */
5699
+ seriesConnect, /* xConnect */
5700
+ seriesBestIndex, /* xBestIndex */
5701
+ seriesDisconnect, /* xDisconnect */
5702
+ 0, /* xDestroy */
5703
+ seriesOpen, /* xOpen - open a cursor */
5704
+ seriesClose, /* xClose - close a cursor */
5705
+ seriesFilter, /* xFilter - configure scan constraints */
5706
+ seriesNext, /* xNext - advance a cursor */
5707
+ seriesEof, /* xEof - check for end of scan */
5708
+ seriesColumn, /* xColumn - read data */
5709
+ seriesRowid, /* xRowid - read data */
5710
+ 0, /* xUpdate */
5711
+ 0, /* xBegin */
5712
+ 0, /* xSync */
5713
+ 0, /* xCommit */
5714
+ 0, /* xRollback */
5715
+ 0, /* xFindMethod */
5716
+ 0, /* xRename */
5717
+};
5718
+
5719
+#endif /* SQLITE_OMIT_VIRTUALTABLE */
5720
+
5721
+#ifdef _WIN32
5722
+
5723
+#endif
5724
+int sqlite3_series_init(
5725
+ sqlite3 *db,
5726
+ char **pzErrMsg,
5727
+ const sqlite3_api_routines *pApi
5728
+){
5729
+ int rc = SQLITE_OK;
5730
+ SQLITE_EXTENSION_INIT2(pApi);
5731
+#ifndef SQLITE_OMIT_VIRTUALTABLE
5732
+ if( sqlite3_libversion_number()<3008012 ){
5733
+ *pzErrMsg = sqlite3_mprintf(
5734
+ "generate_series() requires SQLite 3.8.12 or later");
5735
+ return SQLITE_ERROR;
5736
+ }
5737
+ rc = sqlite3_create_module(db, "generate_series", &seriesModule, 0);
5738
+#endif
5739
+ return rc;
5740
+}
5741
+
5742
+/************************* End ../ext/misc/series.c ********************/
53185743
#ifdef SQLITE_HAVE_ZLIB
53195744
/************************* Begin ../ext/misc/zipfile.c ******************/
53205745
/*
53215746
** 2017-12-26
53225747
**
@@ -5840,18 +6265,20 @@
58406265
static int zipfileAppendData(
58416266
ZipfileTab *pTab,
58426267
const u8 *aWrite,
58436268
int nWrite
58446269
){
5845
- size_t n;
5846
- fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
5847
- n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
5848
- if( (int)n!=nWrite ){
5849
- pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
5850
- return SQLITE_ERROR;
5851
- }
5852
- pTab->szCurrent += nWrite;
6270
+ if( nWrite>0 ){
6271
+ size_t n = nWrite;
6272
+ fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
6273
+ n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
6274
+ if( (int)n!=nWrite ){
6275
+ pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
6276
+ return SQLITE_ERROR;
6277
+ }
6278
+ pTab->szCurrent += nWrite;
6279
+ }
58536280
return SQLITE_OK;
58546281
}
58556282
58566283
/*
58576284
** Read and return a 16-bit little-endian unsigned integer from buffer aBuf.
@@ -14009,10 +14436,23 @@
1400914436
if( zName ){
1401014437
char *z = sqlite3_mprintf("\"%w\"", zName);
1401114438
sqlite3_result_text(context, z, -1, sqlite3_free);
1401214439
}
1401314440
}
14441
+
14442
+/*
14443
+** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
14444
+*/
14445
+static void shellUSleepFunc(
14446
+ sqlite3_context *context,
14447
+ int argc,
14448
+ sqlite3_value **argv
14449
+){
14450
+ int sleep = sqlite3_value_int(argv[0]);
14451
+ sqlite3_sleep(sleep/1000);
14452
+ sqlite3_result_int(context, sleep);
14453
+}
1401414454
1401514455
/*
1401614456
** Scalar function "shell_escape_crnl" used by the .recover command.
1401714457
** The argument passed to this function is the output of built-in
1401814458
** function quote(). If the first character of the input is "'",
@@ -14174,10 +14614,11 @@
1417414614
sqlite3_shathree_init(p->db, 0, 0);
1417514615
sqlite3_completion_init(p->db, 0, 0);
1417614616
sqlite3_uint_init(p->db, 0, 0);
1417714617
sqlite3_decimal_init(p->db, 0, 0);
1417814618
sqlite3_ieee_init(p->db, 0, 0);
14619
+ sqlite3_series_init(p->db, 0, 0);
1417914620
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1418014621
sqlite3_dbdata_init(p->db, 0, 0);
1418114622
#endif
1418214623
#ifdef SQLITE_HAVE_ZLIB
1418314624
sqlite3_zipfile_init(p->db, 0, 0);
@@ -14193,10 +14634,12 @@
1419314634
shellEscapeCrnl, 0, 0);
1419414635
sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
1419514636
shellInt32, 0, 0);
1419614637
sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
1419714638
shellIdQuote, 0, 0);
14639
+ sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
14640
+ shellUSleepFunc, 0, 0);
1419814641
#ifndef SQLITE_NOHAVE_SYSTEM
1419914642
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
1420014643
editFunc, 0, 0);
1420114644
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1420214645
editFunc, 0, 0);
@@ -17167,25 +17610,45 @@
1716717610
rc = 1;
1716817611
}
1716917612
}else
1717017613
1717117614
if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
17172
- ShellState data;
17173
- char *zErrMsg = 0;
17615
+ char **azName = 0;
17616
+ int nName = 0;
17617
+ sqlite3_stmt *pStmt;
17618
+ int i;
1717417619
open_db(p, 0);
17175
- memcpy(&data, p, sizeof(data));
17176
- data.showHeader = 0;
17177
- data.cMode = data.mode = MODE_List;
17178
- sqlite3_snprintf(sizeof(data.colSeparator),data.colSeparator,": ");
17179
- data.cnt = 0;
17180
- sqlite3_exec(p->db, "SELECT name, file FROM pragma_database_list",
17181
- callback, &data, &zErrMsg);
17182
- if( zErrMsg ){
17183
- utf8_printf(stderr,"Error: %s\n", zErrMsg);
17184
- sqlite3_free(zErrMsg);
17620
+ rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
17621
+ if( rc ){
17622
+ utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
1718517623
rc = 1;
17624
+ }else{
17625
+ while( sqlite3_step(pStmt)==SQLITE_ROW ){
17626
+ const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
17627
+ const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
17628
+ azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*));
17629
+ if( azName==0 ){ shell_out_of_memory(); /* Does not return */ }
17630
+ azName[nName*2] = strdup(zSchema);
17631
+ azName[nName*2+1] = strdup(zFile);
17632
+ nName++;
17633
+ }
1718617634
}
17635
+ sqlite3_finalize(pStmt);
17636
+ for(i=0; i<nName; i++){
17637
+ int eTxn = sqlite3_txn_state(p->db, azName[i*2]);
17638
+ int bRdonly = sqlite3_db_readonly(p->db, azName[i*2]);
17639
+ const char *z = azName[i*2+1];
17640
+ utf8_printf(p->out, "%s: %s %s%s\n",
17641
+ azName[i*2],
17642
+ z && z[0] ? z : "\"\"",
17643
+ bRdonly ? "r/o" : "r/w",
17644
+ eTxn==SQLITE_TXN_NONE ? "" :
17645
+ eTxn==SQLITE_TXN_READ ? " read-txn" : " write-txn");
17646
+ free(azName[i*2]);
17647
+ free(azName[i*2+1]);
17648
+ }
17649
+ sqlite3_free(azName);
1718717650
}else
1718817651
1718917652
if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){
1719017653
static const struct DbConfigChoices {
1719117654
const char *zName;
@@ -19435,10 +19898,11 @@
1943519898
#endif
1943619899
{ "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
1943719900
{ "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
1943819901
{ "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
1943919902
{ "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
19903
+ { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
1944019904
};
1944119905
int testctrl = -1;
1944219906
int iCtrl = -1;
1944319907
int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
1944419908
int isOk = 0;
@@ -19497,11 +19961,10 @@
1949719961
break;
1949819962
1949919963
/* sqlite3_test_control(int) */
1950019964
case SQLITE_TESTCTRL_PRNG_SAVE:
1950119965
case SQLITE_TESTCTRL_PRNG_RESTORE:
19502
- case SQLITE_TESTCTRL_PRNG_RESET:
1950319966
case SQLITE_TESTCTRL_BYTEORDER:
1950419967
if( nArg==2 ){
1950519968
rc2 = sqlite3_test_control(testctrl);
1950619969
isOk = testctrl==SQLITE_TESTCTRL_BYTEORDER ? 1 : 3;
1950719970
}
@@ -19570,10 +20033,18 @@
1957020033
integerValue(azArg[3]),
1957120034
integerValue(azArg[4]));
1957220035
isOk = 3;
1957320036
}
1957420037
break;
20038
+
20039
+ case SQLITE_TESTCTRL_SEEK_COUNT: {
20040
+ u64 x = 0;
20041
+ rc2 = sqlite3_test_control(testctrl, p->db, &x);
20042
+ utf8_printf(p->out, "%llu\n", x);
20043
+ isOk = 3;
20044
+ break;
20045
+ }
1957520046
1957620047
#ifdef YYCOVERAGE
1957720048
case SQLITE_TESTCTRL_PARSER_COVERAGE:
1957820049
if( nArg==2 ){
1957920050
sqlite3_test_control(testctrl, p->out);
1958020051
--- src/shell.c
+++ src/shell.c
@@ -569,12 +569,10 @@
569 */
570 static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
571 int i;
572 int n;
573 int aw = w<0 ? -w : w;
574 char zBuf[1000];
575 if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3;
576 for(i=n=0; zUtf[i]; i++){
577 if( (zUtf[i]&0xc0)!=0x80 ){
578 n++;
579 if( n==aw ){
580 do{ i++; }while( (zUtf[i]&0xc0)==0x80 );
@@ -5313,10 +5311,437 @@
5313 }
5314 return rc;
5315 }
5316
5317 /************************* End ../ext/misc/ieee754.c ********************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5318 #ifdef SQLITE_HAVE_ZLIB
5319 /************************* Begin ../ext/misc/zipfile.c ******************/
5320 /*
5321 ** 2017-12-26
5322 **
@@ -5840,18 +6265,20 @@
5840 static int zipfileAppendData(
5841 ZipfileTab *pTab,
5842 const u8 *aWrite,
5843 int nWrite
5844 ){
5845 size_t n;
5846 fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
5847 n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
5848 if( (int)n!=nWrite ){
5849 pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
5850 return SQLITE_ERROR;
5851 }
5852 pTab->szCurrent += nWrite;
 
 
5853 return SQLITE_OK;
5854 }
5855
5856 /*
5857 ** Read and return a 16-bit little-endian unsigned integer from buffer aBuf.
@@ -14009,10 +14436,23 @@
14009 if( zName ){
14010 char *z = sqlite3_mprintf("\"%w\"", zName);
14011 sqlite3_result_text(context, z, -1, sqlite3_free);
14012 }
14013 }
 
 
 
 
 
 
 
 
 
 
 
 
 
14014
14015 /*
14016 ** Scalar function "shell_escape_crnl" used by the .recover command.
14017 ** The argument passed to this function is the output of built-in
14018 ** function quote(). If the first character of the input is "'",
@@ -14174,10 +14614,11 @@
14174 sqlite3_shathree_init(p->db, 0, 0);
14175 sqlite3_completion_init(p->db, 0, 0);
14176 sqlite3_uint_init(p->db, 0, 0);
14177 sqlite3_decimal_init(p->db, 0, 0);
14178 sqlite3_ieee_init(p->db, 0, 0);
 
14179 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
14180 sqlite3_dbdata_init(p->db, 0, 0);
14181 #endif
14182 #ifdef SQLITE_HAVE_ZLIB
14183 sqlite3_zipfile_init(p->db, 0, 0);
@@ -14193,10 +14634,12 @@
14193 shellEscapeCrnl, 0, 0);
14194 sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
14195 shellInt32, 0, 0);
14196 sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
14197 shellIdQuote, 0, 0);
 
 
14198 #ifndef SQLITE_NOHAVE_SYSTEM
14199 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
14200 editFunc, 0, 0);
14201 sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
14202 editFunc, 0, 0);
@@ -17167,25 +17610,45 @@
17167 rc = 1;
17168 }
17169 }else
17170
17171 if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
17172 ShellState data;
17173 char *zErrMsg = 0;
 
 
17174 open_db(p, 0);
17175 memcpy(&data, p, sizeof(data));
17176 data.showHeader = 0;
17177 data.cMode = data.mode = MODE_List;
17178 sqlite3_snprintf(sizeof(data.colSeparator),data.colSeparator,": ");
17179 data.cnt = 0;
17180 sqlite3_exec(p->db, "SELECT name, file FROM pragma_database_list",
17181 callback, &data, &zErrMsg);
17182 if( zErrMsg ){
17183 utf8_printf(stderr,"Error: %s\n", zErrMsg);
17184 sqlite3_free(zErrMsg);
17185 rc = 1;
 
 
 
 
 
 
 
 
 
 
17186 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17187 }else
17188
17189 if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){
17190 static const struct DbConfigChoices {
17191 const char *zName;
@@ -19435,10 +19898,11 @@
19435 #endif
19436 { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
19437 { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
19438 { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
19439 { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
 
19440 };
19441 int testctrl = -1;
19442 int iCtrl = -1;
19443 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
19444 int isOk = 0;
@@ -19497,11 +19961,10 @@
19497 break;
19498
19499 /* sqlite3_test_control(int) */
19500 case SQLITE_TESTCTRL_PRNG_SAVE:
19501 case SQLITE_TESTCTRL_PRNG_RESTORE:
19502 case SQLITE_TESTCTRL_PRNG_RESET:
19503 case SQLITE_TESTCTRL_BYTEORDER:
19504 if( nArg==2 ){
19505 rc2 = sqlite3_test_control(testctrl);
19506 isOk = testctrl==SQLITE_TESTCTRL_BYTEORDER ? 1 : 3;
19507 }
@@ -19570,10 +20033,18 @@
19570 integerValue(azArg[3]),
19571 integerValue(azArg[4]));
19572 isOk = 3;
19573 }
19574 break;
 
 
 
 
 
 
 
 
19575
19576 #ifdef YYCOVERAGE
19577 case SQLITE_TESTCTRL_PARSER_COVERAGE:
19578 if( nArg==2 ){
19579 sqlite3_test_control(testctrl, p->out);
19580
--- src/shell.c
+++ src/shell.c
@@ -569,12 +569,10 @@
569 */
570 static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
571 int i;
572 int n;
573 int aw = w<0 ? -w : w;
 
 
574 for(i=n=0; zUtf[i]; i++){
575 if( (zUtf[i]&0xc0)!=0x80 ){
576 n++;
577 if( n==aw ){
578 do{ i++; }while( (zUtf[i]&0xc0)==0x80 );
@@ -5313,10 +5311,437 @@
5311 }
5312 return rc;
5313 }
5314
5315 /************************* End ../ext/misc/ieee754.c ********************/
5316 /************************* Begin ../ext/misc/series.c ******************/
5317 /*
5318 ** 2015-08-18
5319 **
5320 ** The author disclaims copyright to this source code. In place of
5321 ** a legal notice, here is a blessing:
5322 **
5323 ** May you do good and not evil.
5324 ** May you find forgiveness for yourself and forgive others.
5325 ** May you share freely, never taking more than you give.
5326 **
5327 *************************************************************************
5328 **
5329 ** This file demonstrates how to create a table-valued-function using
5330 ** a virtual table. This demo implements the generate_series() function
5331 ** which gives similar results to the eponymous function in PostgreSQL.
5332 ** Examples:
5333 **
5334 ** SELECT * FROM generate_series(0,100,5);
5335 **
5336 ** The query above returns integers from 0 through 100 counting by steps
5337 ** of 5.
5338 **
5339 ** SELECT * FROM generate_series(0,100);
5340 **
5341 ** Integers from 0 through 100 with a step size of 1.
5342 **
5343 ** SELECT * FROM generate_series(20) LIMIT 10;
5344 **
5345 ** Integers 20 through 29.
5346 **
5347 ** HOW IT WORKS
5348 **
5349 ** The generate_series "function" is really a virtual table with the
5350 ** following schema:
5351 **
5352 ** CREATE TABLE generate_series(
5353 ** value,
5354 ** start HIDDEN,
5355 ** stop HIDDEN,
5356 ** step HIDDEN
5357 ** );
5358 **
5359 ** Function arguments in queries against this virtual table are translated
5360 ** into equality constraints against successive hidden columns. In other
5361 ** words, the following pairs of queries are equivalent to each other:
5362 **
5363 ** SELECT * FROM generate_series(0,100,5);
5364 ** SELECT * FROM generate_series WHERE start=0 AND stop=100 AND step=5;
5365 **
5366 ** SELECT * FROM generate_series(0,100);
5367 ** SELECT * FROM generate_series WHERE start=0 AND stop=100;
5368 **
5369 ** SELECT * FROM generate_series(20) LIMIT 10;
5370 ** SELECT * FROM generate_series WHERE start=20 LIMIT 10;
5371 **
5372 ** The generate_series virtual table implementation leaves the xCreate method
5373 ** set to NULL. This means that it is not possible to do a CREATE VIRTUAL
5374 ** TABLE command with "generate_series" as the USING argument. Instead, there
5375 ** is a single generate_series virtual table that is always available without
5376 ** having to be created first.
5377 **
5378 ** The xBestIndex method looks for equality constraints against the hidden
5379 ** start, stop, and step columns, and if present, it uses those constraints
5380 ** to bound the sequence of generated values. If the equality constraints
5381 ** are missing, it uses 0 for start, 4294967295 for stop, and 1 for step.
5382 ** xBestIndex returns a small cost when both start and stop are available,
5383 ** and a very large cost if either start or stop are unavailable. This
5384 ** encourages the query planner to order joins such that the bounds of the
5385 ** series are well-defined.
5386 */
5387 /* #include "sqlite3ext.h" */
5388 SQLITE_EXTENSION_INIT1
5389 #include <assert.h>
5390 #include <string.h>
5391
5392 #ifndef SQLITE_OMIT_VIRTUALTABLE
5393
5394
5395 /* series_cursor is a subclass of sqlite3_vtab_cursor which will
5396 ** serve as the underlying representation of a cursor that scans
5397 ** over rows of the result
5398 */
5399 typedef struct series_cursor series_cursor;
5400 struct series_cursor {
5401 sqlite3_vtab_cursor base; /* Base class - must be first */
5402 int isDesc; /* True to count down rather than up */
5403 sqlite3_int64 iRowid; /* The rowid */
5404 sqlite3_int64 iValue; /* Current value ("value") */
5405 sqlite3_int64 mnValue; /* Mimimum value ("start") */
5406 sqlite3_int64 mxValue; /* Maximum value ("stop") */
5407 sqlite3_int64 iStep; /* Increment ("step") */
5408 };
5409
5410 /*
5411 ** The seriesConnect() method is invoked to create a new
5412 ** series_vtab that describes the generate_series virtual table.
5413 **
5414 ** Think of this routine as the constructor for series_vtab objects.
5415 **
5416 ** All this routine needs to do is:
5417 **
5418 ** (1) Allocate the series_vtab object and initialize all fields.
5419 **
5420 ** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
5421 ** result set of queries against generate_series will look like.
5422 */
5423 static int seriesConnect(
5424 sqlite3 *db,
5425 void *pAux,
5426 int argc, const char *const*argv,
5427 sqlite3_vtab **ppVtab,
5428 char **pzErr
5429 ){
5430 sqlite3_vtab *pNew;
5431 int rc;
5432
5433 /* Column numbers */
5434 #define SERIES_COLUMN_VALUE 0
5435 #define SERIES_COLUMN_START 1
5436 #define SERIES_COLUMN_STOP 2
5437 #define SERIES_COLUMN_STEP 3
5438
5439 rc = sqlite3_declare_vtab(db,
5440 "CREATE TABLE x(value,start hidden,stop hidden,step hidden)");
5441 if( rc==SQLITE_OK ){
5442 pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
5443 if( pNew==0 ) return SQLITE_NOMEM;
5444 memset(pNew, 0, sizeof(*pNew));
5445 sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
5446 }
5447 return rc;
5448 }
5449
5450 /*
5451 ** This method is the destructor for series_cursor objects.
5452 */
5453 static int seriesDisconnect(sqlite3_vtab *pVtab){
5454 sqlite3_free(pVtab);
5455 return SQLITE_OK;
5456 }
5457
5458 /*
5459 ** Constructor for a new series_cursor object.
5460 */
5461 static int seriesOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
5462 series_cursor *pCur;
5463 pCur = sqlite3_malloc( sizeof(*pCur) );
5464 if( pCur==0 ) return SQLITE_NOMEM;
5465 memset(pCur, 0, sizeof(*pCur));
5466 *ppCursor = &pCur->base;
5467 return SQLITE_OK;
5468 }
5469
5470 /*
5471 ** Destructor for a series_cursor.
5472 */
5473 static int seriesClose(sqlite3_vtab_cursor *cur){
5474 sqlite3_free(cur);
5475 return SQLITE_OK;
5476 }
5477
5478
5479 /*
5480 ** Advance a series_cursor to its next row of output.
5481 */
5482 static int seriesNext(sqlite3_vtab_cursor *cur){
5483 series_cursor *pCur = (series_cursor*)cur;
5484 if( pCur->isDesc ){
5485 pCur->iValue -= pCur->iStep;
5486 }else{
5487 pCur->iValue += pCur->iStep;
5488 }
5489 pCur->iRowid++;
5490 return SQLITE_OK;
5491 }
5492
5493 /*
5494 ** Return values of columns for the row at which the series_cursor
5495 ** is currently pointing.
5496 */
5497 static int seriesColumn(
5498 sqlite3_vtab_cursor *cur, /* The cursor */
5499 sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
5500 int i /* Which column to return */
5501 ){
5502 series_cursor *pCur = (series_cursor*)cur;
5503 sqlite3_int64 x = 0;
5504 switch( i ){
5505 case SERIES_COLUMN_START: x = pCur->mnValue; break;
5506 case SERIES_COLUMN_STOP: x = pCur->mxValue; break;
5507 case SERIES_COLUMN_STEP: x = pCur->iStep; break;
5508 default: x = pCur->iValue; break;
5509 }
5510 sqlite3_result_int64(ctx, x);
5511 return SQLITE_OK;
5512 }
5513
5514 /*
5515 ** Return the rowid for the current row. In this implementation, the
5516 ** first row returned is assigned rowid value 1, and each subsequent
5517 ** row a value 1 more than that of the previous.
5518 */
5519 static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
5520 series_cursor *pCur = (series_cursor*)cur;
5521 *pRowid = pCur->iRowid;
5522 return SQLITE_OK;
5523 }
5524
5525 /*
5526 ** Return TRUE if the cursor has been moved off of the last
5527 ** row of output.
5528 */
5529 static int seriesEof(sqlite3_vtab_cursor *cur){
5530 series_cursor *pCur = (series_cursor*)cur;
5531 if( pCur->isDesc ){
5532 return pCur->iValue < pCur->mnValue;
5533 }else{
5534 return pCur->iValue > pCur->mxValue;
5535 }
5536 }
5537
5538 /* True to cause run-time checking of the start=, stop=, and/or step=
5539 ** parameters. The only reason to do this is for testing the
5540 ** constraint checking logic for virtual tables in the SQLite core.
5541 */
5542 #ifndef SQLITE_SERIES_CONSTRAINT_VERIFY
5543 # define SQLITE_SERIES_CONSTRAINT_VERIFY 0
5544 #endif
5545
5546 /*
5547 ** This method is called to "rewind" the series_cursor object back
5548 ** to the first row of output. This method is always called at least
5549 ** once prior to any call to seriesColumn() or seriesRowid() or
5550 ** seriesEof().
5551 **
5552 ** The query plan selected by seriesBestIndex is passed in the idxNum
5553 ** parameter. (idxStr is not used in this implementation.) idxNum
5554 ** is a bitmask showing which constraints are available:
5555 **
5556 ** 1: start=VALUE
5557 ** 2: stop=VALUE
5558 ** 4: step=VALUE
5559 **
5560 ** Also, if bit 8 is set, that means that the series should be output
5561 ** in descending order rather than in ascending order.
5562 **
5563 ** This routine should initialize the cursor and position it so that it
5564 ** is pointing at the first row, or pointing off the end of the table
5565 ** (so that seriesEof() will return true) if the table is empty.
5566 */
5567 static int seriesFilter(
5568 sqlite3_vtab_cursor *pVtabCursor,
5569 int idxNum, const char *idxStr,
5570 int argc, sqlite3_value **argv
5571 ){
5572 series_cursor *pCur = (series_cursor *)pVtabCursor;
5573 int i = 0;
5574 if( idxNum & 1 ){
5575 pCur->mnValue = sqlite3_value_int64(argv[i++]);
5576 }else{
5577 pCur->mnValue = 0;
5578 }
5579 if( idxNum & 2 ){
5580 pCur->mxValue = sqlite3_value_int64(argv[i++]);
5581 }else{
5582 pCur->mxValue = 0xffffffff;
5583 }
5584 if( idxNum & 4 ){
5585 pCur->iStep = sqlite3_value_int64(argv[i++]);
5586 if( pCur->iStep<1 ) pCur->iStep = 1;
5587 }else{
5588 pCur->iStep = 1;
5589 }
5590 for(i=0; i<argc; i++){
5591 if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
5592 /* If any of the constraints have a NULL value, then return no rows.
5593 ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
5594 pCur->mnValue = 1;
5595 pCur->mxValue = 0;
5596 break;
5597 }
5598 }
5599 if( idxNum & 8 ){
5600 pCur->isDesc = 1;
5601 pCur->iValue = pCur->mxValue;
5602 if( pCur->iStep>0 ){
5603 pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
5604 }
5605 }else{
5606 pCur->isDesc = 0;
5607 pCur->iValue = pCur->mnValue;
5608 }
5609 pCur->iRowid = 1;
5610 return SQLITE_OK;
5611 }
5612
5613 /*
5614 ** SQLite will invoke this method one or more times while planning a query
5615 ** that uses the generate_series virtual table. This routine needs to create
5616 ** a query plan for each invocation and compute an estimated cost for that
5617 ** plan.
5618 **
5619 ** In this implementation idxNum is used to represent the
5620 ** query plan. idxStr is unused.
5621 **
5622 ** The query plan is represented by bits in idxNum:
5623 **
5624 ** (1) start = $value -- constraint exists
5625 ** (2) stop = $value -- constraint exists
5626 ** (4) step = $value -- constraint exists
5627 ** (8) output in descending order
5628 */
5629 static int seriesBestIndex(
5630 sqlite3_vtab *tab,
5631 sqlite3_index_info *pIdxInfo
5632 ){
5633 int i, j; /* Loop over constraints */
5634 int idxNum = 0; /* The query plan bitmask */
5635 int unusableMask = 0; /* Mask of unusable constraints */
5636 int nArg = 0; /* Number of arguments that seriesFilter() expects */
5637 int aIdx[3]; /* Constraints on start, stop, and step */
5638 const struct sqlite3_index_constraint *pConstraint;
5639
5640 /* This implementation assumes that the start, stop, and step columns
5641 ** are the last three columns in the virtual table. */
5642 assert( SERIES_COLUMN_STOP == SERIES_COLUMN_START+1 );
5643 assert( SERIES_COLUMN_STEP == SERIES_COLUMN_START+2 );
5644 aIdx[0] = aIdx[1] = aIdx[2] = -1;
5645 pConstraint = pIdxInfo->aConstraint;
5646 for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
5647 int iCol; /* 0 for start, 1 for stop, 2 for step */
5648 int iMask; /* bitmask for those column */
5649 if( pConstraint->iColumn<SERIES_COLUMN_START ) continue;
5650 iCol = pConstraint->iColumn - SERIES_COLUMN_START;
5651 assert( iCol>=0 && iCol<=2 );
5652 iMask = 1 << iCol;
5653 if( pConstraint->usable==0 ){
5654 unusableMask |= iMask;
5655 continue;
5656 }else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
5657 idxNum |= iMask;
5658 aIdx[iCol] = i;
5659 }
5660 }
5661 for(i=0; i<3; i++){
5662 if( (j = aIdx[i])>=0 ){
5663 pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg;
5664 pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY;
5665 }
5666 }
5667 if( (unusableMask & ~idxNum)!=0 ){
5668 /* The start, stop, and step columns are inputs. Therefore if there
5669 ** are unusable constraints on any of start, stop, or step then
5670 ** this plan is unusable */
5671 return SQLITE_CONSTRAINT;
5672 }
5673 if( (idxNum & 3)==3 ){
5674 /* Both start= and stop= boundaries are available. This is the
5675 ** the preferred case */
5676 pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
5677 pIdxInfo->estimatedRows = 1000;
5678 if( pIdxInfo->nOrderBy==1 ){
5679 if( pIdxInfo->aOrderBy[0].desc ) idxNum |= 8;
5680 pIdxInfo->orderByConsumed = 1;
5681 }
5682 }else{
5683 /* If either boundary is missing, we have to generate a huge span
5684 ** of numbers. Make this case very expensive so that the query
5685 ** planner will work hard to avoid it. */
5686 pIdxInfo->estimatedRows = 2147483647;
5687 }
5688 pIdxInfo->idxNum = idxNum;
5689 return SQLITE_OK;
5690 }
5691
5692 /*
5693 ** This following structure defines all the methods for the
5694 ** generate_series virtual table.
5695 */
5696 static sqlite3_module seriesModule = {
5697 0, /* iVersion */
5698 0, /* xCreate */
5699 seriesConnect, /* xConnect */
5700 seriesBestIndex, /* xBestIndex */
5701 seriesDisconnect, /* xDisconnect */
5702 0, /* xDestroy */
5703 seriesOpen, /* xOpen - open a cursor */
5704 seriesClose, /* xClose - close a cursor */
5705 seriesFilter, /* xFilter - configure scan constraints */
5706 seriesNext, /* xNext - advance a cursor */
5707 seriesEof, /* xEof - check for end of scan */
5708 seriesColumn, /* xColumn - read data */
5709 seriesRowid, /* xRowid - read data */
5710 0, /* xUpdate */
5711 0, /* xBegin */
5712 0, /* xSync */
5713 0, /* xCommit */
5714 0, /* xRollback */
5715 0, /* xFindMethod */
5716 0, /* xRename */
5717 };
5718
5719 #endif /* SQLITE_OMIT_VIRTUALTABLE */
5720
5721 #ifdef _WIN32
5722
5723 #endif
5724 int sqlite3_series_init(
5725 sqlite3 *db,
5726 char **pzErrMsg,
5727 const sqlite3_api_routines *pApi
5728 ){
5729 int rc = SQLITE_OK;
5730 SQLITE_EXTENSION_INIT2(pApi);
5731 #ifndef SQLITE_OMIT_VIRTUALTABLE
5732 if( sqlite3_libversion_number()<3008012 ){
5733 *pzErrMsg = sqlite3_mprintf(
5734 "generate_series() requires SQLite 3.8.12 or later");
5735 return SQLITE_ERROR;
5736 }
5737 rc = sqlite3_create_module(db, "generate_series", &seriesModule, 0);
5738 #endif
5739 return rc;
5740 }
5741
5742 /************************* End ../ext/misc/series.c ********************/
5743 #ifdef SQLITE_HAVE_ZLIB
5744 /************************* Begin ../ext/misc/zipfile.c ******************/
5745 /*
5746 ** 2017-12-26
5747 **
@@ -5840,18 +6265,20 @@
6265 static int zipfileAppendData(
6266 ZipfileTab *pTab,
6267 const u8 *aWrite,
6268 int nWrite
6269 ){
6270 if( nWrite>0 ){
6271 size_t n = nWrite;
6272 fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
6273 n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
6274 if( (int)n!=nWrite ){
6275 pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
6276 return SQLITE_ERROR;
6277 }
6278 pTab->szCurrent += nWrite;
6279 }
6280 return SQLITE_OK;
6281 }
6282
6283 /*
6284 ** Read and return a 16-bit little-endian unsigned integer from buffer aBuf.
@@ -14009,10 +14436,23 @@
14436 if( zName ){
14437 char *z = sqlite3_mprintf("\"%w\"", zName);
14438 sqlite3_result_text(context, z, -1, sqlite3_free);
14439 }
14440 }
14441
14442 /*
14443 ** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
14444 */
14445 static void shellUSleepFunc(
14446 sqlite3_context *context,
14447 int argc,
14448 sqlite3_value **argv
14449 ){
14450 int sleep = sqlite3_value_int(argv[0]);
14451 sqlite3_sleep(sleep/1000);
14452 sqlite3_result_int(context, sleep);
14453 }
14454
14455 /*
14456 ** Scalar function "shell_escape_crnl" used by the .recover command.
14457 ** The argument passed to this function is the output of built-in
14458 ** function quote(). If the first character of the input is "'",
@@ -14174,10 +14614,11 @@
14614 sqlite3_shathree_init(p->db, 0, 0);
14615 sqlite3_completion_init(p->db, 0, 0);
14616 sqlite3_uint_init(p->db, 0, 0);
14617 sqlite3_decimal_init(p->db, 0, 0);
14618 sqlite3_ieee_init(p->db, 0, 0);
14619 sqlite3_series_init(p->db, 0, 0);
14620 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
14621 sqlite3_dbdata_init(p->db, 0, 0);
14622 #endif
14623 #ifdef SQLITE_HAVE_ZLIB
14624 sqlite3_zipfile_init(p->db, 0, 0);
@@ -14193,10 +14634,12 @@
14634 shellEscapeCrnl, 0, 0);
14635 sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
14636 shellInt32, 0, 0);
14637 sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
14638 shellIdQuote, 0, 0);
14639 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
14640 shellUSleepFunc, 0, 0);
14641 #ifndef SQLITE_NOHAVE_SYSTEM
14642 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
14643 editFunc, 0, 0);
14644 sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
14645 editFunc, 0, 0);
@@ -17167,25 +17610,45 @@
17610 rc = 1;
17611 }
17612 }else
17613
17614 if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
17615 char **azName = 0;
17616 int nName = 0;
17617 sqlite3_stmt *pStmt;
17618 int i;
17619 open_db(p, 0);
17620 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
17621 if( rc ){
17622 utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
 
 
 
 
 
 
 
17623 rc = 1;
17624 }else{
17625 while( sqlite3_step(pStmt)==SQLITE_ROW ){
17626 const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
17627 const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
17628 azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*));
17629 if( azName==0 ){ shell_out_of_memory(); /* Does not return */ }
17630 azName[nName*2] = strdup(zSchema);
17631 azName[nName*2+1] = strdup(zFile);
17632 nName++;
17633 }
17634 }
17635 sqlite3_finalize(pStmt);
17636 for(i=0; i<nName; i++){
17637 int eTxn = sqlite3_txn_state(p->db, azName[i*2]);
17638 int bRdonly = sqlite3_db_readonly(p->db, azName[i*2]);
17639 const char *z = azName[i*2+1];
17640 utf8_printf(p->out, "%s: %s %s%s\n",
17641 azName[i*2],
17642 z && z[0] ? z : "\"\"",
17643 bRdonly ? "r/o" : "r/w",
17644 eTxn==SQLITE_TXN_NONE ? "" :
17645 eTxn==SQLITE_TXN_READ ? " read-txn" : " write-txn");
17646 free(azName[i*2]);
17647 free(azName[i*2+1]);
17648 }
17649 sqlite3_free(azName);
17650 }else
17651
17652 if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){
17653 static const struct DbConfigChoices {
17654 const char *zName;
@@ -19435,10 +19898,11 @@
19898 #endif
19899 { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " },
19900 { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
19901 { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
19902 { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
19903 { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
19904 };
19905 int testctrl = -1;
19906 int iCtrl = -1;
19907 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
19908 int isOk = 0;
@@ -19497,11 +19961,10 @@
19961 break;
19962
19963 /* sqlite3_test_control(int) */
19964 case SQLITE_TESTCTRL_PRNG_SAVE:
19965 case SQLITE_TESTCTRL_PRNG_RESTORE:
 
19966 case SQLITE_TESTCTRL_BYTEORDER:
19967 if( nArg==2 ){
19968 rc2 = sqlite3_test_control(testctrl);
19969 isOk = testctrl==SQLITE_TESTCTRL_BYTEORDER ? 1 : 3;
19970 }
@@ -19570,10 +20033,18 @@
20033 integerValue(azArg[3]),
20034 integerValue(azArg[4]));
20035 isOk = 3;
20036 }
20037 break;
20038
20039 case SQLITE_TESTCTRL_SEEK_COUNT: {
20040 u64 x = 0;
20041 rc2 = sqlite3_test_control(testctrl, p->db, &x);
20042 utf8_printf(p->out, "%llu\n", x);
20043 isOk = 3;
20044 break;
20045 }
20046
20047 #ifdef YYCOVERAGE
20048 case SQLITE_TESTCTRL_PARSER_COVERAGE:
20049 if( nArg==2 ){
20050 sqlite3_test_control(testctrl, p->out);
20051
+483 -162
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1171,11 +1171,11 @@
11711171
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11721172
** [sqlite_version()] and [sqlite_source_id()].
11731173
*/
11741174
#define SQLITE_VERSION "3.34.0"
11751175
#define SQLITE_VERSION_NUMBER 3034000
1176
-#define SQLITE_SOURCE_ID "2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492"
1176
+#define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be"
11771177
11781178
/*
11791179
** CAPI3REF: Run-Time Library Version Numbers
11801180
** KEYWORDS: sqlite3_version sqlite3_sourceid
11811181
**
@@ -7245,11 +7245,11 @@
72457245
** <ol>
72467246
** <li value="0"> SQLITE_TXN_NONE
72477247
** <li value="1"> SQLITE_TXN_READ
72487248
** <li value="2"> SQLITE_TXN_WRITE
72497249
** </ol>
7250
-** ^If the S argument to sqlite3_txn_state(D,S) is in the name of
7250
+** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
72517251
** a valid schema, then -1 is returned.
72527252
*/
72537253
SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
72547254
72557255
/*
@@ -8785,10 +8785,11 @@
87858785
*/
87868786
#define SQLITE_TESTCTRL_FIRST 5
87878787
#define SQLITE_TESTCTRL_PRNG_SAVE 5
87888788
#define SQLITE_TESTCTRL_PRNG_RESTORE 6
87898789
#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
8790
+#define SQLITE_TESTCTRL_SEEK_COUNT 7
87908791
#define SQLITE_TESTCTRL_BITVEC_TEST 8
87918792
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
87928793
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
87938794
#define SQLITE_TESTCTRL_PENDING_BYTE 11
87948795
#define SQLITE_TESTCTRL_ASSERT 12
@@ -15374,10 +15375,16 @@
1537415375
SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);
1537515376
SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
1537615377
SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);
1537715378
SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt);
1537815379
SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void);
15380
+
15381
+#ifdef SQLITE_DEBUG
15382
+SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree*);
15383
+#else
15384
+# define sqlite3BtreeSeekCount(X) 0
15385
+#endif
1537915386
1538015387
#ifndef NDEBUG
1538115388
SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);
1538215389
#endif
1538315390
SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*);
@@ -15728,11 +15735,11 @@
1572815735
#define OP_SequenceTest 113 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
1572915736
#define OP_OpenPseudo 114 /* synopsis: P3 columns in r[P2] */
1573015737
#define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */
1573115738
#define OP_Close 116
1573215739
#define OP_ColumnsUsed 117
15733
-#define OP_SeekHit 118 /* synopsis: seekHit=P2 */
15740
+#define OP_SeekHit 118 /* synopsis: set P2<=seekHit<=P3 */
1573415741
#define OP_Sequence 119 /* synopsis: r[P2]=cursor[P1].ctr++ */
1573515742
#define OP_NewRowid 120 /* synopsis: r[P2]=rowid */
1573615743
#define OP_Insert 121 /* synopsis: intkey=r[P3] data=r[P2] */
1573715744
#define OP_Delete 122
1573815745
#define OP_ResetCount 123
@@ -19594,11 +19601,11 @@
1959419601
# define sqlite3ColumnPropertiesFromName(T,C) /* no-op */
1959519602
#endif
1959619603
SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*,Token*);
1959719604
SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);
1959819605
SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
19599
-SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*);
19606
+SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*, const char*, const char*);
1960019607
SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*);
1960119608
SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
1960219609
SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*);
1960319610
SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
1960419611
SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
@@ -20842,11 +20849,11 @@
2084220849
u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */
2084320850
#endif
2084420851
Bool isEphemeral:1; /* True for an ephemeral table */
2084520852
Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
2084620853
Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
20847
- Bool seekHit:1; /* See the OP_SeekHit and OP_IfNoHope opcodes */
20854
+ u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
2084820855
Btree *pBtx; /* Separate file holding temporary table */
2084920856
i64 seqCount; /* Sequence counter */
2085020857
u32 *aAltMap; /* Mapping from table to index column numbers */
2085120858
2085220859
/* Cached OP_Column parse information is only valid if cacheStatus matches
@@ -28614,15 +28621,14 @@
2861428621
}
2861528622
}else{
2861628623
v = va_arg(ap,int);
2861728624
}
2861828625
if( v<0 ){
28619
- if( v==SMALLEST_INT64 ){
28620
- longvalue = ((u64)1)<<63;
28621
- }else{
28622
- longvalue = -v;
28623
- }
28626
+ testcase( v==SMALLEST_INT64 );
28627
+ testcase( v==(-1) );
28628
+ longvalue = ~v;
28629
+ longvalue++;
2862428630
prefix = '-';
2862528631
}else{
2862628632
longvalue = v;
2862728633
prefix = flag_prefix;
2862828634
}
@@ -31914,10 +31920,11 @@
3191431920
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
3191531921
if( enc==SQLITE_UTF8 ){
3191631922
incr = 1;
3191731923
}else{
3191831924
incr = 2;
31925
+ length &= ~1;
3191931926
assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
3192031927
for(i=3-enc; i<length && zNum[i]==0; i+=2){}
3192131928
nonNum = i<length;
3192231929
zEnd = &zNum[i^1];
3192331930
zNum += (enc&1);
@@ -33330,11 +33337,11 @@
3333033337
/* 113 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
3333133338
/* 114 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
3333233339
/* 115 */ "String8" OpHelp("r[P2]='P4'"),
3333333340
/* 116 */ "Close" OpHelp(""),
3333433341
/* 117 */ "ColumnsUsed" OpHelp(""),
33335
- /* 118 */ "SeekHit" OpHelp("seekHit=P2"),
33342
+ /* 118 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
3333633343
/* 119 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
3333733344
/* 120 */ "NewRowid" OpHelp("r[P2]=rowid"),
3333833345
/* 121 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
3333933346
/* 122 */ "Delete" OpHelp(""),
3334033347
/* 123 */ "ResetCount" OpHelp(""),
@@ -35140,10 +35147,13 @@
3514035147
3514135148
*pResOut = reserved;
3514235149
return rc;
3514335150
}
3514435151
35152
+/* Forward declaration*/
35153
+static int unixSleep(sqlite3_vfs*,int);
35154
+
3514535155
/*
3514635156
** Set a posix-advisory-lock.
3514735157
**
3514835158
** There are two versions of this routine. If compiled with
3514935159
** SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter
@@ -35169,11 +35179,11 @@
3516935179
/* On systems that support some kind of blocking file lock with a timeout,
3517035180
** make appropriate changes here to invoke that blocking file lock. On
3517135181
** generic posix, however, there is no such API. So we simply try the
3517235182
** lock once every millisecond until either the timeout expires, or until
3517335183
** the lock is obtained. */
35174
- usleep(1000);
35184
+ unixSleep(0,1000);
3517535185
rc = osFcntl(h,F_SETLK,pLock);
3517635186
tm--;
3517735187
}
3517835188
return rc;
3517935189
}
@@ -35740,10 +35750,11 @@
3574035750
*/
3574135751
setPendingFd(pFile);
3574235752
}
3574335753
sqlite3_mutex_leave(pInode->pLockMutex);
3574435754
releaseInodeInfo(pFile);
35755
+ assert( pFile->pShm==0 );
3574535756
rc = closeUnixFile(id);
3574635757
unixLeaveMutex();
3574735758
return rc;
3574835759
}
3574935760
@@ -37850,10 +37861,11 @@
3785037861
u8 isReadonly; /* True if read-only */
3785137862
u8 isUnlocked; /* True if no DMS lock held */
3785237863
char **apRegion; /* Array of mapped shared-memory regions */
3785337864
int nRef; /* Number of unixShm objects pointing to this */
3785437865
unixShm *pFirst; /* All unixShm objects pointing to this */
37866
+ int aLock[SQLITE_SHM_NLOCK]; /* # shared locks on slot, -1==excl lock */
3785537867
#ifdef SQLITE_DEBUG
3785637868
u8 exclMask; /* Mask of exclusive locks held */
3785737869
u8 sharedMask; /* Mask of shared locks held */
3785837870
u8 nextShmId; /* Next available unixShm.id value */
3785937871
#endif
@@ -38390,10 +38402,42 @@
3839038402
if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
3839138403
sqlite3_mutex_leave(pShmNode->pShmMutex);
3839238404
return rc;
3839338405
}
3839438406
38407
+/*
38408
+** Check that the pShmNode->aLock[] array comports with the locking bitmasks
38409
+** held by each client. Return true if it does, or false otherwise. This
38410
+** is to be used in an assert(). e.g.
38411
+**
38412
+** assert( assertLockingArrayOk(pShmNode) );
38413
+*/
38414
+#ifdef SQLITE_DEBUG
38415
+static int assertLockingArrayOk(unixShmNode *pShmNode){
38416
+ unixShm *pX;
38417
+ int aLock[SQLITE_SHM_NLOCK];
38418
+ assert( sqlite3_mutex_held(pShmNode->pShmMutex) );
38419
+
38420
+ memset(aLock, 0, sizeof(aLock));
38421
+ for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38422
+ int i;
38423
+ for(i=0; i<SQLITE_SHM_NLOCK; i++){
38424
+ if( pX->exclMask & (1<<i) ){
38425
+ assert( aLock[i]==0 );
38426
+ aLock[i] = -1;
38427
+ }else if( pX->sharedMask & (1<<i) ){
38428
+ assert( aLock[i]>=0 );
38429
+ aLock[i]++;
38430
+ }
38431
+ }
38432
+ }
38433
+
38434
+ assert( 0==memcmp(pShmNode->aLock, aLock, sizeof(aLock)) );
38435
+ return (memcmp(pShmNode->aLock, aLock, sizeof(aLock))==0);
38436
+}
38437
+#endif
38438
+
3839538439
/*
3839638440
** Change the lock state for a shared-memory segment.
3839738441
**
3839838442
** Note that the relationship between SHAREd and EXCLUSIVE locks is a little
3839938443
** different here than in posix. In xShmLock(), one can go from unlocked
@@ -38406,14 +38450,14 @@
3840638450
int n, /* Number of locks to acquire or release */
3840738451
int flags /* What to do with the lock */
3840838452
){
3840938453
unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */
3841038454
unixShm *p = pDbFd->pShm; /* The shared memory being locked */
38411
- unixShm *pX; /* For looping over all siblings */
3841238455
unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */
3841338456
int rc = SQLITE_OK; /* Result code */
3841438457
u16 mask; /* Mask of locks to take or release */
38458
+ int *aLock = pShmNode->aLock;
3841538459
3841638460
assert( pShmNode==pDbFd->pInode->pShmNode );
3841738461
assert( pShmNode->pInode==pDbFd->pInode );
3841838462
assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );
3841938463
assert( n>=1 );
@@ -38448,82 +38492,80 @@
3844838492
#endif
3844938493
3845038494
mask = (1<<(ofst+n)) - (1<<ofst);
3845138495
assert( n>1 || mask==(1<<ofst) );
3845238496
sqlite3_mutex_enter(pShmNode->pShmMutex);
38453
- if( flags & SQLITE_SHM_UNLOCK ){
38454
- u16 allMask = 0; /* Mask of locks held by siblings */
38455
-
38456
- /* See if any siblings hold this same lock */
38457
- for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38458
- if( pX==p ) continue;
38459
- assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );
38460
- allMask |= pX->sharedMask;
38461
- }
38462
-
38463
- /* Unlock the system-level locks */
38464
- if( (mask & allMask)==0 ){
38465
- rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n);
38466
- }else{
38467
- rc = SQLITE_OK;
38468
- }
38469
-
38470
- /* Undo the local locks */
38471
- if( rc==SQLITE_OK ){
38472
- p->exclMask &= ~mask;
38473
- p->sharedMask &= ~mask;
38474
- }
38475
- }else if( flags & SQLITE_SHM_SHARED ){
38476
- u16 allShared = 0; /* Union of locks held by connections other than "p" */
38477
-
38478
- /* Find out which shared locks are already held by sibling connections.
38479
- ** If any sibling already holds an exclusive lock, go ahead and return
38480
- ** SQLITE_BUSY.
38481
- */
38482
- for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38483
- if( (pX->exclMask & mask)!=0 ){
38484
- rc = SQLITE_BUSY;
38485
- break;
38486
- }
38487
- allShared |= pX->sharedMask;
38488
- }
38489
-
38490
- /* Get shared locks at the system level, if necessary */
38491
- if( rc==SQLITE_OK ){
38492
- if( (allShared & mask)==0 ){
38493
- rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);
38494
- }else{
38495
- rc = SQLITE_OK;
38496
- }
38497
- }
38498
-
38499
- /* Get the local shared locks */
38500
- if( rc==SQLITE_OK ){
38501
- p->sharedMask |= mask;
38502
- }
38503
- }else{
38504
- /* Make sure no sibling connections hold locks that will block this
38505
- ** lock. If any do, return SQLITE_BUSY right away.
38506
- */
38507
- for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38508
- if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){
38509
- rc = SQLITE_BUSY;
38510
- break;
38511
- }
38512
- }
38513
-
38514
- /* Get the exclusive locks at the system level. Then if successful
38515
- ** also mark the local connection as being locked.
38516
- */
38517
- if( rc==SQLITE_OK ){
38518
- rc = unixShmSystemLock(pDbFd, F_WRLCK, ofst+UNIX_SHM_BASE, n);
38519
- if( rc==SQLITE_OK ){
38520
- assert( (p->sharedMask & mask)==0 );
38521
- p->exclMask |= mask;
38522
- }
38523
- }
38524
- }
38497
+ assert( assertLockingArrayOk(pShmNode) );
38498
+ if( flags & SQLITE_SHM_UNLOCK ){
38499
+ if( (p->exclMask|p->sharedMask) & mask ){
38500
+ int ii;
38501
+ int bUnlock = 1;
38502
+
38503
+ for(ii=ofst; ii<ofst+n; ii++){
38504
+ if( aLock[ii]>((p->sharedMask & (1<<ii)) ? 1 : 0) ){
38505
+ bUnlock = 0;
38506
+ }
38507
+ }
38508
+
38509
+ if( bUnlock ){
38510
+ rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n);
38511
+ if( rc==SQLITE_OK ){
38512
+ memset(&aLock[ofst], 0, sizeof(int)*n);
38513
+ }
38514
+ }else if( p->sharedMask & (1<<ofst) ){
38515
+ assert( n==1 && aLock[ofst]>1 );
38516
+ aLock[ofst]--;
38517
+ }
38518
+
38519
+ /* Undo the local locks */
38520
+ if( rc==SQLITE_OK ){
38521
+ p->exclMask &= ~mask;
38522
+ p->sharedMask &= ~mask;
38523
+ }
38524
+ }
38525
+ }else if( flags & SQLITE_SHM_SHARED ){
38526
+ assert( n==1 );
38527
+ assert( (p->exclMask & (1<<ofst))==0 );
38528
+ if( (p->sharedMask & mask)==0 ){
38529
+ if( aLock[ofst]<0 ){
38530
+ rc = SQLITE_BUSY;
38531
+ }else if( aLock[ofst]==0 ){
38532
+ rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);
38533
+ }
38534
+
38535
+ /* Get the local shared locks */
38536
+ if( rc==SQLITE_OK ){
38537
+ p->sharedMask |= mask;
38538
+ aLock[ofst]++;
38539
+ }
38540
+ }
38541
+ }else{
38542
+ /* Make sure no sibling connections hold locks that will block this
38543
+ ** lock. If any do, return SQLITE_BUSY right away. */
38544
+ int ii;
38545
+ for(ii=ofst; ii<ofst+n; ii++){
38546
+ assert( (p->sharedMask & mask)==0 );
38547
+ if( (p->exclMask & (1<<ii))==0 && aLock[ii] ){
38548
+ rc = SQLITE_BUSY;
38549
+ break;
38550
+ }
38551
+ }
38552
+
38553
+ /* Get the exclusive locks at the system level. Then if successful
38554
+ ** also update the in-memory values. */
38555
+ if( rc==SQLITE_OK ){
38556
+ rc = unixShmSystemLock(pDbFd, F_WRLCK, ofst+UNIX_SHM_BASE, n);
38557
+ if( rc==SQLITE_OK ){
38558
+ assert( (p->sharedMask & mask)==0 );
38559
+ p->exclMask |= mask;
38560
+ for(ii=ofst; ii<ofst+n; ii++){
38561
+ aLock[ii] = -1;
38562
+ }
38563
+ }
38564
+ }
38565
+ }
38566
+ assert( assertLockingArrayOk(pShmNode) );
3852538567
sqlite3_mutex_leave(pShmNode->pShmMutex);
3852638568
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
3852738569
p->id, osGetpid(0), p->sharedMask, p->exclMask));
3852838570
return rc;
3852938571
}
@@ -40139,11 +40181,12 @@
4013940181
sp.tv_nsec = (microseconds % 1000000) * 1000;
4014040182
nanosleep(&sp, NULL);
4014140183
UNUSED_PARAMETER(NotUsed);
4014240184
return microseconds;
4014340185
#elif defined(HAVE_USLEEP) && HAVE_USLEEP
40144
- usleep(microseconds);
40186
+ if( microseconds>=1000000 ) sleep(microseconds/1000000);
40187
+ if( microseconds%1000000 ) usleep(microseconds%1000000);
4014540188
UNUSED_PARAMETER(NotUsed);
4014640189
return microseconds;
4014740190
#else
4014840191
int seconds = (microseconds+999999)/1000000;
4014940192
sleep(seconds);
@@ -40712,11 +40755,11 @@
4071240755
return SQLITE_IOERR_LOCK;
4071340756
}
4071440757
4071540758
if( nTries==1 ){
4071640759
conchModTime = buf.st_mtimespec;
40717
- usleep(500000); /* wait 0.5 sec and try the lock again*/
40760
+ unixSleep(0,500000); /* wait 0.5 sec and try the lock again*/
4071840761
continue;
4071940762
}
4072040763
4072140764
assert( nTries>1 );
4072240765
if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec ||
@@ -40738,11 +40781,11 @@
4073840781
}
4073940782
}else{
4074040783
/* don't break the lock on short read or a version mismatch */
4074140784
return SQLITE_BUSY;
4074240785
}
40743
- usleep(10000000); /* wait 10 sec and try the lock again */
40786
+ unixSleep(0,10000000); /* wait 10 sec and try the lock again */
4074440787
continue;
4074540788
}
4074640789
4074740790
assert( nTries==3 );
4074840791
if( 0==proxyBreakConchLock(pFile, myHostID) ){
@@ -63876,10 +63919,13 @@
6387663919
int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
6387763920
int nBackup; /* Number of backup operations reading this btree */
6387863921
u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */
6387963922
Btree *pNext; /* List of other sharable Btrees from the same db */
6388063923
Btree *pPrev; /* Back pointer of the same list */
63924
+#ifdef SQLITE_DEBUG
63925
+ u64 nSeek; /* Calls to sqlite3BtreeMovetoUnpacked() */
63926
+#endif
6388163927
#ifndef SQLITE_OMIT_SHARED_CACHE
6388263928
BtLock lock; /* Object used to lock page 1 */
6388363929
#endif
6388463930
};
6388563931
@@ -64656,10 +64702,21 @@
6465664702
#define clearAllSharedCacheTableLocks(a)
6465764703
#define downgradeAllSharedCacheTableLocks(a)
6465864704
#define hasSharedCacheTableLock(a,b,c,d) 1
6465964705
#define hasReadConflicts(a, b) 0
6466064706
#endif
64707
+
64708
+#ifdef SQLITE_DEBUG
64709
+/*
64710
+** Return an reset the seek counter for a Btree object.
64711
+*/
64712
+SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree *pBt){
64713
+ u64 n = pBt->nSeek;
64714
+ pBt->nSeek = 0;
64715
+ return n;
64716
+}
64717
+#endif
6466164718
6466264719
/*
6466364720
** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single
6466464721
** (MemPage*) as an argument. The (MemPage*) must not be NULL.
6466564722
**
@@ -67150,11 +67207,11 @@
6715067207
/* If the B-Tree was successfully opened, set the pager-cache size to the
6715167208
** default value. Except, when opening on an existing shared pager-cache,
6715267209
** do not change the pager-cache size.
6715367210
*/
6715467211
if( sqlite3BtreeSchema(p, 0, 0)==0 ){
67155
- sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE);
67212
+ sqlite3BtreeSetCacheSize(p, SQLITE_DEFAULT_CACHE_SIZE);
6715667213
}
6715767214
6715867215
pFile = sqlite3PagerFile(pBt->pPager);
6715967216
if( pFile->pMethods ){
6716067217
sqlite3OsFileControlHint(pFile, SQLITE_FCNTL_PDB, (void*)&pBt->db);
@@ -70003,10 +70060,14 @@
7000370060
return rc;
7000470061
}
7000570062
}
7000670063
}
7000770064
}
70065
+
70066
+#ifdef SQLITE_DEBUG
70067
+ pCur->pBtree->nSeek++; /* Performance measurement during testing */
70068
+#endif
7000870069
7000970070
if( pIdxKey ){
7001070071
xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
7001170072
pIdxKey->errCode = 0;
7001270073
assert( pIdxKey->default_rc==1
@@ -89767,26 +89828,35 @@
8976789828
pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */
8976889829
}
8976989830
break;
8977089831
}
8977189832
89772
-/* Opcode: SeekHit P1 P2 * * *
89773
-** Synopsis: seekHit=P2
89774
-**
89775
-** Set the seekHit flag on cursor P1 to the value in P2.
89776
-** The seekHit flag is used by the IfNoHope opcode.
89777
-**
89778
-** P1 must be a valid b-tree cursor. P2 must be a boolean value,
89779
-** either 0 or 1.
89833
+/* Opcode: SeekHit P1 P2 P3 * *
89834
+** Synopsis: set P2<=seekHit<=P3
89835
+**
89836
+** Increase or decrease the seekHit value for cursor P1, if necessary,
89837
+** so that it is no less than P2 and no greater than P3.
89838
+**
89839
+** The seekHit integer represents the maximum of terms in an index for which
89840
+** there is known to be at least one match. If the seekHit value is smaller
89841
+** than the total number of equality terms in an index lookup, then the
89842
+** OP_IfNoHope opcode might run to see if the IN loop can be abandoned
89843
+** early, thus saving work. This is part of the IN-early-out optimization.
89844
+**
89845
+** P1 must be a valid b-tree cursor.
8978089846
*/
8978189847
case OP_SeekHit: {
8978289848
VdbeCursor *pC;
8978389849
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
8978489850
pC = p->apCsr[pOp->p1];
8978589851
assert( pC!=0 );
89786
- assert( pOp->p2==0 || pOp->p2==1 );
89787
- pC->seekHit = pOp->p2 & 1;
89852
+ assert( pOp->p3>=pOp->p2 );
89853
+ if( pC->seekHit<pOp->p2 ){
89854
+ pC->seekHit = pOp->p2;
89855
+ }else if( pC->seekHit>pOp->p3 ){
89856
+ pC->seekHit = pOp->p3;
89857
+ }
8978889858
break;
8978989859
}
8979089860
8979189861
/* Opcode: IfNotOpen P1 P2 * * *
8979289862
** Synopsis: if( !csr[P1] ) goto P2
@@ -89840,20 +89910,24 @@
8984089910
*/
8984189911
/* Opcode: IfNoHope P1 P2 P3 P4 *
8984289912
** Synopsis: key=r[P3@P4]
8984389913
**
8984489914
** Register P3 is the first of P4 registers that form an unpacked
89845
-** record.
89846
-**
89847
-** Cursor P1 is on an index btree. If the seekHit flag is set on P1, then
89848
-** this opcode is a no-op. But if the seekHit flag of P1 is clear, then
89849
-** check to see if there is any entry in P1 that matches the
89850
-** prefix identified by P3 and P4. If no entry matches the prefix,
89851
-** jump to P2. Otherwise fall through.
89852
-**
89853
-** This opcode behaves like OP_NotFound if the seekHit
89854
-** flag is clear and it behaves like OP_Noop if the seekHit flag is set.
89915
+** record. Cursor P1 is an index btree. P2 is a jump destination.
89916
+** In other words, the operands to this opcode are the same as the
89917
+** operands to OP_NotFound and OP_IdxGT.
89918
+**
89919
+** This opcode is an optimization attempt only. If this opcode always
89920
+** falls through, the correct answer is still obtained, but extra works
89921
+** is performed.
89922
+**
89923
+** A value of N in the seekHit flag of cursor P1 means that there exists
89924
+** a key P3:N that will match some record in the index. We want to know
89925
+** if it is possible for a record P3:P4 to match some record in the
89926
+** index. If it is not possible, we can skips some work. So if seekHit
89927
+** is less than P4, attempt to find out if a match is possible by running
89928
+** OP_NotFound.
8985589929
**
8985689930
** This opcode is used in IN clause processing for a multi-column key.
8985789931
** If an IN clause is attached to an element of the key other than the
8985889932
** left-most element, and if there are no matches on the most recent
8985989933
** seek over the whole key, then it might be that one of the key element
@@ -89891,11 +89965,11 @@
8989189965
case OP_IfNoHope: { /* jump, in3 */
8989289966
VdbeCursor *pC;
8989389967
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
8989489968
pC = p->apCsr[pOp->p1];
8989589969
assert( pC!=0 );
89896
- if( pC->seekHit ) break;
89970
+ if( pC->seekHit>=pOp->p4.i ) break;
8989789971
/* Fall through into OP_NotFound */
8989889972
/* no break */ deliberate_fall_through
8989989973
}
8990089974
case OP_NoConflict: /* jump, in3 */
8990189975
case OP_NotFound: /* jump, in3 */
@@ -89973,10 +90047,11 @@
8997390047
VdbeBranchTaken(alreadyExists!=0,2);
8997490048
if( alreadyExists ) goto jump_to_p2;
8997590049
}else{
8997690050
VdbeBranchTaken(takeJump||alreadyExists==0,2);
8997790051
if( takeJump || !alreadyExists ) goto jump_to_p2;
90052
+ if( pOp->opcode==OP_IfNoHope ) pC->seekHit = pOp->p4.i;
8997890053
}
8997990054
break;
8998090055
}
8998190056
8998290057
/* Opcode: SeekRowid P1 P2 P3 * *
@@ -91205,11 +91280,11 @@
9120591280
if( rc ) goto abort_due_to_error;
9120691281
}
9120791282
break;
9120891283
}
9120991284
91210
-/* Opcode: IdxGE P1 P2 P3 P4 P5
91285
+/* Opcode: IdxGE P1 P2 P3 P4 *
9121191286
** Synopsis: key=r[P3@P4]
9121291287
**
9121391288
** The P4 register values beginning with P3 form an unpacked index
9121491289
** key that omits the PRIMARY KEY. Compare this key value against the index
9121591290
** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
@@ -91216,11 +91291,11 @@
9121691291
** fields at the end.
9121791292
**
9121891293
** If the P1 index entry is greater than or equal to the key value
9121991294
** then jump to P2. Otherwise fall through to the next instruction.
9122091295
*/
91221
-/* Opcode: IdxGT P1 P2 P3 P4 P5
91296
+/* Opcode: IdxGT P1 P2 P3 P4 *
9122291297
** Synopsis: key=r[P3@P4]
9122391298
**
9122491299
** The P4 register values beginning with P3 form an unpacked index
9122591300
** key that omits the PRIMARY KEY. Compare this key value against the index
9122691301
** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
@@ -91227,11 +91302,11 @@
9122791302
** fields at the end.
9122891303
**
9122991304
** If the P1 index entry is greater than the key value
9123091305
** then jump to P2. Otherwise fall through to the next instruction.
9123191306
*/
91232
-/* Opcode: IdxLT P1 P2 P3 P4 P5
91307
+/* Opcode: IdxLT P1 P2 P3 P4 *
9123391308
** Synopsis: key=r[P3@P4]
9123491309
**
9123591310
** The P4 register values beginning with P3 form an unpacked index
9123691311
** key that omits the PRIMARY KEY or ROWID. Compare this key value against
9123791312
** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
@@ -91238,11 +91313,11 @@
9123891313
** ROWID on the P1 index.
9123991314
**
9124091315
** If the P1 index entry is less than the key value then jump to P2.
9124191316
** Otherwise fall through to the next instruction.
9124291317
*/
91243
-/* Opcode: IdxLE P1 P2 P3 P4 P5
91318
+/* Opcode: IdxLE P1 P2 P3 P4 *
9124491319
** Synopsis: key=r[P3@P4]
9124591320
**
9124691321
** The P4 register values beginning with P3 form an unpacked index
9124791322
** key that omits the PRIMARY KEY or ROWID. Compare this key value against
9124891323
** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
@@ -91264,11 +91339,10 @@
9126491339
assert( pC!=0 );
9126591340
assert( pC->isOrdered );
9126691341
assert( pC->eCurType==CURTYPE_BTREE );
9126791342
assert( pC->uc.pCursor!=0);
9126891343
assert( pC->deferredMoveto==0 );
91269
- assert( pOp->p5==0 || pOp->p5==1 );
9127091344
assert( pOp->p4type==P4_INT32 );
9127191345
r.pKeyInfo = pC->pKeyInfo;
9127291346
r.nField = (u16)pOp->p4.i;
9127391347
if( pOp->opcode<OP_IdxLT ){
9127491348
assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxGT );
@@ -94911,17 +94985,20 @@
9491194985
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
9491294986
pCsr->uc.pSorter = pSorter;
9491394987
if( pSorter==0 ){
9491494988
rc = SQLITE_NOMEM_BKPT;
9491594989
}else{
94990
+ Btree *pBt = db->aDb[0].pBt;
9491694991
pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
9491794992
memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
9491894993
pKeyInfo->db = 0;
9491994994
if( nField && nWorker==0 ){
9492094995
pKeyInfo->nKeyField = nField;
9492194996
}
94922
- pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
94997
+ sqlite3BtreeEnter(pBt);
94998
+ pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(pBt);
94999
+ sqlite3BtreeLeave(pBt);
9492395000
pSorter->nTask = nWorker + 1;
9492495001
pSorter->iPrev = (u8)(nWorker - 1);
9492595002
pSorter->bUseThreads = (pSorter->nTask>1);
9492695003
pSorter->db = db;
9492795004
for(i=0; i<pSorter->nTask; i++){
@@ -112071,12 +112148,14 @@
112071112148
112072112149
/*
112073112150
** Add a new CHECK constraint to the table currently under construction.
112074112151
*/
112075112152
SQLITE_PRIVATE void sqlite3AddCheckConstraint(
112076
- Parse *pParse, /* Parsing context */
112077
- Expr *pCheckExpr /* The check expression */
112153
+ Parse *pParse, /* Parsing context */
112154
+ Expr *pCheckExpr, /* The check expression */
112155
+ const char *zStart, /* Opening "(" */
112156
+ const char *zEnd /* Closing ")" */
112078112157
){
112079112158
#ifndef SQLITE_OMIT_CHECK
112080112159
Table *pTab = pParse->pNewTable;
112081112160
sqlite3 *db = pParse->db;
112082112161
if( pTab && !IN_DECLARE_VTAB
@@ -112083,10 +112162,17 @@
112083112162
&& !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
112084112163
){
112085112164
pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
112086112165
if( pParse->constraintName.n ){
112087112166
sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
112167
+ }else{
112168
+ Token t;
112169
+ for(zStart++; sqlite3Isspace(zStart[0]); zStart++){}
112170
+ while( sqlite3Isspace(zEnd[-1]) ){ zEnd--; }
112171
+ t.z = zStart;
112172
+ t.n = (int)(zEnd - t.z);
112173
+ sqlite3ExprListSetName(pParse, pTab->pCheck, &t, 1);
112088112174
}
112089112175
}else
112090112176
#endif
112091112177
{
112092112178
sqlite3ExprDelete(pParse->db, pCheckExpr);
@@ -112336,16 +112422,19 @@
112336112422
static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
112337112423
char *zExtra;
112338112424
int nByte;
112339112425
if( pIdx->nColumn>=N ) return SQLITE_OK;
112340112426
assert( pIdx->isResized==0 );
112341
- nByte = (sizeof(char*) + sizeof(i16) + 1)*N;
112427
+ nByte = (sizeof(char*) + sizeof(LogEst) + sizeof(i16) + 1)*N;
112342112428
zExtra = sqlite3DbMallocZero(db, nByte);
112343112429
if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
112344112430
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
112345112431
pIdx->azColl = (const char**)zExtra;
112346112432
zExtra += sizeof(char*)*N;
112433
+ memcpy(zExtra, pIdx->aiRowLogEst, sizeof(LogEst)*(pIdx->nKeyCol+1));
112434
+ pIdx->aiRowLogEst = (LogEst*)zExtra;
112435
+ zExtra += sizeof(LogEst)*N;
112347112436
memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
112348112437
pIdx->aiColumn = (i16*)zExtra;
112349112438
zExtra += sizeof(i16)*N;
112350112439
memcpy(zExtra, pIdx->aSortOrder, pIdx->nColumn);
112351112440
pIdx->aSortOrder = (u8*)zExtra;
@@ -122299,11 +122388,11 @@
122299122388
sqlite3ExprDelete(db, pCopy);
122300122389
if( onError==OE_Ignore ){
122301122390
sqlite3VdbeGoto(v, ignoreDest);
122302122391
}else{
122303122392
char *zName = pCheck->a[i].zEName;
122304
- if( zName==0 ) zName = pTab->zName;
122393
+ assert( zName!=0 || pParse->db->mallocFailed );
122305122394
if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
122306122395
sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
122307122396
onError, zName, P4_TRANSIENT,
122308122397
P5_ConstraintCheck);
122309122398
}
@@ -129148,10 +129237,11 @@
129148129237
}while( rc==SQLITE_ERROR_RETRY
129149129238
|| (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
129150129239
sqlite3BtreeLeaveAll(db);
129151129240
rc = sqlite3ApiExit(db, rc);
129152129241
assert( (rc&db->errMask)==rc );
129242
+ db->busyHandler.nBusy = 0;
129153129243
sqlite3_mutex_leave(db->mutex);
129154129244
return rc;
129155129245
}
129156129246
129157129247
@@ -142156,10 +142246,13 @@
142156142246
142157142247
pLoop->wsFlags |= WHERE_IN_ABLE;
142158142248
if( pLevel->u.in.nIn==0 ){
142159142249
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
142160142250
}
142251
+ if( iEq>0 ){
142252
+ pLoop->wsFlags |= WHERE_IN_EARLYOUT;
142253
+ }
142161142254
142162142255
i = pLevel->u.in.nIn;
142163142256
pLevel->u.in.nIn += nEq;
142164142257
pLevel->u.in.aInLoop =
142165142258
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
@@ -142182,20 +142275,22 @@
142182142275
pIn->iCur = iTab;
142183142276
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
142184142277
if( iEq>0 ){
142185142278
pIn->iBase = iReg - i;
142186142279
pIn->nPrefix = i;
142187
- pLoop->wsFlags |= WHERE_IN_EARLYOUT;
142188142280
}else{
142189142281
pIn->nPrefix = 0;
142190142282
}
142191142283
}else{
142192142284
pIn->eEndLoopOp = OP_Noop;
142193142285
}
142194142286
pIn++;
142195142287
}
142196142288
}
142289
+ if( iEq>0 ){
142290
+ sqlite3VdbeAddOp3(v, OP_SeekHit, pLevel->iIdxCur, 0, iEq);
142291
+ }
142197142292
}else{
142198142293
pLevel->u.in.nIn = 0;
142199142294
}
142200142295
sqlite3DbFree(pParse->db, aiMap);
142201142296
#endif
@@ -143375,13 +143470,10 @@
143375143470
if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
143376143471
/* The skip-scan logic inside the call to codeAllEqualityConstraints()
143377143472
** above has already left the cursor sitting on the correct row,
143378143473
** so no further seeking is needed */
143379143474
}else{
143380
- if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
143381
- sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur);
143382
- }
143383143475
if( regBignull ){
143384143476
sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
143385143477
VdbeComment((v, "NULL-scan pass ctr"));
143386143478
}
143387143479
@@ -143488,11 +143580,11 @@
143488143580
testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
143489143581
testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
143490143582
}
143491143583
143492143584
if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
143493
- sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
143585
+ sqlite3VdbeAddOp3(v, OP_SeekHit, iIdxCur, nEq, nEq);
143494143586
}
143495143587
143496143588
/* Seek the table cursor, if required */
143497143589
omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0
143498143590
&& (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
@@ -154289,37 +154381,32 @@
154289154381
154290154382
#endif /* SQLITE_OMIT_WINDOWFUNC */
154291154383
154292154384
/************** End of window.c **********************************************/
154293154385
/************** Begin file parse.c *******************************************/
154386
+/* This file is automatically generated by Lemon from input grammar
154387
+** source file "parse.y". */
154294154388
/*
154295
-** 2000-05-29
154389
+** 2001-09-15
154296154390
**
154297154391
** The author disclaims copyright to this source code. In place of
154298154392
** a legal notice, here is a blessing:
154299154393
**
154300154394
** May you do good and not evil.
154301154395
** May you find forgiveness for yourself and forgive others.
154302154396
** May you share freely, never taking more than you give.
154303154397
**
154304154398
*************************************************************************
154305
-** Driver template for the LEMON parser generator.
154306
-**
154307
-** The "lemon" program processes an LALR(1) input grammar file, then uses
154308
-** this template to construct a parser. The "lemon" program inserts text
154309
-** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the
154310
-** interstitial "-" characters) contained in this template is changed into
154311
-** the value of the %name directive from the grammar. Otherwise, the content
154312
-** of this template is copied straight through into the generate parser
154313
-** source file.
154314
-**
154315
-** The following is the concatenation of all %include directives from the
154316
-** input grammar file:
154317
-*/
154318
-/* #include <stdio.h> */
154319
-/* #include <assert.h> */
154320
-/************ Begin %include sections from the grammar ************************/
154399
+** This file contains SQLite's SQL parser.
154400
+**
154401
+** The canonical source code to this file ("parse.y") is a Lemon grammar
154402
+** file that specifies the input grammar and actions to take while parsing.
154403
+** That input file is processed by Lemon to generate a C-language
154404
+** implementation of a parser for the given grammer. You might be reading
154405
+** this comment as part of the translated C-code. Edits should be made
154406
+** to the original parse.y sources.
154407
+*/
154321154408
154322154409
/* #include "sqliteInt.h" */
154323154410
154324154411
/*
154325154412
** Disable all error recovery processing in the parser push-down
@@ -154499,15 +154586,195 @@
154499154586
154500154587
#if TK_SPAN>255
154501154588
# error too many tokens in the grammar
154502154589
#endif
154503154590
/**************** End of %include directives **********************************/
154504
-/* These constants specify the various numeric values for terminal symbols
154505
-** in a format understandable to "makeheaders". This section is blank unless
154506
-** "lemon" is run with the "-m" command-line option.
154507
-***************** Begin makeheaders token definitions *************************/
154508
-/**************** End makeheaders token definitions ***************************/
154591
+/* These constants specify the various numeric values for terminal symbols.
154592
+***************** Begin token definitions *************************************/
154593
+#ifndef TK_SEMI
154594
+#define TK_SEMI 1
154595
+#define TK_EXPLAIN 2
154596
+#define TK_QUERY 3
154597
+#define TK_PLAN 4
154598
+#define TK_BEGIN 5
154599
+#define TK_TRANSACTION 6
154600
+#define TK_DEFERRED 7
154601
+#define TK_IMMEDIATE 8
154602
+#define TK_EXCLUSIVE 9
154603
+#define TK_COMMIT 10
154604
+#define TK_END 11
154605
+#define TK_ROLLBACK 12
154606
+#define TK_SAVEPOINT 13
154607
+#define TK_RELEASE 14
154608
+#define TK_TO 15
154609
+#define TK_TABLE 16
154610
+#define TK_CREATE 17
154611
+#define TK_IF 18
154612
+#define TK_NOT 19
154613
+#define TK_EXISTS 20
154614
+#define TK_TEMP 21
154615
+#define TK_LP 22
154616
+#define TK_RP 23
154617
+#define TK_AS 24
154618
+#define TK_WITHOUT 25
154619
+#define TK_COMMA 26
154620
+#define TK_ABORT 27
154621
+#define TK_ACTION 28
154622
+#define TK_AFTER 29
154623
+#define TK_ANALYZE 30
154624
+#define TK_ASC 31
154625
+#define TK_ATTACH 32
154626
+#define TK_BEFORE 33
154627
+#define TK_BY 34
154628
+#define TK_CASCADE 35
154629
+#define TK_CAST 36
154630
+#define TK_CONFLICT 37
154631
+#define TK_DATABASE 38
154632
+#define TK_DESC 39
154633
+#define TK_DETACH 40
154634
+#define TK_EACH 41
154635
+#define TK_FAIL 42
154636
+#define TK_OR 43
154637
+#define TK_AND 44
154638
+#define TK_IS 45
154639
+#define TK_MATCH 46
154640
+#define TK_LIKE_KW 47
154641
+#define TK_BETWEEN 48
154642
+#define TK_IN 49
154643
+#define TK_ISNULL 50
154644
+#define TK_NOTNULL 51
154645
+#define TK_NE 52
154646
+#define TK_EQ 53
154647
+#define TK_GT 54
154648
+#define TK_LE 55
154649
+#define TK_LT 56
154650
+#define TK_GE 57
154651
+#define TK_ESCAPE 58
154652
+#define TK_ID 59
154653
+#define TK_COLUMNKW 60
154654
+#define TK_DO 61
154655
+#define TK_FOR 62
154656
+#define TK_IGNORE 63
154657
+#define TK_INITIALLY 64
154658
+#define TK_INSTEAD 65
154659
+#define TK_NO 66
154660
+#define TK_KEY 67
154661
+#define TK_OF 68
154662
+#define TK_OFFSET 69
154663
+#define TK_PRAGMA 70
154664
+#define TK_RAISE 71
154665
+#define TK_RECURSIVE 72
154666
+#define TK_REPLACE 73
154667
+#define TK_RESTRICT 74
154668
+#define TK_ROW 75
154669
+#define TK_ROWS 76
154670
+#define TK_TRIGGER 77
154671
+#define TK_VACUUM 78
154672
+#define TK_VIEW 79
154673
+#define TK_VIRTUAL 80
154674
+#define TK_WITH 81
154675
+#define TK_NULLS 82
154676
+#define TK_FIRST 83
154677
+#define TK_LAST 84
154678
+#define TK_CURRENT 85
154679
+#define TK_FOLLOWING 86
154680
+#define TK_PARTITION 87
154681
+#define TK_PRECEDING 88
154682
+#define TK_RANGE 89
154683
+#define TK_UNBOUNDED 90
154684
+#define TK_EXCLUDE 91
154685
+#define TK_GROUPS 92
154686
+#define TK_OTHERS 93
154687
+#define TK_TIES 94
154688
+#define TK_GENERATED 95
154689
+#define TK_ALWAYS 96
154690
+#define TK_REINDEX 97
154691
+#define TK_RENAME 98
154692
+#define TK_CTIME_KW 99
154693
+#define TK_ANY 100
154694
+#define TK_BITAND 101
154695
+#define TK_BITOR 102
154696
+#define TK_LSHIFT 103
154697
+#define TK_RSHIFT 104
154698
+#define TK_PLUS 105
154699
+#define TK_MINUS 106
154700
+#define TK_STAR 107
154701
+#define TK_SLASH 108
154702
+#define TK_REM 109
154703
+#define TK_CONCAT 110
154704
+#define TK_COLLATE 111
154705
+#define TK_BITNOT 112
154706
+#define TK_ON 113
154707
+#define TK_INDEXED 114
154708
+#define TK_STRING 115
154709
+#define TK_JOIN_KW 116
154710
+#define TK_CONSTRAINT 117
154711
+#define TK_DEFAULT 118
154712
+#define TK_NULL 119
154713
+#define TK_PRIMARY 120
154714
+#define TK_UNIQUE 121
154715
+#define TK_CHECK 122
154716
+#define TK_REFERENCES 123
154717
+#define TK_AUTOINCR 124
154718
+#define TK_INSERT 125
154719
+#define TK_DELETE 126
154720
+#define TK_UPDATE 127
154721
+#define TK_SET 128
154722
+#define TK_DEFERRABLE 129
154723
+#define TK_FOREIGN 130
154724
+#define TK_DROP 131
154725
+#define TK_UNION 132
154726
+#define TK_ALL 133
154727
+#define TK_EXCEPT 134
154728
+#define TK_INTERSECT 135
154729
+#define TK_SELECT 136
154730
+#define TK_VALUES 137
154731
+#define TK_DISTINCT 138
154732
+#define TK_DOT 139
154733
+#define TK_FROM 140
154734
+#define TK_JOIN 141
154735
+#define TK_USING 142
154736
+#define TK_ORDER 143
154737
+#define TK_GROUP 144
154738
+#define TK_HAVING 145
154739
+#define TK_LIMIT 146
154740
+#define TK_WHERE 147
154741
+#define TK_INTO 148
154742
+#define TK_NOTHING 149
154743
+#define TK_FLOAT 150
154744
+#define TK_BLOB 151
154745
+#define TK_INTEGER 152
154746
+#define TK_VARIABLE 153
154747
+#define TK_CASE 154
154748
+#define TK_WHEN 155
154749
+#define TK_THEN 156
154750
+#define TK_ELSE 157
154751
+#define TK_INDEX 158
154752
+#define TK_ALTER 159
154753
+#define TK_ADD 160
154754
+#define TK_WINDOW 161
154755
+#define TK_OVER 162
154756
+#define TK_FILTER 163
154757
+#define TK_COLUMN 164
154758
+#define TK_AGG_FUNCTION 165
154759
+#define TK_AGG_COLUMN 166
154760
+#define TK_TRUEFALSE 167
154761
+#define TK_ISNOT 168
154762
+#define TK_FUNCTION 169
154763
+#define TK_UMINUS 170
154764
+#define TK_UPLUS 171
154765
+#define TK_TRUTH 172
154766
+#define TK_REGISTER 173
154767
+#define TK_VECTOR 174
154768
+#define TK_SELECT_COLUMN 175
154769
+#define TK_IF_NULL_ROW 176
154770
+#define TK_ASTERISK 177
154771
+#define TK_SPAN 178
154772
+#define TK_SPACE 179
154773
+#define TK_ILLEGAL 180
154774
+#endif
154775
+/**************** End token definitions ***************************************/
154509154776
154510154777
/* The next sections is a series of control #defines.
154511154778
** various aspects of the generated parser.
154512154779
** YYCODETYPE is the data type used to store the integer codes
154513154780
** that represent terminal and non-terminal symbols.
@@ -155509,10 +155776,11 @@
155509155776
};
155510155777
typedef struct yyParser yyParser;
155511155778
155512155779
#ifndef NDEBUG
155513155780
/* #include <stdio.h> */
155781
+/* #include <assert.h> */
155514155782
static FILE *yyTraceFILE = 0;
155515155783
static char *yyTracePrompt = 0;
155516155784
#endif /* NDEBUG */
155517155785
155518155786
#ifndef NDEBUG
@@ -157776,11 +158044,11 @@
157776158044
case 38: /* ccons ::= UNIQUE onconf */
157777158045
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0,
157778158046
SQLITE_IDXTYPE_UNIQUE);}
157779158047
break;
157780158048
case 39: /* ccons ::= CHECK LP expr RP */
157781
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202);}
158049
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
157782158050
break;
157783158051
case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
157784158052
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy242,yymsp[0].minor.yy192);}
157785158053
break;
157786158054
case 41: /* ccons ::= defer_subclause */
@@ -157855,11 +158123,11 @@
157855158123
case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
157856158124
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0,
157857158125
SQLITE_IDXTYPE_UNIQUE);}
157858158126
break;
157859158127
case 68: /* tcons ::= CHECK LP expr RP onconf */
157860
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202);}
158128
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
157861158129
break;
157862158130
case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
157863158131
{
157864158132
sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy192);
157865158133
sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy192);
@@ -164932,11 +165200,13 @@
164932165200
if( iNew>=0 && iNew<=255 ){
164933165201
sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
164934165202
}
164935165203
rc = SQLITE_OK;
164936165204
}else{
165205
+ int nSave = db->busyHandler.nBusy;
164937165206
rc = sqlite3OsFileControl(fd, op, pArg);
165207
+ db->busyHandler.nBusy = nSave;
164938165208
}
164939165209
sqlite3BtreeLeave(pBtree);
164940165210
}
164941165211
sqlite3_mutex_leave(db->mutex);
164942165212
return rc;
@@ -165315,10 +165585,29 @@
165315165585
case SQLITE_TESTCTRL_RESULT_INTREAL: {
165316165586
sqlite3_context *pCtx = va_arg(ap, sqlite3_context*);
165317165587
sqlite3ResultIntReal(pCtx);
165318165588
break;
165319165589
}
165590
+
165591
+ /* sqlite3_test_control(SQLITE_TESTCTRL_SEEK_COUNT,
165592
+ ** sqlite3 *db, // Database connection
165593
+ ** u64 *pnSeek // Write seek count here
165594
+ ** );
165595
+ **
165596
+ ** This test-control queries the seek-counter on the "main" database
165597
+ ** file. The seek-counter is written into *pnSeek and is then reset.
165598
+ ** The seek-count is only available if compiled with SQLITE_DEBUG.
165599
+ */
165600
+ case SQLITE_TESTCTRL_SEEK_COUNT: {
165601
+ sqlite3 *db = va_arg(ap, sqlite3*);
165602
+ u64 *pn = va_arg(ap, sqlite3_uint64*);
165603
+ *pn = sqlite3BtreeSeekCount(db->aDb->pBt);
165604
+ (void)db; /* Silence harmless unused variable warning */
165605
+ break;
165606
+ }
165607
+
165608
+
165320165609
}
165321165610
va_end(ap);
165322165611
#endif /* SQLITE_UNTESTABLE */
165323165612
return rc;
165324165613
}
@@ -209457,10 +209746,12 @@
209457209746
#define FTS5_CARET 12
209458209747
#define FTS5_COMMA 13
209459209748
#define FTS5_PLUS 14
209460209749
#define FTS5_STAR 15
209461209750
209751
+/* This file is automatically generated by Lemon from input grammar
209752
+** source file "fts5parse.y". */
209462209753
/*
209463209754
** 2000-05-29
209464209755
**
209465209756
** The author disclaims copyright to this source code. In place of
209466209757
** a legal notice, here is a blessing:
@@ -209481,12 +209772,10 @@
209481209772
** source file.
209482209773
**
209483209774
** The following is the concatenation of all %include directives from the
209484209775
** input grammar file:
209485209776
*/
209486
-/* #include <stdio.h> */
209487
-/* #include <assert.h> */
209488209777
/************ Begin %include sections from the grammar ************************/
209489209778
209490209779
/* #include "fts5Int.h" */
209491209780
/* #include "fts5parse.h" */
209492209781
@@ -209512,15 +209801,30 @@
209512209801
** into sqlite3ParserAlloc(). The default is size_t.
209513209802
*/
209514209803
#define fts5YYMALLOCARGTYPE u64
209515209804
209516209805
/**************** End of %include directives **********************************/
209517
-/* These constants specify the various numeric values for terminal symbols
209518
-** in a format understandable to "makeheaders". This section is blank unless
209519
-** "lemon" is run with the "-m" command-line option.
209520
-***************** Begin makeheaders token definitions *************************/
209521
-/**************** End makeheaders token definitions ***************************/
209806
+/* These constants specify the various numeric values for terminal symbols.
209807
+***************** Begin token definitions *************************************/
209808
+#ifndef FTS5_OR
209809
+#define FTS5_OR 1
209810
+#define FTS5_AND 2
209811
+#define FTS5_NOT 3
209812
+#define FTS5_TERM 4
209813
+#define FTS5_COLON 5
209814
+#define FTS5_MINUS 6
209815
+#define FTS5_LCP 7
209816
+#define FTS5_RCP 8
209817
+#define FTS5_STRING 9
209818
+#define FTS5_LP 10
209819
+#define FTS5_RP 11
209820
+#define FTS5_CARET 12
209821
+#define FTS5_COMMA 13
209822
+#define FTS5_PLUS 14
209823
+#define FTS5_STAR 15
209824
+#endif
209825
+/**************** End token definitions ***************************************/
209522209826
209523209827
/* The next sections is a series of control #defines.
209524209828
** various aspects of the generated parser.
209525209829
** fts5YYCODETYPE is the data type used to store the integer codes
209526209830
** that represent terminal and non-terminal symbols.
@@ -209799,10 +210103,11 @@
209799210103
};
209800210104
typedef struct fts5yyParser fts5yyParser;
209801210105
209802210106
#ifndef NDEBUG
209803210107
/* #include <stdio.h> */
210108
+/* #include <assert.h> */
209804210109
static FILE *fts5yyTraceFILE = 0;
209805210110
static char *fts5yyTracePrompt = 0;
209806210111
#endif /* NDEBUG */
209807210112
209808210113
#ifndef NDEBUG
@@ -215412,12 +215717,21 @@
215412215717
Fts5ExprNearset *pNear = pExpr->pNear;
215413215718
int i;
215414215719
int iTerm;
215415215720
215416215721
if( pNear->pColset ){
215417
- int iCol = pNear->pColset->aiCol[0];
215418
- zRet = fts5PrintfAppend(zRet, "%s : ", pConfig->azCol[iCol]);
215722
+ int ii;
215723
+ Fts5Colset *pColset = pNear->pColset;
215724
+ if( pColset->nCol>1 ) zRet = fts5PrintfAppend(zRet, "{");
215725
+ for(ii=0; ii<pColset->nCol; ii++){
215726
+ zRet = fts5PrintfAppend(zRet, "%s%s",
215727
+ pConfig->azCol[pColset->aiCol[ii]], ii==pColset->nCol-1 ? "" : " "
215728
+ );
215729
+ }
215730
+ if( zRet ){
215731
+ zRet = fts5PrintfAppend(zRet, "%s : ", pColset->nCol>1 ? "}" : "");
215732
+ }
215419215733
if( zRet==0 ) return 0;
215420215734
}
215421215735
215422215736
if( pNear->nPhrase>1 ){
215423215737
zRet = fts5PrintfAppend(zRet, "NEAR(");
@@ -225836,11 +226150,11 @@
225836226150
int nArg, /* Number of args */
225837226151
sqlite3_value **apUnused /* Function arguments */
225838226152
){
225839226153
assert( nArg==0 );
225840226154
UNUSED_PARAM2(nArg, apUnused);
225841
- sqlite3_result_text(pCtx, "fts5: 2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492", -1, SQLITE_TRANSIENT);
226155
+ sqlite3_result_text(pCtx, "fts5: 2020-09-11 15:01:49 b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38", -1, SQLITE_TRANSIENT);
225842226156
}
225843226157
225844226158
/*
225845226159
** Return true if zName is the extension on one of the shadow tables used
225846226160
** by this module.
@@ -226399,13 +226713,20 @@
226399226713
ctx.szCol = 0;
226400226714
rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT,
226401226715
zText, nText, (void*)&ctx, fts5StorageInsertCallback
226402226716
);
226403226717
p->aTotalSize[iCol-1] -= (i64)ctx.szCol;
226718
+ if( p->aTotalSize[iCol-1]<0 ){
226719
+ rc = FTS5_CORRUPT;
226720
+ }
226404226721
}
226405226722
}
226406
- p->nTotalRow--;
226723
+ if( rc==SQLITE_OK && p->nTotalRow<1 ){
226724
+ rc = FTS5_CORRUPT;
226725
+ }else{
226726
+ p->nTotalRow--;
226727
+ }
226407226728
226408226729
rc2 = sqlite3_reset(pSeek);
226409226730
if( rc==SQLITE_OK ) rc = rc2;
226410226731
return rc;
226411226732
}
@@ -230619,12 +230940,12 @@
230619230940
}
230620230941
#endif /* SQLITE_CORE */
230621230942
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
230622230943
230623230944
/************** End of stmt.c ************************************************/
230624
-#if __LINE__!=230624
230945
+#if __LINE__!=230945
230625230946
#undef SQLITE_SOURCE_ID
230626
-#define SQLITE_SOURCE_ID "2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36alt2"
230947
+#define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e245alt2"
230627230948
#endif
230628230949
/* Return the source-id for this library */
230629230950
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
230630230951
/************************** End of sqlite3.c ******************************/
230631230952
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1171,11 +1171,11 @@
1171 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1172 ** [sqlite_version()] and [sqlite_source_id()].
1173 */
1174 #define SQLITE_VERSION "3.34.0"
1175 #define SQLITE_VERSION_NUMBER 3034000
1176 #define SQLITE_SOURCE_ID "2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492"
1177
1178 /*
1179 ** CAPI3REF: Run-Time Library Version Numbers
1180 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1181 **
@@ -7245,11 +7245,11 @@
7245 ** <ol>
7246 ** <li value="0"> SQLITE_TXN_NONE
7247 ** <li value="1"> SQLITE_TXN_READ
7248 ** <li value="2"> SQLITE_TXN_WRITE
7249 ** </ol>
7250 ** ^If the S argument to sqlite3_txn_state(D,S) is in the name of
7251 ** a valid schema, then -1 is returned.
7252 */
7253 SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
7254
7255 /*
@@ -8785,10 +8785,11 @@
8785 */
8786 #define SQLITE_TESTCTRL_FIRST 5
8787 #define SQLITE_TESTCTRL_PRNG_SAVE 5
8788 #define SQLITE_TESTCTRL_PRNG_RESTORE 6
8789 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
 
8790 #define SQLITE_TESTCTRL_BITVEC_TEST 8
8791 #define SQLITE_TESTCTRL_FAULT_INSTALL 9
8792 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
8793 #define SQLITE_TESTCTRL_PENDING_BYTE 11
8794 #define SQLITE_TESTCTRL_ASSERT 12
@@ -15374,10 +15375,16 @@
15374 SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);
15375 SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
15376 SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);
15377 SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt);
15378 SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void);
 
 
 
 
 
 
15379
15380 #ifndef NDEBUG
15381 SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);
15382 #endif
15383 SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*);
@@ -15728,11 +15735,11 @@
15728 #define OP_SequenceTest 113 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15729 #define OP_OpenPseudo 114 /* synopsis: P3 columns in r[P2] */
15730 #define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */
15731 #define OP_Close 116
15732 #define OP_ColumnsUsed 117
15733 #define OP_SeekHit 118 /* synopsis: seekHit=P2 */
15734 #define OP_Sequence 119 /* synopsis: r[P2]=cursor[P1].ctr++ */
15735 #define OP_NewRowid 120 /* synopsis: r[P2]=rowid */
15736 #define OP_Insert 121 /* synopsis: intkey=r[P3] data=r[P2] */
15737 #define OP_Delete 122
15738 #define OP_ResetCount 123
@@ -19594,11 +19601,11 @@
19594 # define sqlite3ColumnPropertiesFromName(T,C) /* no-op */
19595 #endif
19596 SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*,Token*);
19597 SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);
19598 SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
19599 SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*);
19600 SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*);
19601 SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
19602 SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*);
19603 SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
19604 SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
@@ -20842,11 +20849,11 @@
20842 u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */
20843 #endif
20844 Bool isEphemeral:1; /* True for an ephemeral table */
20845 Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
20846 Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
20847 Bool seekHit:1; /* See the OP_SeekHit and OP_IfNoHope opcodes */
20848 Btree *pBtx; /* Separate file holding temporary table */
20849 i64 seqCount; /* Sequence counter */
20850 u32 *aAltMap; /* Mapping from table to index column numbers */
20851
20852 /* Cached OP_Column parse information is only valid if cacheStatus matches
@@ -28614,15 +28621,14 @@
28614 }
28615 }else{
28616 v = va_arg(ap,int);
28617 }
28618 if( v<0 ){
28619 if( v==SMALLEST_INT64 ){
28620 longvalue = ((u64)1)<<63;
28621 }else{
28622 longvalue = -v;
28623 }
28624 prefix = '-';
28625 }else{
28626 longvalue = v;
28627 prefix = flag_prefix;
28628 }
@@ -31914,10 +31920,11 @@
31914 assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
31915 if( enc==SQLITE_UTF8 ){
31916 incr = 1;
31917 }else{
31918 incr = 2;
 
31919 assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
31920 for(i=3-enc; i<length && zNum[i]==0; i+=2){}
31921 nonNum = i<length;
31922 zEnd = &zNum[i^1];
31923 zNum += (enc&1);
@@ -33330,11 +33337,11 @@
33330 /* 113 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
33331 /* 114 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
33332 /* 115 */ "String8" OpHelp("r[P2]='P4'"),
33333 /* 116 */ "Close" OpHelp(""),
33334 /* 117 */ "ColumnsUsed" OpHelp(""),
33335 /* 118 */ "SeekHit" OpHelp("seekHit=P2"),
33336 /* 119 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
33337 /* 120 */ "NewRowid" OpHelp("r[P2]=rowid"),
33338 /* 121 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
33339 /* 122 */ "Delete" OpHelp(""),
33340 /* 123 */ "ResetCount" OpHelp(""),
@@ -35140,10 +35147,13 @@
35140
35141 *pResOut = reserved;
35142 return rc;
35143 }
35144
 
 
 
35145 /*
35146 ** Set a posix-advisory-lock.
35147 **
35148 ** There are two versions of this routine. If compiled with
35149 ** SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter
@@ -35169,11 +35179,11 @@
35169 /* On systems that support some kind of blocking file lock with a timeout,
35170 ** make appropriate changes here to invoke that blocking file lock. On
35171 ** generic posix, however, there is no such API. So we simply try the
35172 ** lock once every millisecond until either the timeout expires, or until
35173 ** the lock is obtained. */
35174 usleep(1000);
35175 rc = osFcntl(h,F_SETLK,pLock);
35176 tm--;
35177 }
35178 return rc;
35179 }
@@ -35740,10 +35750,11 @@
35740 */
35741 setPendingFd(pFile);
35742 }
35743 sqlite3_mutex_leave(pInode->pLockMutex);
35744 releaseInodeInfo(pFile);
 
35745 rc = closeUnixFile(id);
35746 unixLeaveMutex();
35747 return rc;
35748 }
35749
@@ -37850,10 +37861,11 @@
37850 u8 isReadonly; /* True if read-only */
37851 u8 isUnlocked; /* True if no DMS lock held */
37852 char **apRegion; /* Array of mapped shared-memory regions */
37853 int nRef; /* Number of unixShm objects pointing to this */
37854 unixShm *pFirst; /* All unixShm objects pointing to this */
 
37855 #ifdef SQLITE_DEBUG
37856 u8 exclMask; /* Mask of exclusive locks held */
37857 u8 sharedMask; /* Mask of shared locks held */
37858 u8 nextShmId; /* Next available unixShm.id value */
37859 #endif
@@ -38390,10 +38402,42 @@
38390 if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
38391 sqlite3_mutex_leave(pShmNode->pShmMutex);
38392 return rc;
38393 }
38394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38395 /*
38396 ** Change the lock state for a shared-memory segment.
38397 **
38398 ** Note that the relationship between SHAREd and EXCLUSIVE locks is a little
38399 ** different here than in posix. In xShmLock(), one can go from unlocked
@@ -38406,14 +38450,14 @@
38406 int n, /* Number of locks to acquire or release */
38407 int flags /* What to do with the lock */
38408 ){
38409 unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */
38410 unixShm *p = pDbFd->pShm; /* The shared memory being locked */
38411 unixShm *pX; /* For looping over all siblings */
38412 unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */
38413 int rc = SQLITE_OK; /* Result code */
38414 u16 mask; /* Mask of locks to take or release */
 
38415
38416 assert( pShmNode==pDbFd->pInode->pShmNode );
38417 assert( pShmNode->pInode==pDbFd->pInode );
38418 assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );
38419 assert( n>=1 );
@@ -38448,82 +38492,80 @@
38448 #endif
38449
38450 mask = (1<<(ofst+n)) - (1<<ofst);
38451 assert( n>1 || mask==(1<<ofst) );
38452 sqlite3_mutex_enter(pShmNode->pShmMutex);
38453 if( flags & SQLITE_SHM_UNLOCK ){
38454 u16 allMask = 0; /* Mask of locks held by siblings */
38455
38456 /* See if any siblings hold this same lock */
38457 for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38458 if( pX==p ) continue;
38459 assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );
38460 allMask |= pX->sharedMask;
38461 }
38462
38463 /* Unlock the system-level locks */
38464 if( (mask & allMask)==0 ){
38465 rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n);
38466 }else{
38467 rc = SQLITE_OK;
38468 }
38469
38470 /* Undo the local locks */
38471 if( rc==SQLITE_OK ){
38472 p->exclMask &= ~mask;
38473 p->sharedMask &= ~mask;
38474 }
38475 }else if( flags & SQLITE_SHM_SHARED ){
38476 u16 allShared = 0; /* Union of locks held by connections other than "p" */
38477
38478 /* Find out which shared locks are already held by sibling connections.
38479 ** If any sibling already holds an exclusive lock, go ahead and return
38480 ** SQLITE_BUSY.
38481 */
38482 for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38483 if( (pX->exclMask & mask)!=0 ){
38484 rc = SQLITE_BUSY;
38485 break;
38486 }
38487 allShared |= pX->sharedMask;
38488 }
38489
38490 /* Get shared locks at the system level, if necessary */
38491 if( rc==SQLITE_OK ){
38492 if( (allShared & mask)==0 ){
38493 rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);
38494 }else{
38495 rc = SQLITE_OK;
38496 }
38497 }
38498
38499 /* Get the local shared locks */
38500 if( rc==SQLITE_OK ){
38501 p->sharedMask |= mask;
38502 }
38503 }else{
38504 /* Make sure no sibling connections hold locks that will block this
38505 ** lock. If any do, return SQLITE_BUSY right away.
38506 */
38507 for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38508 if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){
38509 rc = SQLITE_BUSY;
38510 break;
38511 }
38512 }
38513
38514 /* Get the exclusive locks at the system level. Then if successful
38515 ** also mark the local connection as being locked.
38516 */
38517 if( rc==SQLITE_OK ){
38518 rc = unixShmSystemLock(pDbFd, F_WRLCK, ofst+UNIX_SHM_BASE, n);
38519 if( rc==SQLITE_OK ){
38520 assert( (p->sharedMask & mask)==0 );
38521 p->exclMask |= mask;
38522 }
38523 }
38524 }
38525 sqlite3_mutex_leave(pShmNode->pShmMutex);
38526 OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
38527 p->id, osGetpid(0), p->sharedMask, p->exclMask));
38528 return rc;
38529 }
@@ -40139,11 +40181,12 @@
40139 sp.tv_nsec = (microseconds % 1000000) * 1000;
40140 nanosleep(&sp, NULL);
40141 UNUSED_PARAMETER(NotUsed);
40142 return microseconds;
40143 #elif defined(HAVE_USLEEP) && HAVE_USLEEP
40144 usleep(microseconds);
 
40145 UNUSED_PARAMETER(NotUsed);
40146 return microseconds;
40147 #else
40148 int seconds = (microseconds+999999)/1000000;
40149 sleep(seconds);
@@ -40712,11 +40755,11 @@
40712 return SQLITE_IOERR_LOCK;
40713 }
40714
40715 if( nTries==1 ){
40716 conchModTime = buf.st_mtimespec;
40717 usleep(500000); /* wait 0.5 sec and try the lock again*/
40718 continue;
40719 }
40720
40721 assert( nTries>1 );
40722 if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec ||
@@ -40738,11 +40781,11 @@
40738 }
40739 }else{
40740 /* don't break the lock on short read or a version mismatch */
40741 return SQLITE_BUSY;
40742 }
40743 usleep(10000000); /* wait 10 sec and try the lock again */
40744 continue;
40745 }
40746
40747 assert( nTries==3 );
40748 if( 0==proxyBreakConchLock(pFile, myHostID) ){
@@ -63876,10 +63919,13 @@
63876 int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
63877 int nBackup; /* Number of backup operations reading this btree */
63878 u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */
63879 Btree *pNext; /* List of other sharable Btrees from the same db */
63880 Btree *pPrev; /* Back pointer of the same list */
 
 
 
63881 #ifndef SQLITE_OMIT_SHARED_CACHE
63882 BtLock lock; /* Object used to lock page 1 */
63883 #endif
63884 };
63885
@@ -64656,10 +64702,21 @@
64656 #define clearAllSharedCacheTableLocks(a)
64657 #define downgradeAllSharedCacheTableLocks(a)
64658 #define hasSharedCacheTableLock(a,b,c,d) 1
64659 #define hasReadConflicts(a, b) 0
64660 #endif
 
 
 
 
 
 
 
 
 
 
 
64661
64662 /*
64663 ** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single
64664 ** (MemPage*) as an argument. The (MemPage*) must not be NULL.
64665 **
@@ -67150,11 +67207,11 @@
67150 /* If the B-Tree was successfully opened, set the pager-cache size to the
67151 ** default value. Except, when opening on an existing shared pager-cache,
67152 ** do not change the pager-cache size.
67153 */
67154 if( sqlite3BtreeSchema(p, 0, 0)==0 ){
67155 sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE);
67156 }
67157
67158 pFile = sqlite3PagerFile(pBt->pPager);
67159 if( pFile->pMethods ){
67160 sqlite3OsFileControlHint(pFile, SQLITE_FCNTL_PDB, (void*)&pBt->db);
@@ -70003,10 +70060,14 @@
70003 return rc;
70004 }
70005 }
70006 }
70007 }
 
 
 
 
70008
70009 if( pIdxKey ){
70010 xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
70011 pIdxKey->errCode = 0;
70012 assert( pIdxKey->default_rc==1
@@ -89767,26 +89828,35 @@
89767 pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */
89768 }
89769 break;
89770 }
89771
89772 /* Opcode: SeekHit P1 P2 * * *
89773 ** Synopsis: seekHit=P2
89774 **
89775 ** Set the seekHit flag on cursor P1 to the value in P2.
89776 ** The seekHit flag is used by the IfNoHope opcode.
89777 **
89778 ** P1 must be a valid b-tree cursor. P2 must be a boolean value,
89779 ** either 0 or 1.
 
 
 
 
 
89780 */
89781 case OP_SeekHit: {
89782 VdbeCursor *pC;
89783 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
89784 pC = p->apCsr[pOp->p1];
89785 assert( pC!=0 );
89786 assert( pOp->p2==0 || pOp->p2==1 );
89787 pC->seekHit = pOp->p2 & 1;
 
 
 
 
89788 break;
89789 }
89790
89791 /* Opcode: IfNotOpen P1 P2 * * *
89792 ** Synopsis: if( !csr[P1] ) goto P2
@@ -89840,20 +89910,24 @@
89840 */
89841 /* Opcode: IfNoHope P1 P2 P3 P4 *
89842 ** Synopsis: key=r[P3@P4]
89843 **
89844 ** Register P3 is the first of P4 registers that form an unpacked
89845 ** record.
89846 **
89847 ** Cursor P1 is on an index btree. If the seekHit flag is set on P1, then
89848 ** this opcode is a no-op. But if the seekHit flag of P1 is clear, then
89849 ** check to see if there is any entry in P1 that matches the
89850 ** prefix identified by P3 and P4. If no entry matches the prefix,
89851 ** jump to P2. Otherwise fall through.
89852 **
89853 ** This opcode behaves like OP_NotFound if the seekHit
89854 ** flag is clear and it behaves like OP_Noop if the seekHit flag is set.
 
 
 
 
89855 **
89856 ** This opcode is used in IN clause processing for a multi-column key.
89857 ** If an IN clause is attached to an element of the key other than the
89858 ** left-most element, and if there are no matches on the most recent
89859 ** seek over the whole key, then it might be that one of the key element
@@ -89891,11 +89965,11 @@
89891 case OP_IfNoHope: { /* jump, in3 */
89892 VdbeCursor *pC;
89893 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
89894 pC = p->apCsr[pOp->p1];
89895 assert( pC!=0 );
89896 if( pC->seekHit ) break;
89897 /* Fall through into OP_NotFound */
89898 /* no break */ deliberate_fall_through
89899 }
89900 case OP_NoConflict: /* jump, in3 */
89901 case OP_NotFound: /* jump, in3 */
@@ -89973,10 +90047,11 @@
89973 VdbeBranchTaken(alreadyExists!=0,2);
89974 if( alreadyExists ) goto jump_to_p2;
89975 }else{
89976 VdbeBranchTaken(takeJump||alreadyExists==0,2);
89977 if( takeJump || !alreadyExists ) goto jump_to_p2;
 
89978 }
89979 break;
89980 }
89981
89982 /* Opcode: SeekRowid P1 P2 P3 * *
@@ -91205,11 +91280,11 @@
91205 if( rc ) goto abort_due_to_error;
91206 }
91207 break;
91208 }
91209
91210 /* Opcode: IdxGE P1 P2 P3 P4 P5
91211 ** Synopsis: key=r[P3@P4]
91212 **
91213 ** The P4 register values beginning with P3 form an unpacked index
91214 ** key that omits the PRIMARY KEY. Compare this key value against the index
91215 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
@@ -91216,11 +91291,11 @@
91216 ** fields at the end.
91217 **
91218 ** If the P1 index entry is greater than or equal to the key value
91219 ** then jump to P2. Otherwise fall through to the next instruction.
91220 */
91221 /* Opcode: IdxGT P1 P2 P3 P4 P5
91222 ** Synopsis: key=r[P3@P4]
91223 **
91224 ** The P4 register values beginning with P3 form an unpacked index
91225 ** key that omits the PRIMARY KEY. Compare this key value against the index
91226 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
@@ -91227,11 +91302,11 @@
91227 ** fields at the end.
91228 **
91229 ** If the P1 index entry is greater than the key value
91230 ** then jump to P2. Otherwise fall through to the next instruction.
91231 */
91232 /* Opcode: IdxLT P1 P2 P3 P4 P5
91233 ** Synopsis: key=r[P3@P4]
91234 **
91235 ** The P4 register values beginning with P3 form an unpacked index
91236 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
91237 ** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
@@ -91238,11 +91313,11 @@
91238 ** ROWID on the P1 index.
91239 **
91240 ** If the P1 index entry is less than the key value then jump to P2.
91241 ** Otherwise fall through to the next instruction.
91242 */
91243 /* Opcode: IdxLE P1 P2 P3 P4 P5
91244 ** Synopsis: key=r[P3@P4]
91245 **
91246 ** The P4 register values beginning with P3 form an unpacked index
91247 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
91248 ** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
@@ -91264,11 +91339,10 @@
91264 assert( pC!=0 );
91265 assert( pC->isOrdered );
91266 assert( pC->eCurType==CURTYPE_BTREE );
91267 assert( pC->uc.pCursor!=0);
91268 assert( pC->deferredMoveto==0 );
91269 assert( pOp->p5==0 || pOp->p5==1 );
91270 assert( pOp->p4type==P4_INT32 );
91271 r.pKeyInfo = pC->pKeyInfo;
91272 r.nField = (u16)pOp->p4.i;
91273 if( pOp->opcode<OP_IdxLT ){
91274 assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxGT );
@@ -94911,17 +94985,20 @@
94911 pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
94912 pCsr->uc.pSorter = pSorter;
94913 if( pSorter==0 ){
94914 rc = SQLITE_NOMEM_BKPT;
94915 }else{
 
94916 pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
94917 memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
94918 pKeyInfo->db = 0;
94919 if( nField && nWorker==0 ){
94920 pKeyInfo->nKeyField = nField;
94921 }
94922 pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
 
 
94923 pSorter->nTask = nWorker + 1;
94924 pSorter->iPrev = (u8)(nWorker - 1);
94925 pSorter->bUseThreads = (pSorter->nTask>1);
94926 pSorter->db = db;
94927 for(i=0; i<pSorter->nTask; i++){
@@ -112071,12 +112148,14 @@
112071
112072 /*
112073 ** Add a new CHECK constraint to the table currently under construction.
112074 */
112075 SQLITE_PRIVATE void sqlite3AddCheckConstraint(
112076 Parse *pParse, /* Parsing context */
112077 Expr *pCheckExpr /* The check expression */
 
 
112078 ){
112079 #ifndef SQLITE_OMIT_CHECK
112080 Table *pTab = pParse->pNewTable;
112081 sqlite3 *db = pParse->db;
112082 if( pTab && !IN_DECLARE_VTAB
@@ -112083,10 +112162,17 @@
112083 && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
112084 ){
112085 pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
112086 if( pParse->constraintName.n ){
112087 sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
 
 
 
 
 
 
 
112088 }
112089 }else
112090 #endif
112091 {
112092 sqlite3ExprDelete(pParse->db, pCheckExpr);
@@ -112336,16 +112422,19 @@
112336 static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
112337 char *zExtra;
112338 int nByte;
112339 if( pIdx->nColumn>=N ) return SQLITE_OK;
112340 assert( pIdx->isResized==0 );
112341 nByte = (sizeof(char*) + sizeof(i16) + 1)*N;
112342 zExtra = sqlite3DbMallocZero(db, nByte);
112343 if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
112344 memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
112345 pIdx->azColl = (const char**)zExtra;
112346 zExtra += sizeof(char*)*N;
 
 
 
112347 memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
112348 pIdx->aiColumn = (i16*)zExtra;
112349 zExtra += sizeof(i16)*N;
112350 memcpy(zExtra, pIdx->aSortOrder, pIdx->nColumn);
112351 pIdx->aSortOrder = (u8*)zExtra;
@@ -122299,11 +122388,11 @@
122299 sqlite3ExprDelete(db, pCopy);
122300 if( onError==OE_Ignore ){
122301 sqlite3VdbeGoto(v, ignoreDest);
122302 }else{
122303 char *zName = pCheck->a[i].zEName;
122304 if( zName==0 ) zName = pTab->zName;
122305 if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
122306 sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
122307 onError, zName, P4_TRANSIENT,
122308 P5_ConstraintCheck);
122309 }
@@ -129148,10 +129237,11 @@
129148 }while( rc==SQLITE_ERROR_RETRY
129149 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
129150 sqlite3BtreeLeaveAll(db);
129151 rc = sqlite3ApiExit(db, rc);
129152 assert( (rc&db->errMask)==rc );
 
129153 sqlite3_mutex_leave(db->mutex);
129154 return rc;
129155 }
129156
129157
@@ -142156,10 +142246,13 @@
142156
142157 pLoop->wsFlags |= WHERE_IN_ABLE;
142158 if( pLevel->u.in.nIn==0 ){
142159 pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
142160 }
 
 
 
142161
142162 i = pLevel->u.in.nIn;
142163 pLevel->u.in.nIn += nEq;
142164 pLevel->u.in.aInLoop =
142165 sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
@@ -142182,20 +142275,22 @@
142182 pIn->iCur = iTab;
142183 pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
142184 if( iEq>0 ){
142185 pIn->iBase = iReg - i;
142186 pIn->nPrefix = i;
142187 pLoop->wsFlags |= WHERE_IN_EARLYOUT;
142188 }else{
142189 pIn->nPrefix = 0;
142190 }
142191 }else{
142192 pIn->eEndLoopOp = OP_Noop;
142193 }
142194 pIn++;
142195 }
142196 }
 
 
 
142197 }else{
142198 pLevel->u.in.nIn = 0;
142199 }
142200 sqlite3DbFree(pParse->db, aiMap);
142201 #endif
@@ -143375,13 +143470,10 @@
143375 if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
143376 /* The skip-scan logic inside the call to codeAllEqualityConstraints()
143377 ** above has already left the cursor sitting on the correct row,
143378 ** so no further seeking is needed */
143379 }else{
143380 if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
143381 sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur);
143382 }
143383 if( regBignull ){
143384 sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
143385 VdbeComment((v, "NULL-scan pass ctr"));
143386 }
143387
@@ -143488,11 +143580,11 @@
143488 testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
143489 testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
143490 }
143491
143492 if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
143493 sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
143494 }
143495
143496 /* Seek the table cursor, if required */
143497 omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0
143498 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
@@ -154289,37 +154381,32 @@
154289
154290 #endif /* SQLITE_OMIT_WINDOWFUNC */
154291
154292 /************** End of window.c **********************************************/
154293 /************** Begin file parse.c *******************************************/
 
 
154294 /*
154295 ** 2000-05-29
154296 **
154297 ** The author disclaims copyright to this source code. In place of
154298 ** a legal notice, here is a blessing:
154299 **
154300 ** May you do good and not evil.
154301 ** May you find forgiveness for yourself and forgive others.
154302 ** May you share freely, never taking more than you give.
154303 **
154304 *************************************************************************
154305 ** Driver template for the LEMON parser generator.
154306 **
154307 ** The "lemon" program processes an LALR(1) input grammar file, then uses
154308 ** this template to construct a parser. The "lemon" program inserts text
154309 ** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the
154310 ** interstitial "-" characters) contained in this template is changed into
154311 ** the value of the %name directive from the grammar. Otherwise, the content
154312 ** of this template is copied straight through into the generate parser
154313 ** source file.
154314 **
154315 ** The following is the concatenation of all %include directives from the
154316 ** input grammar file:
154317 */
154318 /* #include <stdio.h> */
154319 /* #include <assert.h> */
154320 /************ Begin %include sections from the grammar ************************/
154321
154322 /* #include "sqliteInt.h" */
154323
154324 /*
154325 ** Disable all error recovery processing in the parser push-down
@@ -154499,15 +154586,195 @@
154499
154500 #if TK_SPAN>255
154501 # error too many tokens in the grammar
154502 #endif
154503 /**************** End of %include directives **********************************/
154504 /* These constants specify the various numeric values for terminal symbols
154505 ** in a format understandable to "makeheaders". This section is blank unless
154506 ** "lemon" is run with the "-m" command-line option.
154507 ***************** Begin makeheaders token definitions *************************/
154508 /**************** End makeheaders token definitions ***************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154509
154510 /* The next sections is a series of control #defines.
154511 ** various aspects of the generated parser.
154512 ** YYCODETYPE is the data type used to store the integer codes
154513 ** that represent terminal and non-terminal symbols.
@@ -155509,10 +155776,11 @@
155509 };
155510 typedef struct yyParser yyParser;
155511
155512 #ifndef NDEBUG
155513 /* #include <stdio.h> */
 
155514 static FILE *yyTraceFILE = 0;
155515 static char *yyTracePrompt = 0;
155516 #endif /* NDEBUG */
155517
155518 #ifndef NDEBUG
@@ -157776,11 +158044,11 @@
157776 case 38: /* ccons ::= UNIQUE onconf */
157777 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0,
157778 SQLITE_IDXTYPE_UNIQUE);}
157779 break;
157780 case 39: /* ccons ::= CHECK LP expr RP */
157781 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202);}
157782 break;
157783 case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
157784 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy242,yymsp[0].minor.yy192);}
157785 break;
157786 case 41: /* ccons ::= defer_subclause */
@@ -157855,11 +158123,11 @@
157855 case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
157856 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0,
157857 SQLITE_IDXTYPE_UNIQUE);}
157858 break;
157859 case 68: /* tcons ::= CHECK LP expr RP onconf */
157860 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202);}
157861 break;
157862 case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
157863 {
157864 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy192);
157865 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy192);
@@ -164932,11 +165200,13 @@
164932 if( iNew>=0 && iNew<=255 ){
164933 sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
164934 }
164935 rc = SQLITE_OK;
164936 }else{
 
164937 rc = sqlite3OsFileControl(fd, op, pArg);
 
164938 }
164939 sqlite3BtreeLeave(pBtree);
164940 }
164941 sqlite3_mutex_leave(db->mutex);
164942 return rc;
@@ -165315,10 +165585,29 @@
165315 case SQLITE_TESTCTRL_RESULT_INTREAL: {
165316 sqlite3_context *pCtx = va_arg(ap, sqlite3_context*);
165317 sqlite3ResultIntReal(pCtx);
165318 break;
165319 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165320 }
165321 va_end(ap);
165322 #endif /* SQLITE_UNTESTABLE */
165323 return rc;
165324 }
@@ -209457,10 +209746,12 @@
209457 #define FTS5_CARET 12
209458 #define FTS5_COMMA 13
209459 #define FTS5_PLUS 14
209460 #define FTS5_STAR 15
209461
 
 
209462 /*
209463 ** 2000-05-29
209464 **
209465 ** The author disclaims copyright to this source code. In place of
209466 ** a legal notice, here is a blessing:
@@ -209481,12 +209772,10 @@
209481 ** source file.
209482 **
209483 ** The following is the concatenation of all %include directives from the
209484 ** input grammar file:
209485 */
209486 /* #include <stdio.h> */
209487 /* #include <assert.h> */
209488 /************ Begin %include sections from the grammar ************************/
209489
209490 /* #include "fts5Int.h" */
209491 /* #include "fts5parse.h" */
209492
@@ -209512,15 +209801,30 @@
209512 ** into sqlite3ParserAlloc(). The default is size_t.
209513 */
209514 #define fts5YYMALLOCARGTYPE u64
209515
209516 /**************** End of %include directives **********************************/
209517 /* These constants specify the various numeric values for terminal symbols
209518 ** in a format understandable to "makeheaders". This section is blank unless
209519 ** "lemon" is run with the "-m" command-line option.
209520 ***************** Begin makeheaders token definitions *************************/
209521 /**************** End makeheaders token definitions ***************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209522
209523 /* The next sections is a series of control #defines.
209524 ** various aspects of the generated parser.
209525 ** fts5YYCODETYPE is the data type used to store the integer codes
209526 ** that represent terminal and non-terminal symbols.
@@ -209799,10 +210103,11 @@
209799 };
209800 typedef struct fts5yyParser fts5yyParser;
209801
209802 #ifndef NDEBUG
209803 /* #include <stdio.h> */
 
209804 static FILE *fts5yyTraceFILE = 0;
209805 static char *fts5yyTracePrompt = 0;
209806 #endif /* NDEBUG */
209807
209808 #ifndef NDEBUG
@@ -215412,12 +215717,21 @@
215412 Fts5ExprNearset *pNear = pExpr->pNear;
215413 int i;
215414 int iTerm;
215415
215416 if( pNear->pColset ){
215417 int iCol = pNear->pColset->aiCol[0];
215418 zRet = fts5PrintfAppend(zRet, "%s : ", pConfig->azCol[iCol]);
 
 
 
 
 
 
 
 
 
215419 if( zRet==0 ) return 0;
215420 }
215421
215422 if( pNear->nPhrase>1 ){
215423 zRet = fts5PrintfAppend(zRet, "NEAR(");
@@ -225836,11 +226150,11 @@
225836 int nArg, /* Number of args */
225837 sqlite3_value **apUnused /* Function arguments */
225838 ){
225839 assert( nArg==0 );
225840 UNUSED_PARAM2(nArg, apUnused);
225841 sqlite3_result_text(pCtx, "fts5: 2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492", -1, SQLITE_TRANSIENT);
225842 }
225843
225844 /*
225845 ** Return true if zName is the extension on one of the shadow tables used
225846 ** by this module.
@@ -226399,13 +226713,20 @@
226399 ctx.szCol = 0;
226400 rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT,
226401 zText, nText, (void*)&ctx, fts5StorageInsertCallback
226402 );
226403 p->aTotalSize[iCol-1] -= (i64)ctx.szCol;
 
 
 
226404 }
226405 }
226406 p->nTotalRow--;
 
 
 
 
226407
226408 rc2 = sqlite3_reset(pSeek);
226409 if( rc==SQLITE_OK ) rc = rc2;
226410 return rc;
226411 }
@@ -230619,12 +230940,12 @@
230619 }
230620 #endif /* SQLITE_CORE */
230621 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
230622
230623 /************** End of stmt.c ************************************************/
230624 #if __LINE__!=230624
230625 #undef SQLITE_SOURCE_ID
230626 #define SQLITE_SOURCE_ID "2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36alt2"
230627 #endif
230628 /* Return the source-id for this library */
230629 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
230630 /************************** End of sqlite3.c ******************************/
230631
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1171,11 +1171,11 @@
1171 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1172 ** [sqlite_version()] and [sqlite_source_id()].
1173 */
1174 #define SQLITE_VERSION "3.34.0"
1175 #define SQLITE_VERSION_NUMBER 3034000
1176 #define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be"
1177
1178 /*
1179 ** CAPI3REF: Run-Time Library Version Numbers
1180 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1181 **
@@ -7245,11 +7245,11 @@
7245 ** <ol>
7246 ** <li value="0"> SQLITE_TXN_NONE
7247 ** <li value="1"> SQLITE_TXN_READ
7248 ** <li value="2"> SQLITE_TXN_WRITE
7249 ** </ol>
7250 ** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
7251 ** a valid schema, then -1 is returned.
7252 */
7253 SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
7254
7255 /*
@@ -8785,10 +8785,11 @@
8785 */
8786 #define SQLITE_TESTCTRL_FIRST 5
8787 #define SQLITE_TESTCTRL_PRNG_SAVE 5
8788 #define SQLITE_TESTCTRL_PRNG_RESTORE 6
8789 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
8790 #define SQLITE_TESTCTRL_SEEK_COUNT 7
8791 #define SQLITE_TESTCTRL_BITVEC_TEST 8
8792 #define SQLITE_TESTCTRL_FAULT_INSTALL 9
8793 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
8794 #define SQLITE_TESTCTRL_PENDING_BYTE 11
8795 #define SQLITE_TESTCTRL_ASSERT 12
@@ -15374,10 +15375,16 @@
15375 SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *);
15376 SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
15377 SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);
15378 SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *pBt);
15379 SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void);
15380
15381 #ifdef SQLITE_DEBUG
15382 SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree*);
15383 #else
15384 # define sqlite3BtreeSeekCount(X) 0
15385 #endif
15386
15387 #ifndef NDEBUG
15388 SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*);
15389 #endif
15390 SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*);
@@ -15728,11 +15735,11 @@
15735 #define OP_SequenceTest 113 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15736 #define OP_OpenPseudo 114 /* synopsis: P3 columns in r[P2] */
15737 #define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */
15738 #define OP_Close 116
15739 #define OP_ColumnsUsed 117
15740 #define OP_SeekHit 118 /* synopsis: set P2<=seekHit<=P3 */
15741 #define OP_Sequence 119 /* synopsis: r[P2]=cursor[P1].ctr++ */
15742 #define OP_NewRowid 120 /* synopsis: r[P2]=rowid */
15743 #define OP_Insert 121 /* synopsis: intkey=r[P3] data=r[P2] */
15744 #define OP_Delete 122
15745 #define OP_ResetCount 123
@@ -19594,11 +19601,11 @@
19601 # define sqlite3ColumnPropertiesFromName(T,C) /* no-op */
19602 #endif
19603 SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*,Token*);
19604 SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int);
19605 SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
19606 SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*, const char*, const char*);
19607 SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*);
19608 SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*);
19609 SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*);
19610 SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);
19611 SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*,
@@ -20842,11 +20849,11 @@
20849 u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */
20850 #endif
20851 Bool isEphemeral:1; /* True for an ephemeral table */
20852 Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
20853 Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
20854 u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
20855 Btree *pBtx; /* Separate file holding temporary table */
20856 i64 seqCount; /* Sequence counter */
20857 u32 *aAltMap; /* Mapping from table to index column numbers */
20858
20859 /* Cached OP_Column parse information is only valid if cacheStatus matches
@@ -28614,15 +28621,14 @@
28621 }
28622 }else{
28623 v = va_arg(ap,int);
28624 }
28625 if( v<0 ){
28626 testcase( v==SMALLEST_INT64 );
28627 testcase( v==(-1) );
28628 longvalue = ~v;
28629 longvalue++;
 
28630 prefix = '-';
28631 }else{
28632 longvalue = v;
28633 prefix = flag_prefix;
28634 }
@@ -31914,10 +31920,11 @@
31920 assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
31921 if( enc==SQLITE_UTF8 ){
31922 incr = 1;
31923 }else{
31924 incr = 2;
31925 length &= ~1;
31926 assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
31927 for(i=3-enc; i<length && zNum[i]==0; i+=2){}
31928 nonNum = i<length;
31929 zEnd = &zNum[i^1];
31930 zNum += (enc&1);
@@ -33330,11 +33337,11 @@
33337 /* 113 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
33338 /* 114 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
33339 /* 115 */ "String8" OpHelp("r[P2]='P4'"),
33340 /* 116 */ "Close" OpHelp(""),
33341 /* 117 */ "ColumnsUsed" OpHelp(""),
33342 /* 118 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
33343 /* 119 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
33344 /* 120 */ "NewRowid" OpHelp("r[P2]=rowid"),
33345 /* 121 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
33346 /* 122 */ "Delete" OpHelp(""),
33347 /* 123 */ "ResetCount" OpHelp(""),
@@ -35140,10 +35147,13 @@
35147
35148 *pResOut = reserved;
35149 return rc;
35150 }
35151
35152 /* Forward declaration*/
35153 static int unixSleep(sqlite3_vfs*,int);
35154
35155 /*
35156 ** Set a posix-advisory-lock.
35157 **
35158 ** There are two versions of this routine. If compiled with
35159 ** SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter
@@ -35169,11 +35179,11 @@
35179 /* On systems that support some kind of blocking file lock with a timeout,
35180 ** make appropriate changes here to invoke that blocking file lock. On
35181 ** generic posix, however, there is no such API. So we simply try the
35182 ** lock once every millisecond until either the timeout expires, or until
35183 ** the lock is obtained. */
35184 unixSleep(0,1000);
35185 rc = osFcntl(h,F_SETLK,pLock);
35186 tm--;
35187 }
35188 return rc;
35189 }
@@ -35740,10 +35750,11 @@
35750 */
35751 setPendingFd(pFile);
35752 }
35753 sqlite3_mutex_leave(pInode->pLockMutex);
35754 releaseInodeInfo(pFile);
35755 assert( pFile->pShm==0 );
35756 rc = closeUnixFile(id);
35757 unixLeaveMutex();
35758 return rc;
35759 }
35760
@@ -37850,10 +37861,11 @@
37861 u8 isReadonly; /* True if read-only */
37862 u8 isUnlocked; /* True if no DMS lock held */
37863 char **apRegion; /* Array of mapped shared-memory regions */
37864 int nRef; /* Number of unixShm objects pointing to this */
37865 unixShm *pFirst; /* All unixShm objects pointing to this */
37866 int aLock[SQLITE_SHM_NLOCK]; /* # shared locks on slot, -1==excl lock */
37867 #ifdef SQLITE_DEBUG
37868 u8 exclMask; /* Mask of exclusive locks held */
37869 u8 sharedMask; /* Mask of shared locks held */
37870 u8 nextShmId; /* Next available unixShm.id value */
37871 #endif
@@ -38390,10 +38402,42 @@
38402 if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
38403 sqlite3_mutex_leave(pShmNode->pShmMutex);
38404 return rc;
38405 }
38406
38407 /*
38408 ** Check that the pShmNode->aLock[] array comports with the locking bitmasks
38409 ** held by each client. Return true if it does, or false otherwise. This
38410 ** is to be used in an assert(). e.g.
38411 **
38412 ** assert( assertLockingArrayOk(pShmNode) );
38413 */
38414 #ifdef SQLITE_DEBUG
38415 static int assertLockingArrayOk(unixShmNode *pShmNode){
38416 unixShm *pX;
38417 int aLock[SQLITE_SHM_NLOCK];
38418 assert( sqlite3_mutex_held(pShmNode->pShmMutex) );
38419
38420 memset(aLock, 0, sizeof(aLock));
38421 for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
38422 int i;
38423 for(i=0; i<SQLITE_SHM_NLOCK; i++){
38424 if( pX->exclMask & (1<<i) ){
38425 assert( aLock[i]==0 );
38426 aLock[i] = -1;
38427 }else if( pX->sharedMask & (1<<i) ){
38428 assert( aLock[i]>=0 );
38429 aLock[i]++;
38430 }
38431 }
38432 }
38433
38434 assert( 0==memcmp(pShmNode->aLock, aLock, sizeof(aLock)) );
38435 return (memcmp(pShmNode->aLock, aLock, sizeof(aLock))==0);
38436 }
38437 #endif
38438
38439 /*
38440 ** Change the lock state for a shared-memory segment.
38441 **
38442 ** Note that the relationship between SHAREd and EXCLUSIVE locks is a little
38443 ** different here than in posix. In xShmLock(), one can go from unlocked
@@ -38406,14 +38450,14 @@
38450 int n, /* Number of locks to acquire or release */
38451 int flags /* What to do with the lock */
38452 ){
38453 unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */
38454 unixShm *p = pDbFd->pShm; /* The shared memory being locked */
 
38455 unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */
38456 int rc = SQLITE_OK; /* Result code */
38457 u16 mask; /* Mask of locks to take or release */
38458 int *aLock = pShmNode->aLock;
38459
38460 assert( pShmNode==pDbFd->pInode->pShmNode );
38461 assert( pShmNode->pInode==pDbFd->pInode );
38462 assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );
38463 assert( n>=1 );
@@ -38448,82 +38492,80 @@
38492 #endif
38493
38494 mask = (1<<(ofst+n)) - (1<<ofst);
38495 assert( n>1 || mask==(1<<ofst) );
38496 sqlite3_mutex_enter(pShmNode->pShmMutex);
38497 assert( assertLockingArrayOk(pShmNode) );
38498 if( flags & SQLITE_SHM_UNLOCK ){
38499 if( (p->exclMask|p->sharedMask) & mask ){
38500 int ii;
38501 int bUnlock = 1;
38502
38503 for(ii=ofst; ii<ofst+n; ii++){
38504 if( aLock[ii]>((p->sharedMask & (1<<ii)) ? 1 : 0) ){
38505 bUnlock = 0;
38506 }
38507 }
38508
38509 if( bUnlock ){
38510 rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n);
38511 if( rc==SQLITE_OK ){
38512 memset(&aLock[ofst], 0, sizeof(int)*n);
38513 }
38514 }else if( p->sharedMask & (1<<ofst) ){
38515 assert( n==1 && aLock[ofst]>1 );
38516 aLock[ofst]--;
38517 }
38518
38519 /* Undo the local locks */
38520 if( rc==SQLITE_OK ){
38521 p->exclMask &= ~mask;
38522 p->sharedMask &= ~mask;
38523 }
38524 }
38525 }else if( flags & SQLITE_SHM_SHARED ){
38526 assert( n==1 );
38527 assert( (p->exclMask & (1<<ofst))==0 );
38528 if( (p->sharedMask & mask)==0 ){
38529 if( aLock[ofst]<0 ){
38530 rc = SQLITE_BUSY;
38531 }else if( aLock[ofst]==0 ){
38532 rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);
38533 }
38534
38535 /* Get the local shared locks */
38536 if( rc==SQLITE_OK ){
38537 p->sharedMask |= mask;
38538 aLock[ofst]++;
38539 }
38540 }
38541 }else{
38542 /* Make sure no sibling connections hold locks that will block this
38543 ** lock. If any do, return SQLITE_BUSY right away. */
38544 int ii;
38545 for(ii=ofst; ii<ofst+n; ii++){
38546 assert( (p->sharedMask & mask)==0 );
38547 if( (p->exclMask & (1<<ii))==0 && aLock[ii] ){
38548 rc = SQLITE_BUSY;
38549 break;
38550 }
38551 }
38552
38553 /* Get the exclusive locks at the system level. Then if successful
38554 ** also update the in-memory values. */
38555 if( rc==SQLITE_OK ){
38556 rc = unixShmSystemLock(pDbFd, F_WRLCK, ofst+UNIX_SHM_BASE, n);
38557 if( rc==SQLITE_OK ){
38558 assert( (p->sharedMask & mask)==0 );
38559 p->exclMask |= mask;
38560 for(ii=ofst; ii<ofst+n; ii++){
38561 aLock[ii] = -1;
38562 }
38563 }
38564 }
38565 }
38566 assert( assertLockingArrayOk(pShmNode) );
 
 
38567 sqlite3_mutex_leave(pShmNode->pShmMutex);
38568 OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
38569 p->id, osGetpid(0), p->sharedMask, p->exclMask));
38570 return rc;
38571 }
@@ -40139,11 +40181,12 @@
40181 sp.tv_nsec = (microseconds % 1000000) * 1000;
40182 nanosleep(&sp, NULL);
40183 UNUSED_PARAMETER(NotUsed);
40184 return microseconds;
40185 #elif defined(HAVE_USLEEP) && HAVE_USLEEP
40186 if( microseconds>=1000000 ) sleep(microseconds/1000000);
40187 if( microseconds%1000000 ) usleep(microseconds%1000000);
40188 UNUSED_PARAMETER(NotUsed);
40189 return microseconds;
40190 #else
40191 int seconds = (microseconds+999999)/1000000;
40192 sleep(seconds);
@@ -40712,11 +40755,11 @@
40755 return SQLITE_IOERR_LOCK;
40756 }
40757
40758 if( nTries==1 ){
40759 conchModTime = buf.st_mtimespec;
40760 unixSleep(0,500000); /* wait 0.5 sec and try the lock again*/
40761 continue;
40762 }
40763
40764 assert( nTries>1 );
40765 if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec ||
@@ -40738,11 +40781,11 @@
40781 }
40782 }else{
40783 /* don't break the lock on short read or a version mismatch */
40784 return SQLITE_BUSY;
40785 }
40786 unixSleep(0,10000000); /* wait 10 sec and try the lock again */
40787 continue;
40788 }
40789
40790 assert( nTries==3 );
40791 if( 0==proxyBreakConchLock(pFile, myHostID) ){
@@ -63876,10 +63919,13 @@
63919 int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
63920 int nBackup; /* Number of backup operations reading this btree */
63921 u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */
63922 Btree *pNext; /* List of other sharable Btrees from the same db */
63923 Btree *pPrev; /* Back pointer of the same list */
63924 #ifdef SQLITE_DEBUG
63925 u64 nSeek; /* Calls to sqlite3BtreeMovetoUnpacked() */
63926 #endif
63927 #ifndef SQLITE_OMIT_SHARED_CACHE
63928 BtLock lock; /* Object used to lock page 1 */
63929 #endif
63930 };
63931
@@ -64656,10 +64702,21 @@
64702 #define clearAllSharedCacheTableLocks(a)
64703 #define downgradeAllSharedCacheTableLocks(a)
64704 #define hasSharedCacheTableLock(a,b,c,d) 1
64705 #define hasReadConflicts(a, b) 0
64706 #endif
64707
64708 #ifdef SQLITE_DEBUG
64709 /*
64710 ** Return an reset the seek counter for a Btree object.
64711 */
64712 SQLITE_PRIVATE sqlite3_uint64 sqlite3BtreeSeekCount(Btree *pBt){
64713 u64 n = pBt->nSeek;
64714 pBt->nSeek = 0;
64715 return n;
64716 }
64717 #endif
64718
64719 /*
64720 ** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single
64721 ** (MemPage*) as an argument. The (MemPage*) must not be NULL.
64722 **
@@ -67150,11 +67207,11 @@
67207 /* If the B-Tree was successfully opened, set the pager-cache size to the
67208 ** default value. Except, when opening on an existing shared pager-cache,
67209 ** do not change the pager-cache size.
67210 */
67211 if( sqlite3BtreeSchema(p, 0, 0)==0 ){
67212 sqlite3BtreeSetCacheSize(p, SQLITE_DEFAULT_CACHE_SIZE);
67213 }
67214
67215 pFile = sqlite3PagerFile(pBt->pPager);
67216 if( pFile->pMethods ){
67217 sqlite3OsFileControlHint(pFile, SQLITE_FCNTL_PDB, (void*)&pBt->db);
@@ -70003,10 +70060,14 @@
70060 return rc;
70061 }
70062 }
70063 }
70064 }
70065
70066 #ifdef SQLITE_DEBUG
70067 pCur->pBtree->nSeek++; /* Performance measurement during testing */
70068 #endif
70069
70070 if( pIdxKey ){
70071 xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
70072 pIdxKey->errCode = 0;
70073 assert( pIdxKey->default_rc==1
@@ -89767,26 +89828,35 @@
89828 pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */
89829 }
89830 break;
89831 }
89832
89833 /* Opcode: SeekHit P1 P2 P3 * *
89834 ** Synopsis: set P2<=seekHit<=P3
89835 **
89836 ** Increase or decrease the seekHit value for cursor P1, if necessary,
89837 ** so that it is no less than P2 and no greater than P3.
89838 **
89839 ** The seekHit integer represents the maximum of terms in an index for which
89840 ** there is known to be at least one match. If the seekHit value is smaller
89841 ** than the total number of equality terms in an index lookup, then the
89842 ** OP_IfNoHope opcode might run to see if the IN loop can be abandoned
89843 ** early, thus saving work. This is part of the IN-early-out optimization.
89844 **
89845 ** P1 must be a valid b-tree cursor.
89846 */
89847 case OP_SeekHit: {
89848 VdbeCursor *pC;
89849 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
89850 pC = p->apCsr[pOp->p1];
89851 assert( pC!=0 );
89852 assert( pOp->p3>=pOp->p2 );
89853 if( pC->seekHit<pOp->p2 ){
89854 pC->seekHit = pOp->p2;
89855 }else if( pC->seekHit>pOp->p3 ){
89856 pC->seekHit = pOp->p3;
89857 }
89858 break;
89859 }
89860
89861 /* Opcode: IfNotOpen P1 P2 * * *
89862 ** Synopsis: if( !csr[P1] ) goto P2
@@ -89840,20 +89910,24 @@
89910 */
89911 /* Opcode: IfNoHope P1 P2 P3 P4 *
89912 ** Synopsis: key=r[P3@P4]
89913 **
89914 ** Register P3 is the first of P4 registers that form an unpacked
89915 ** record. Cursor P1 is an index btree. P2 is a jump destination.
89916 ** In other words, the operands to this opcode are the same as the
89917 ** operands to OP_NotFound and OP_IdxGT.
89918 **
89919 ** This opcode is an optimization attempt only. If this opcode always
89920 ** falls through, the correct answer is still obtained, but extra works
89921 ** is performed.
89922 **
89923 ** A value of N in the seekHit flag of cursor P1 means that there exists
89924 ** a key P3:N that will match some record in the index. We want to know
89925 ** if it is possible for a record P3:P4 to match some record in the
89926 ** index. If it is not possible, we can skips some work. So if seekHit
89927 ** is less than P4, attempt to find out if a match is possible by running
89928 ** OP_NotFound.
89929 **
89930 ** This opcode is used in IN clause processing for a multi-column key.
89931 ** If an IN clause is attached to an element of the key other than the
89932 ** left-most element, and if there are no matches on the most recent
89933 ** seek over the whole key, then it might be that one of the key element
@@ -89891,11 +89965,11 @@
89965 case OP_IfNoHope: { /* jump, in3 */
89966 VdbeCursor *pC;
89967 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
89968 pC = p->apCsr[pOp->p1];
89969 assert( pC!=0 );
89970 if( pC->seekHit>=pOp->p4.i ) break;
89971 /* Fall through into OP_NotFound */
89972 /* no break */ deliberate_fall_through
89973 }
89974 case OP_NoConflict: /* jump, in3 */
89975 case OP_NotFound: /* jump, in3 */
@@ -89973,10 +90047,11 @@
90047 VdbeBranchTaken(alreadyExists!=0,2);
90048 if( alreadyExists ) goto jump_to_p2;
90049 }else{
90050 VdbeBranchTaken(takeJump||alreadyExists==0,2);
90051 if( takeJump || !alreadyExists ) goto jump_to_p2;
90052 if( pOp->opcode==OP_IfNoHope ) pC->seekHit = pOp->p4.i;
90053 }
90054 break;
90055 }
90056
90057 /* Opcode: SeekRowid P1 P2 P3 * *
@@ -91205,11 +91280,11 @@
91280 if( rc ) goto abort_due_to_error;
91281 }
91282 break;
91283 }
91284
91285 /* Opcode: IdxGE P1 P2 P3 P4 *
91286 ** Synopsis: key=r[P3@P4]
91287 **
91288 ** The P4 register values beginning with P3 form an unpacked index
91289 ** key that omits the PRIMARY KEY. Compare this key value against the index
91290 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
@@ -91216,11 +91291,11 @@
91291 ** fields at the end.
91292 **
91293 ** If the P1 index entry is greater than or equal to the key value
91294 ** then jump to P2. Otherwise fall through to the next instruction.
91295 */
91296 /* Opcode: IdxGT P1 P2 P3 P4 *
91297 ** Synopsis: key=r[P3@P4]
91298 **
91299 ** The P4 register values beginning with P3 form an unpacked index
91300 ** key that omits the PRIMARY KEY. Compare this key value against the index
91301 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
@@ -91227,11 +91302,11 @@
91302 ** fields at the end.
91303 **
91304 ** If the P1 index entry is greater than the key value
91305 ** then jump to P2. Otherwise fall through to the next instruction.
91306 */
91307 /* Opcode: IdxLT P1 P2 P3 P4 *
91308 ** Synopsis: key=r[P3@P4]
91309 **
91310 ** The P4 register values beginning with P3 form an unpacked index
91311 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
91312 ** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
@@ -91238,11 +91313,11 @@
91313 ** ROWID on the P1 index.
91314 **
91315 ** If the P1 index entry is less than the key value then jump to P2.
91316 ** Otherwise fall through to the next instruction.
91317 */
91318 /* Opcode: IdxLE P1 P2 P3 P4 *
91319 ** Synopsis: key=r[P3@P4]
91320 **
91321 ** The P4 register values beginning with P3 form an unpacked index
91322 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
91323 ** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
@@ -91264,11 +91339,10 @@
91339 assert( pC!=0 );
91340 assert( pC->isOrdered );
91341 assert( pC->eCurType==CURTYPE_BTREE );
91342 assert( pC->uc.pCursor!=0);
91343 assert( pC->deferredMoveto==0 );
 
91344 assert( pOp->p4type==P4_INT32 );
91345 r.pKeyInfo = pC->pKeyInfo;
91346 r.nField = (u16)pOp->p4.i;
91347 if( pOp->opcode<OP_IdxLT ){
91348 assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxGT );
@@ -94911,17 +94985,20 @@
94985 pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
94986 pCsr->uc.pSorter = pSorter;
94987 if( pSorter==0 ){
94988 rc = SQLITE_NOMEM_BKPT;
94989 }else{
94990 Btree *pBt = db->aDb[0].pBt;
94991 pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
94992 memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
94993 pKeyInfo->db = 0;
94994 if( nField && nWorker==0 ){
94995 pKeyInfo->nKeyField = nField;
94996 }
94997 sqlite3BtreeEnter(pBt);
94998 pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(pBt);
94999 sqlite3BtreeLeave(pBt);
95000 pSorter->nTask = nWorker + 1;
95001 pSorter->iPrev = (u8)(nWorker - 1);
95002 pSorter->bUseThreads = (pSorter->nTask>1);
95003 pSorter->db = db;
95004 for(i=0; i<pSorter->nTask; i++){
@@ -112071,12 +112148,14 @@
112148
112149 /*
112150 ** Add a new CHECK constraint to the table currently under construction.
112151 */
112152 SQLITE_PRIVATE void sqlite3AddCheckConstraint(
112153 Parse *pParse, /* Parsing context */
112154 Expr *pCheckExpr, /* The check expression */
112155 const char *zStart, /* Opening "(" */
112156 const char *zEnd /* Closing ")" */
112157 ){
112158 #ifndef SQLITE_OMIT_CHECK
112159 Table *pTab = pParse->pNewTable;
112160 sqlite3 *db = pParse->db;
112161 if( pTab && !IN_DECLARE_VTAB
@@ -112083,10 +112162,17 @@
112162 && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
112163 ){
112164 pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
112165 if( pParse->constraintName.n ){
112166 sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
112167 }else{
112168 Token t;
112169 for(zStart++; sqlite3Isspace(zStart[0]); zStart++){}
112170 while( sqlite3Isspace(zEnd[-1]) ){ zEnd--; }
112171 t.z = zStart;
112172 t.n = (int)(zEnd - t.z);
112173 sqlite3ExprListSetName(pParse, pTab->pCheck, &t, 1);
112174 }
112175 }else
112176 #endif
112177 {
112178 sqlite3ExprDelete(pParse->db, pCheckExpr);
@@ -112336,16 +112422,19 @@
112422 static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
112423 char *zExtra;
112424 int nByte;
112425 if( pIdx->nColumn>=N ) return SQLITE_OK;
112426 assert( pIdx->isResized==0 );
112427 nByte = (sizeof(char*) + sizeof(LogEst) + sizeof(i16) + 1)*N;
112428 zExtra = sqlite3DbMallocZero(db, nByte);
112429 if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
112430 memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
112431 pIdx->azColl = (const char**)zExtra;
112432 zExtra += sizeof(char*)*N;
112433 memcpy(zExtra, pIdx->aiRowLogEst, sizeof(LogEst)*(pIdx->nKeyCol+1));
112434 pIdx->aiRowLogEst = (LogEst*)zExtra;
112435 zExtra += sizeof(LogEst)*N;
112436 memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
112437 pIdx->aiColumn = (i16*)zExtra;
112438 zExtra += sizeof(i16)*N;
112439 memcpy(zExtra, pIdx->aSortOrder, pIdx->nColumn);
112440 pIdx->aSortOrder = (u8*)zExtra;
@@ -122299,11 +122388,11 @@
122388 sqlite3ExprDelete(db, pCopy);
122389 if( onError==OE_Ignore ){
122390 sqlite3VdbeGoto(v, ignoreDest);
122391 }else{
122392 char *zName = pCheck->a[i].zEName;
122393 assert( zName!=0 || pParse->db->mallocFailed );
122394 if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
122395 sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
122396 onError, zName, P4_TRANSIENT,
122397 P5_ConstraintCheck);
122398 }
@@ -129148,10 +129237,11 @@
129237 }while( rc==SQLITE_ERROR_RETRY
129238 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
129239 sqlite3BtreeLeaveAll(db);
129240 rc = sqlite3ApiExit(db, rc);
129241 assert( (rc&db->errMask)==rc );
129242 db->busyHandler.nBusy = 0;
129243 sqlite3_mutex_leave(db->mutex);
129244 return rc;
129245 }
129246
129247
@@ -142156,10 +142246,13 @@
142246
142247 pLoop->wsFlags |= WHERE_IN_ABLE;
142248 if( pLevel->u.in.nIn==0 ){
142249 pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
142250 }
142251 if( iEq>0 ){
142252 pLoop->wsFlags |= WHERE_IN_EARLYOUT;
142253 }
142254
142255 i = pLevel->u.in.nIn;
142256 pLevel->u.in.nIn += nEq;
142257 pLevel->u.in.aInLoop =
142258 sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
@@ -142182,20 +142275,22 @@
142275 pIn->iCur = iTab;
142276 pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
142277 if( iEq>0 ){
142278 pIn->iBase = iReg - i;
142279 pIn->nPrefix = i;
 
142280 }else{
142281 pIn->nPrefix = 0;
142282 }
142283 }else{
142284 pIn->eEndLoopOp = OP_Noop;
142285 }
142286 pIn++;
142287 }
142288 }
142289 if( iEq>0 ){
142290 sqlite3VdbeAddOp3(v, OP_SeekHit, pLevel->iIdxCur, 0, iEq);
142291 }
142292 }else{
142293 pLevel->u.in.nIn = 0;
142294 }
142295 sqlite3DbFree(pParse->db, aiMap);
142296 #endif
@@ -143375,13 +143470,10 @@
143470 if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
143471 /* The skip-scan logic inside the call to codeAllEqualityConstraints()
143472 ** above has already left the cursor sitting on the correct row,
143473 ** so no further seeking is needed */
143474 }else{
 
 
 
143475 if( regBignull ){
143476 sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
143477 VdbeComment((v, "NULL-scan pass ctr"));
143478 }
143479
@@ -143488,11 +143580,11 @@
143580 testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
143581 testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
143582 }
143583
143584 if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
143585 sqlite3VdbeAddOp3(v, OP_SeekHit, iIdxCur, nEq, nEq);
143586 }
143587
143588 /* Seek the table cursor, if required */
143589 omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0
143590 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
@@ -154289,37 +154381,32 @@
154381
154382 #endif /* SQLITE_OMIT_WINDOWFUNC */
154383
154384 /************** End of window.c **********************************************/
154385 /************** Begin file parse.c *******************************************/
154386 /* This file is automatically generated by Lemon from input grammar
154387 ** source file "parse.y". */
154388 /*
154389 ** 2001-09-15
154390 **
154391 ** The author disclaims copyright to this source code. In place of
154392 ** a legal notice, here is a blessing:
154393 **
154394 ** May you do good and not evil.
154395 ** May you find forgiveness for yourself and forgive others.
154396 ** May you share freely, never taking more than you give.
154397 **
154398 *************************************************************************
154399 ** This file contains SQLite's SQL parser.
154400 **
154401 ** The canonical source code to this file ("parse.y") is a Lemon grammar
154402 ** file that specifies the input grammar and actions to take while parsing.
154403 ** That input file is processed by Lemon to generate a C-language
154404 ** implementation of a parser for the given grammer. You might be reading
154405 ** this comment as part of the translated C-code. Edits should be made
154406 ** to the original parse.y sources.
154407 */
 
 
 
 
 
 
 
154408
154409 /* #include "sqliteInt.h" */
154410
154411 /*
154412 ** Disable all error recovery processing in the parser push-down
@@ -154499,15 +154586,195 @@
154586
154587 #if TK_SPAN>255
154588 # error too many tokens in the grammar
154589 #endif
154590 /**************** End of %include directives **********************************/
154591 /* These constants specify the various numeric values for terminal symbols.
154592 ***************** Begin token definitions *************************************/
154593 #ifndef TK_SEMI
154594 #define TK_SEMI 1
154595 #define TK_EXPLAIN 2
154596 #define TK_QUERY 3
154597 #define TK_PLAN 4
154598 #define TK_BEGIN 5
154599 #define TK_TRANSACTION 6
154600 #define TK_DEFERRED 7
154601 #define TK_IMMEDIATE 8
154602 #define TK_EXCLUSIVE 9
154603 #define TK_COMMIT 10
154604 #define TK_END 11
154605 #define TK_ROLLBACK 12
154606 #define TK_SAVEPOINT 13
154607 #define TK_RELEASE 14
154608 #define TK_TO 15
154609 #define TK_TABLE 16
154610 #define TK_CREATE 17
154611 #define TK_IF 18
154612 #define TK_NOT 19
154613 #define TK_EXISTS 20
154614 #define TK_TEMP 21
154615 #define TK_LP 22
154616 #define TK_RP 23
154617 #define TK_AS 24
154618 #define TK_WITHOUT 25
154619 #define TK_COMMA 26
154620 #define TK_ABORT 27
154621 #define TK_ACTION 28
154622 #define TK_AFTER 29
154623 #define TK_ANALYZE 30
154624 #define TK_ASC 31
154625 #define TK_ATTACH 32
154626 #define TK_BEFORE 33
154627 #define TK_BY 34
154628 #define TK_CASCADE 35
154629 #define TK_CAST 36
154630 #define TK_CONFLICT 37
154631 #define TK_DATABASE 38
154632 #define TK_DESC 39
154633 #define TK_DETACH 40
154634 #define TK_EACH 41
154635 #define TK_FAIL 42
154636 #define TK_OR 43
154637 #define TK_AND 44
154638 #define TK_IS 45
154639 #define TK_MATCH 46
154640 #define TK_LIKE_KW 47
154641 #define TK_BETWEEN 48
154642 #define TK_IN 49
154643 #define TK_ISNULL 50
154644 #define TK_NOTNULL 51
154645 #define TK_NE 52
154646 #define TK_EQ 53
154647 #define TK_GT 54
154648 #define TK_LE 55
154649 #define TK_LT 56
154650 #define TK_GE 57
154651 #define TK_ESCAPE 58
154652 #define TK_ID 59
154653 #define TK_COLUMNKW 60
154654 #define TK_DO 61
154655 #define TK_FOR 62
154656 #define TK_IGNORE 63
154657 #define TK_INITIALLY 64
154658 #define TK_INSTEAD 65
154659 #define TK_NO 66
154660 #define TK_KEY 67
154661 #define TK_OF 68
154662 #define TK_OFFSET 69
154663 #define TK_PRAGMA 70
154664 #define TK_RAISE 71
154665 #define TK_RECURSIVE 72
154666 #define TK_REPLACE 73
154667 #define TK_RESTRICT 74
154668 #define TK_ROW 75
154669 #define TK_ROWS 76
154670 #define TK_TRIGGER 77
154671 #define TK_VACUUM 78
154672 #define TK_VIEW 79
154673 #define TK_VIRTUAL 80
154674 #define TK_WITH 81
154675 #define TK_NULLS 82
154676 #define TK_FIRST 83
154677 #define TK_LAST 84
154678 #define TK_CURRENT 85
154679 #define TK_FOLLOWING 86
154680 #define TK_PARTITION 87
154681 #define TK_PRECEDING 88
154682 #define TK_RANGE 89
154683 #define TK_UNBOUNDED 90
154684 #define TK_EXCLUDE 91
154685 #define TK_GROUPS 92
154686 #define TK_OTHERS 93
154687 #define TK_TIES 94
154688 #define TK_GENERATED 95
154689 #define TK_ALWAYS 96
154690 #define TK_REINDEX 97
154691 #define TK_RENAME 98
154692 #define TK_CTIME_KW 99
154693 #define TK_ANY 100
154694 #define TK_BITAND 101
154695 #define TK_BITOR 102
154696 #define TK_LSHIFT 103
154697 #define TK_RSHIFT 104
154698 #define TK_PLUS 105
154699 #define TK_MINUS 106
154700 #define TK_STAR 107
154701 #define TK_SLASH 108
154702 #define TK_REM 109
154703 #define TK_CONCAT 110
154704 #define TK_COLLATE 111
154705 #define TK_BITNOT 112
154706 #define TK_ON 113
154707 #define TK_INDEXED 114
154708 #define TK_STRING 115
154709 #define TK_JOIN_KW 116
154710 #define TK_CONSTRAINT 117
154711 #define TK_DEFAULT 118
154712 #define TK_NULL 119
154713 #define TK_PRIMARY 120
154714 #define TK_UNIQUE 121
154715 #define TK_CHECK 122
154716 #define TK_REFERENCES 123
154717 #define TK_AUTOINCR 124
154718 #define TK_INSERT 125
154719 #define TK_DELETE 126
154720 #define TK_UPDATE 127
154721 #define TK_SET 128
154722 #define TK_DEFERRABLE 129
154723 #define TK_FOREIGN 130
154724 #define TK_DROP 131
154725 #define TK_UNION 132
154726 #define TK_ALL 133
154727 #define TK_EXCEPT 134
154728 #define TK_INTERSECT 135
154729 #define TK_SELECT 136
154730 #define TK_VALUES 137
154731 #define TK_DISTINCT 138
154732 #define TK_DOT 139
154733 #define TK_FROM 140
154734 #define TK_JOIN 141
154735 #define TK_USING 142
154736 #define TK_ORDER 143
154737 #define TK_GROUP 144
154738 #define TK_HAVING 145
154739 #define TK_LIMIT 146
154740 #define TK_WHERE 147
154741 #define TK_INTO 148
154742 #define TK_NOTHING 149
154743 #define TK_FLOAT 150
154744 #define TK_BLOB 151
154745 #define TK_INTEGER 152
154746 #define TK_VARIABLE 153
154747 #define TK_CASE 154
154748 #define TK_WHEN 155
154749 #define TK_THEN 156
154750 #define TK_ELSE 157
154751 #define TK_INDEX 158
154752 #define TK_ALTER 159
154753 #define TK_ADD 160
154754 #define TK_WINDOW 161
154755 #define TK_OVER 162
154756 #define TK_FILTER 163
154757 #define TK_COLUMN 164
154758 #define TK_AGG_FUNCTION 165
154759 #define TK_AGG_COLUMN 166
154760 #define TK_TRUEFALSE 167
154761 #define TK_ISNOT 168
154762 #define TK_FUNCTION 169
154763 #define TK_UMINUS 170
154764 #define TK_UPLUS 171
154765 #define TK_TRUTH 172
154766 #define TK_REGISTER 173
154767 #define TK_VECTOR 174
154768 #define TK_SELECT_COLUMN 175
154769 #define TK_IF_NULL_ROW 176
154770 #define TK_ASTERISK 177
154771 #define TK_SPAN 178
154772 #define TK_SPACE 179
154773 #define TK_ILLEGAL 180
154774 #endif
154775 /**************** End token definitions ***************************************/
154776
154777 /* The next sections is a series of control #defines.
154778 ** various aspects of the generated parser.
154779 ** YYCODETYPE is the data type used to store the integer codes
154780 ** that represent terminal and non-terminal symbols.
@@ -155509,10 +155776,11 @@
155776 };
155777 typedef struct yyParser yyParser;
155778
155779 #ifndef NDEBUG
155780 /* #include <stdio.h> */
155781 /* #include <assert.h> */
155782 static FILE *yyTraceFILE = 0;
155783 static char *yyTracePrompt = 0;
155784 #endif /* NDEBUG */
155785
155786 #ifndef NDEBUG
@@ -157776,11 +158044,11 @@
158044 case 38: /* ccons ::= UNIQUE onconf */
158045 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0,
158046 SQLITE_IDXTYPE_UNIQUE);}
158047 break;
158048 case 39: /* ccons ::= CHECK LP expr RP */
158049 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
158050 break;
158051 case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
158052 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy242,yymsp[0].minor.yy192);}
158053 break;
158054 case 41: /* ccons ::= defer_subclause */
@@ -157855,11 +158123,11 @@
158123 case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
158124 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0,
158125 SQLITE_IDXTYPE_UNIQUE);}
158126 break;
158127 case 68: /* tcons ::= CHECK LP expr RP onconf */
158128 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
158129 break;
158130 case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
158131 {
158132 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy192);
158133 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy192);
@@ -164932,11 +165200,13 @@
165200 if( iNew>=0 && iNew<=255 ){
165201 sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
165202 }
165203 rc = SQLITE_OK;
165204 }else{
165205 int nSave = db->busyHandler.nBusy;
165206 rc = sqlite3OsFileControl(fd, op, pArg);
165207 db->busyHandler.nBusy = nSave;
165208 }
165209 sqlite3BtreeLeave(pBtree);
165210 }
165211 sqlite3_mutex_leave(db->mutex);
165212 return rc;
@@ -165315,10 +165585,29 @@
165585 case SQLITE_TESTCTRL_RESULT_INTREAL: {
165586 sqlite3_context *pCtx = va_arg(ap, sqlite3_context*);
165587 sqlite3ResultIntReal(pCtx);
165588 break;
165589 }
165590
165591 /* sqlite3_test_control(SQLITE_TESTCTRL_SEEK_COUNT,
165592 ** sqlite3 *db, // Database connection
165593 ** u64 *pnSeek // Write seek count here
165594 ** );
165595 **
165596 ** This test-control queries the seek-counter on the "main" database
165597 ** file. The seek-counter is written into *pnSeek and is then reset.
165598 ** The seek-count is only available if compiled with SQLITE_DEBUG.
165599 */
165600 case SQLITE_TESTCTRL_SEEK_COUNT: {
165601 sqlite3 *db = va_arg(ap, sqlite3*);
165602 u64 *pn = va_arg(ap, sqlite3_uint64*);
165603 *pn = sqlite3BtreeSeekCount(db->aDb->pBt);
165604 (void)db; /* Silence harmless unused variable warning */
165605 break;
165606 }
165607
165608
165609 }
165610 va_end(ap);
165611 #endif /* SQLITE_UNTESTABLE */
165612 return rc;
165613 }
@@ -209457,10 +209746,12 @@
209746 #define FTS5_CARET 12
209747 #define FTS5_COMMA 13
209748 #define FTS5_PLUS 14
209749 #define FTS5_STAR 15
209750
209751 /* This file is automatically generated by Lemon from input grammar
209752 ** source file "fts5parse.y". */
209753 /*
209754 ** 2000-05-29
209755 **
209756 ** The author disclaims copyright to this source code. In place of
209757 ** a legal notice, here is a blessing:
@@ -209481,12 +209772,10 @@
209772 ** source file.
209773 **
209774 ** The following is the concatenation of all %include directives from the
209775 ** input grammar file:
209776 */
 
 
209777 /************ Begin %include sections from the grammar ************************/
209778
209779 /* #include "fts5Int.h" */
209780 /* #include "fts5parse.h" */
209781
@@ -209512,15 +209801,30 @@
209801 ** into sqlite3ParserAlloc(). The default is size_t.
209802 */
209803 #define fts5YYMALLOCARGTYPE u64
209804
209805 /**************** End of %include directives **********************************/
209806 /* These constants specify the various numeric values for terminal symbols.
209807 ***************** Begin token definitions *************************************/
209808 #ifndef FTS5_OR
209809 #define FTS5_OR 1
209810 #define FTS5_AND 2
209811 #define FTS5_NOT 3
209812 #define FTS5_TERM 4
209813 #define FTS5_COLON 5
209814 #define FTS5_MINUS 6
209815 #define FTS5_LCP 7
209816 #define FTS5_RCP 8
209817 #define FTS5_STRING 9
209818 #define FTS5_LP 10
209819 #define FTS5_RP 11
209820 #define FTS5_CARET 12
209821 #define FTS5_COMMA 13
209822 #define FTS5_PLUS 14
209823 #define FTS5_STAR 15
209824 #endif
209825 /**************** End token definitions ***************************************/
209826
209827 /* The next sections is a series of control #defines.
209828 ** various aspects of the generated parser.
209829 ** fts5YYCODETYPE is the data type used to store the integer codes
209830 ** that represent terminal and non-terminal symbols.
@@ -209799,10 +210103,11 @@
210103 };
210104 typedef struct fts5yyParser fts5yyParser;
210105
210106 #ifndef NDEBUG
210107 /* #include <stdio.h> */
210108 /* #include <assert.h> */
210109 static FILE *fts5yyTraceFILE = 0;
210110 static char *fts5yyTracePrompt = 0;
210111 #endif /* NDEBUG */
210112
210113 #ifndef NDEBUG
@@ -215412,12 +215717,21 @@
215717 Fts5ExprNearset *pNear = pExpr->pNear;
215718 int i;
215719 int iTerm;
215720
215721 if( pNear->pColset ){
215722 int ii;
215723 Fts5Colset *pColset = pNear->pColset;
215724 if( pColset->nCol>1 ) zRet = fts5PrintfAppend(zRet, "{");
215725 for(ii=0; ii<pColset->nCol; ii++){
215726 zRet = fts5PrintfAppend(zRet, "%s%s",
215727 pConfig->azCol[pColset->aiCol[ii]], ii==pColset->nCol-1 ? "" : " "
215728 );
215729 }
215730 if( zRet ){
215731 zRet = fts5PrintfAppend(zRet, "%s : ", pColset->nCol>1 ? "}" : "");
215732 }
215733 if( zRet==0 ) return 0;
215734 }
215735
215736 if( pNear->nPhrase>1 ){
215737 zRet = fts5PrintfAppend(zRet, "NEAR(");
@@ -225836,11 +226150,11 @@
226150 int nArg, /* Number of args */
226151 sqlite3_value **apUnused /* Function arguments */
226152 ){
226153 assert( nArg==0 );
226154 UNUSED_PARAM2(nArg, apUnused);
226155 sqlite3_result_text(pCtx, "fts5: 2020-09-11 15:01:49 b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38", -1, SQLITE_TRANSIENT);
226156 }
226157
226158 /*
226159 ** Return true if zName is the extension on one of the shadow tables used
226160 ** by this module.
@@ -226399,13 +226713,20 @@
226713 ctx.szCol = 0;
226714 rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT,
226715 zText, nText, (void*)&ctx, fts5StorageInsertCallback
226716 );
226717 p->aTotalSize[iCol-1] -= (i64)ctx.szCol;
226718 if( p->aTotalSize[iCol-1]<0 ){
226719 rc = FTS5_CORRUPT;
226720 }
226721 }
226722 }
226723 if( rc==SQLITE_OK && p->nTotalRow<1 ){
226724 rc = FTS5_CORRUPT;
226725 }else{
226726 p->nTotalRow--;
226727 }
226728
226729 rc2 = sqlite3_reset(pSeek);
226730 if( rc==SQLITE_OK ) rc = rc2;
226731 return rc;
226732 }
@@ -230619,12 +230940,12 @@
230940 }
230941 #endif /* SQLITE_CORE */
230942 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
230943
230944 /************** End of stmt.c ************************************************/
230945 #if __LINE__!=230945
230946 #undef SQLITE_SOURCE_ID
230947 #define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e245alt2"
230948 #endif
230949 /* Return the source-id for this library */
230950 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
230951 /************************** End of sqlite3.c ******************************/
230952
+3 -2
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.34.0"
127127
#define SQLITE_VERSION_NUMBER 3034000
128
-#define SQLITE_SOURCE_ID "2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492"
128
+#define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -6197,11 +6197,11 @@
61976197
** <ol>
61986198
** <li value="0"> SQLITE_TXN_NONE
61996199
** <li value="1"> SQLITE_TXN_READ
62006200
** <li value="2"> SQLITE_TXN_WRITE
62016201
** </ol>
6202
-** ^If the S argument to sqlite3_txn_state(D,S) is in the name of
6202
+** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
62036203
** a valid schema, then -1 is returned.
62046204
*/
62056205
SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
62066206
62076207
/*
@@ -7737,10 +7737,11 @@
77377737
*/
77387738
#define SQLITE_TESTCTRL_FIRST 5
77397739
#define SQLITE_TESTCTRL_PRNG_SAVE 5
77407740
#define SQLITE_TESTCTRL_PRNG_RESTORE 6
77417741
#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
7742
+#define SQLITE_TESTCTRL_SEEK_COUNT 7
77427743
#define SQLITE_TESTCTRL_BITVEC_TEST 8
77437744
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
77447745
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
77457746
#define SQLITE_TESTCTRL_PENDING_BYTE 11
77467747
#define SQLITE_TESTCTRL_ASSERT 12
77477748
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.34.0"
127 #define SQLITE_VERSION_NUMBER 3034000
128 #define SQLITE_SOURCE_ID "2020-08-26 10:50:48 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -6197,11 +6197,11 @@
6197 ** <ol>
6198 ** <li value="0"> SQLITE_TXN_NONE
6199 ** <li value="1"> SQLITE_TXN_READ
6200 ** <li value="2"> SQLITE_TXN_WRITE
6201 ** </ol>
6202 ** ^If the S argument to sqlite3_txn_state(D,S) is in the name of
6203 ** a valid schema, then -1 is returned.
6204 */
6205 SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
6206
6207 /*
@@ -7737,10 +7737,11 @@
7737 */
7738 #define SQLITE_TESTCTRL_FIRST 5
7739 #define SQLITE_TESTCTRL_PRNG_SAVE 5
7740 #define SQLITE_TESTCTRL_PRNG_RESTORE 6
7741 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
 
7742 #define SQLITE_TESTCTRL_BITVEC_TEST 8
7743 #define SQLITE_TESTCTRL_FAULT_INSTALL 9
7744 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
7745 #define SQLITE_TESTCTRL_PENDING_BYTE 11
7746 #define SQLITE_TESTCTRL_ASSERT 12
7747
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.34.0"
127 #define SQLITE_VERSION_NUMBER 3034000
128 #define SQLITE_SOURCE_ID "2020-09-15 20:48:30 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -6197,11 +6197,11 @@
6197 ** <ol>
6198 ** <li value="0"> SQLITE_TXN_NONE
6199 ** <li value="1"> SQLITE_TXN_READ
6200 ** <li value="2"> SQLITE_TXN_WRITE
6201 ** </ol>
6202 ** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
6203 ** a valid schema, then -1 is returned.
6204 */
6205 SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
6206
6207 /*
@@ -7737,10 +7737,11 @@
7737 */
7738 #define SQLITE_TESTCTRL_FIRST 5
7739 #define SQLITE_TESTCTRL_PRNG_SAVE 5
7740 #define SQLITE_TESTCTRL_PRNG_RESTORE 6
7741 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
7742 #define SQLITE_TESTCTRL_SEEK_COUNT 7
7743 #define SQLITE_TESTCTRL_BITVEC_TEST 8
7744 #define SQLITE_TESTCTRL_FAULT_INSTALL 9
7745 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
7746 #define SQLITE_TESTCTRL_PENDING_BYTE 11
7747 #define SQLITE_TESTCTRL_ASSERT 12
7748

Keyboard Shortcuts

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