Fossil SCM

Merge trunk into forumpost-locking branch.

stephan 2023-06-03 08:49 UTC forumpost-locking merge
Commit 8e7de26aa2680f225080590781f5e2d6d82f99cd27cfdb8fd51aa5539a97ac9e
123 files changed +20 -20 +1 -1 +957 -939 +17 -15 +594 -151 +2977 -1365 +80 -48 +6 -1 +5 +5 +19 -3 +14 -14 +14 -14 +87 +2 -2 +1 -1 +3 -3 +3 -1 +5 -3 +5 -3 +2 -2 +405 -65 +405 -65 +5 +5 +1 -1 +1 -1 +3 -3 +10 -10 +10 -10 +1 +43 +2 -2 +106 -29 +106 -29 +10 -9 +32 -33 +1 -1 +19 -19 +63 -37 +1 -1 +3 -3 +6 -19 +6 -4 +4 -4 +29 -9 +16 -16 +109 -15 +141 -124 +141 -124 +40 -40 +15 -15 +11 -11 +1 -1 +146 -77 +33 -33 +1 -1 +1 -1 +5 -5 +21 +13 +24 -24 +43 -10 +23 -18 +23 -18 +31 -32 +5 -13 +1 -1 +3 +18 -18 +18 -18 +12 -10 +1 -1 +13 -3 +6 -6 +5 -5 +15 -9 +1 -4 +2 -2 +25 -24 +1 -1 +5 -4 +1 -1 +56 -47 +52 -17 +22 -24 +184 -196 +22 -24 +14 -14 +1 -1 +38 -44 +6 -5 +1 -1 +1 -1 +60 -35 +27 -27 +70 -72 +168 -40 +63 -46 +19 -20 +7 -7 +52 -59 +1 -3 +2 -2 +1 -3 +68 -71 +18 -18 +122 -143 +2 -2 +3 -2 +4 -4 +66 -33 +9 -10 +2 -2 +22 -12 +2 -2 +49 -50 +14 -11 +191 -200 +42 -27 +10 -5
~ Dockerfile ~ VERSION ~ extsrc/pikchr.c ~ extsrc/pikchr.js ~ extsrc/pikchr.wasm ~ extsrc/shell.c ~ extsrc/sqlite3.c ~ extsrc/sqlite3.h ~ skins/ardoise/css.txt ~ skins/eagle/css.txt ~ skins/xekri/css.txt ~ src/alerts.c ~ src/attach.c ~ src/attach.c ~ src/blob.c ~ src/browse.c ~ src/cache.c ~ src/captcha.c ~ src/cgi.c ~ src/checkin.c ~ src/checkin.c ~ src/color.c ~ src/db.c ~ src/db.c ~ src/default.css ~ src/default.css ~ src/descendants.c ~ src/diff.c ~ src/dispatch.c ~ src/event.c ~ src/event.c ~ src/extcgi.c ~ src/file.c ~ src/finfo.c ~ src/forum.c ~ src/forum.c ~ src/glob.c ~ src/info.c ~ src/loadctrl.c ~ src/login.c ~ src/main.c ~ src/main.mk ~ src/markdown_html.c ~ src/merge.c ~ src/patch.c ~ src/piechart.c ~ src/repolist.c ~ src/report.c ~ src/search.c ~ src/setup.c ~ src/setup.c ~ src/setupuser.c ~ src/shun.c ~ src/skins.c ~ src/sqlcmd.c ~ src/statrep.c ~ src/style.c ~ src/tag.c ~ src/tag.c ~ src/tar.c ~ src/th.c ~ src/th.h ~ src/th_main.c ~ src/timeline.c ~ src/tkt.c ~ src/tkt.c ~ src/tktsetup.c ~ src/update.c ~ src/user.c ~ src/vfile.c ~ src/wiki.c ~ src/wiki.c ~ src/wikiformat.c ~ src/winhttp.c ~ src/xfer.c ~ src/xfersetup.c ~ src/zip.c ~ tools/makemake.tcl ~ tools/mkindex.c ~ win/Makefile.mingw.mistachkin ~ win/Makefile.msc ~ www/aboutcgi.wiki ~ www/adding_code.wiki ~ www/alerts.md ~ www/blockchain.md ~ www/build.wiki ~ www/changes.wiki ~ www/concepts.wiki ~ www/containers.md ~ www/custom_ticket.wiki ~ www/customskin.md ~ www/delta_encoder_algorithm.wiki ~ www/delta_format.wiki ~ www/encryptedrepos.wiki ~ www/faq.tcl ~ www/faq.wiki ~ www/fiveminutes.wiki ~ www/foss-cklist.wiki ~ www/fossil-v-git.wiki ~ www/gitusers.md ~ www/globs.md ~ www/image-format-vs-repo-size.md ~ www/index.wiki ~ www/mirrortogithub.md ~ www/mkindex.tcl ~ www/newrepo.wiki ~ www/permutedindex.html ~ www/pop.wiki ~ www/qandc.wiki ~ www/quickstart.wiki ~ www/quotes.wiki ~ www/rebaseharm.md ~ www/server/any/althttpd.md ~ www/server/debian/nginx.md ~ www/server/debian/service.md ~ www/server/index.html ~ www/server/whyuseaserver.wiki ~ www/settings.wiki ~ www/shunning.wiki ~ www/ssl.wiki ~ www/sync.wiki ~ www/unvers.wiki ~ www/wikitheory.wiki
+20 -20
--- Dockerfile
+++ Dockerfile
@@ -8,12 +8,12 @@
88
### We aren't pinning to a more stable version of Alpine because we want
99
### to build with the latest tools and libraries available in case they
1010
### fixed something that matters to us since the last build. Everything
1111
### below depends on this layer, and so, alas, we toss this container's
1212
### cache on Alpine's release schedule, roughly once a month.
13
-FROM alpine:latest AS builder
14
-WORKDIR /tmp
13
+FROM alpine:latest AS bld
14
+WORKDIR /fsl
1515
1616
### Bake the basic Alpine Linux into a base layer so it only changes
1717
### when the upstream image is updated or we change the package set.
1818
RUN set -x \
1919
&& apk update \
@@ -35,17 +35,17 @@
3535
### by leveraging its DVCS nature via the "tarball" command and passing
3636
### the resulting file's name in.
3737
ARG FSLCFG=""
3838
ARG FSLVER="trunk"
3939
ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
40
-ENV FSLSTB=/tmp/fsl/src.tar.gz
40
+ENV FSLSTB=/fsl/src.tar.gz
4141
ADD $FSLURL $FSLSTB
4242
RUN set -x \
43
- && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
44
- else tar -C fsl -xzf fsl/src.tar.gz ; fi \
45
- && m=fsl/src/src/main.mk \
46
- && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11
43
+ && if [ -d $FSLSTB ] ; \
44
+ then mv $FSLSTB/src . ; \
45
+ else tar -xf src.tar.gz ; fi \
46
+ && src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j16
4747
4848
4949
## ---------------------------------------------------------------------
5050
## STAGE 2: Pare that back to the bare essentials.
5151
## ---------------------------------------------------------------------
@@ -54,28 +54,28 @@
5454
ARG UID=499
5555
5656
### Set up that base OS for our specific use without tying it to
5757
### anything likely to change often. So long as the user leaves
5858
### UID alone, this layer will be durable.
59
-RUN set -x \
60
- && mkdir log museum \
61
- && echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \
62
- && echo "root:x:0:root" > /tmp/group \
63
- && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \
64
- && echo "fossil:x:${UID}:fossil" >> /tmp/group
59
+RUN set -x \
60
+ && mkdir e log museum \
61
+ && echo "root:x:0:0:Admin:/:/false" > /e/passwd \
62
+ && echo "root:x:0:root" > /e/group \
63
+ && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /e/passwd \
64
+ && echo "fossil:x:${UID}:fossil" >> /e/group
6565
6666
6767
## ---------------------------------------------------------------------
6868
## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
6969
## ---------------------------------------------------------------------
7070
7171
FROM scratch AS run
72
-COPY --from=os /tmp/group /tmp/passwd /etc/
73
-COPY --from=os --chown=fossil:fossil /log /log/
74
-COPY --from=os --chown=fossil:fossil /museum /museum/
75
-COPY --from=os --chmod=1777 /tmp /tmp/
76
-COPY --from=builder /tmp/fossil /bin/
72
+COPY --from=bld --chmod=755 /fsl/fossil /bin/
73
+COPY --from=os --chmod=600 /e/* /etc/
74
+COPY --from=os --chmod=1777 /tmp /tmp/
75
+COPY --from=os --chown=fossil:fossil /log /log/
76
+COPY --from=os --chown=fossil:fossil /museum /museum/
7777
7878
7979
## ---------------------------------------------------------------------
8080
## RUN!
8181
## ---------------------------------------------------------------------
@@ -82,9 +82,9 @@
8282
8383
ENV PATH "/bin"
8484
EXPOSE 8080/tcp
8585
USER fossil
8686
ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
87
-CMD [ \
87
+CMD [ \
8888
"--create", \
8989
"--jsmode", "bundled", \
90
- "--user", "admin" ]
90
+ "--user", "admin" ]
9191
--- Dockerfile
+++ Dockerfile
@@ -8,12 +8,12 @@
8 ### We aren't pinning to a more stable version of Alpine because we want
9 ### to build with the latest tools and libraries available in case they
10 ### fixed something that matters to us since the last build. Everything
11 ### below depends on this layer, and so, alas, we toss this container's
12 ### cache on Alpine's release schedule, roughly once a month.
13 FROM alpine:latest AS builder
14 WORKDIR /tmp
15
16 ### Bake the basic Alpine Linux into a base layer so it only changes
17 ### when the upstream image is updated or we change the package set.
18 RUN set -x \
19 && apk update \
@@ -35,17 +35,17 @@
35 ### by leveraging its DVCS nature via the "tarball" command and passing
36 ### the resulting file's name in.
37 ARG FSLCFG=""
38 ARG FSLVER="trunk"
39 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
40 ENV FSLSTB=/tmp/fsl/src.tar.gz
41 ADD $FSLURL $FSLSTB
42 RUN set -x \
43 && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
44 else tar -C fsl -xzf fsl/src.tar.gz ; fi \
45 && m=fsl/src/src/main.mk \
46 && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11
47
48
49 ## ---------------------------------------------------------------------
50 ## STAGE 2: Pare that back to the bare essentials.
51 ## ---------------------------------------------------------------------
@@ -54,28 +54,28 @@
54 ARG UID=499
55
56 ### Set up that base OS for our specific use without tying it to
57 ### anything likely to change often. So long as the user leaves
58 ### UID alone, this layer will be durable.
59 RUN set -x \
60 && mkdir log museum \
61 && echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \
62 && echo "root:x:0:root" > /tmp/group \
63 && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \
64 && echo "fossil:x:${UID}:fossil" >> /tmp/group
65
66
67 ## ---------------------------------------------------------------------
68 ## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
69 ## ---------------------------------------------------------------------
70
71 FROM scratch AS run
72 COPY --from=os /tmp/group /tmp/passwd /etc/
73 COPY --from=os --chown=fossil:fossil /log /log/
74 COPY --from=os --chown=fossil:fossil /museum /museum/
75 COPY --from=os --chmod=1777 /tmp /tmp/
76 COPY --from=builder /tmp/fossil /bin/
77
78
79 ## ---------------------------------------------------------------------
80 ## RUN!
81 ## ---------------------------------------------------------------------
@@ -82,9 +82,9 @@
82
83 ENV PATH "/bin"
84 EXPOSE 8080/tcp
85 USER fossil
86 ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
87 CMD [ \
88 "--create", \
89 "--jsmode", "bundled", \
90 "--user", "admin" ]
91
--- Dockerfile
+++ Dockerfile
@@ -8,12 +8,12 @@
8 ### We aren't pinning to a more stable version of Alpine because we want
9 ### to build with the latest tools and libraries available in case they
10 ### fixed something that matters to us since the last build. Everything
11 ### below depends on this layer, and so, alas, we toss this container's
12 ### cache on Alpine's release schedule, roughly once a month.
13 FROM alpine:latest AS bld
14 WORKDIR /fsl
15
16 ### Bake the basic Alpine Linux into a base layer so it only changes
17 ### when the upstream image is updated or we change the package set.
18 RUN set -x \
19 && apk update \
@@ -35,17 +35,17 @@
35 ### by leveraging its DVCS nature via the "tarball" command and passing
36 ### the resulting file's name in.
37 ARG FSLCFG=""
38 ARG FSLVER="trunk"
39 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
40 ENV FSLSTB=/fsl/src.tar.gz
41 ADD $FSLURL $FSLSTB
42 RUN set -x \
43 && if [ -d $FSLSTB ] ; \
44 then mv $FSLSTB/src . ; \
45 else tar -xf src.tar.gz ; fi \
46 && src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j16
47
48
49 ## ---------------------------------------------------------------------
50 ## STAGE 2: Pare that back to the bare essentials.
51 ## ---------------------------------------------------------------------
@@ -54,28 +54,28 @@
54 ARG UID=499
55
56 ### Set up that base OS for our specific use without tying it to
57 ### anything likely to change often. So long as the user leaves
58 ### UID alone, this layer will be durable.
59 RUN set -x \
60 && mkdir e log museum \
61 && echo "root:x:0:0:Admin:/:/false" > /e/passwd \
62 && echo "root:x:0:root" > /e/group \
63 && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /e/passwd \
64 && echo "fossil:x:${UID}:fossil" >> /e/group
65
66
67 ## ---------------------------------------------------------------------
68 ## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
69 ## ---------------------------------------------------------------------
70
71 FROM scratch AS run
72 COPY --from=bld --chmod=755 /fsl/fossil /bin/
73 COPY --from=os --chmod=600 /e/* /etc/
74 COPY --from=os --chmod=1777 /tmp /tmp/
75 COPY --from=os --chown=fossil:fossil /log /log/
76 COPY --from=os --chown=fossil:fossil /museum /museum/
77
78
79 ## ---------------------------------------------------------------------
80 ## RUN!
81 ## ---------------------------------------------------------------------
@@ -82,9 +82,9 @@
82
83 ENV PATH "/bin"
84 EXPOSE 8080/tcp
85 USER fossil
86 ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
87 CMD [ \
88 "--create", \
89 "--jsmode", "bundled", \
90 "--user", "admin" ]
91
+1 -1
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1
-2.22
1
+2.23
22
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.22
2
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
1 2.23
2
+957 -939
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -59,11 +59,11 @@
5959
** cc pikchr.c -o pikchr.o
6060
**
6161
** Add -DPIKCHR_SHELL to add a main() routine that reads input files
6262
** and sends them through Pikchr, for testing. Add -DPIKCHR_FUZZ for
6363
** -fsanitizer=fuzzer testing.
64
-**
64
+**
6565
****************************************************************************
6666
** IMPLEMENTATION NOTES (for people who want to understand the internal
6767
** operation of this software, perhaps to extend the code or to fix bugs):
6868
**
6969
** Each call to pikchr() uses a single instance of the Pik structure to
@@ -203,12 +203,13 @@
203203
#define TP_SMALL 0x0200 /* Smaller font */
204204
#define TP_XTRA 0x0400 /* Amplify TP_BIG or TP_SMALL */
205205
#define TP_SZMASK 0x0700 /* Font size mask */
206206
#define TP_ITALIC 0x1000 /* Italic font */
207207
#define TP_BOLD 0x2000 /* Bold font */
208
-#define TP_FMASK 0x3000 /* Mask for font style */
209
-#define TP_ALIGN 0x4000 /* Rotate to align with the line */
208
+#define TP_MONO 0x4000 /* Monospace font family */
209
+#define TP_FMASK 0x7000 /* Mask for font style */
210
+#define TP_ALIGN 0x8000 /* Rotate to align with the line */
210211
211212
/* An object to hold a position in 2-D space */
212213
struct PPoint {
213214
PNum x, y; /* X and Y coordinates */
214215
};
@@ -470,11 +471,11 @@
470471
static void pik_bbox_init(PBox*);
471472
static void pik_bbox_addbox(PBox*,PBox*);
472473
static void pik_bbox_add_xy(PBox*,PNum,PNum);
473474
static void pik_bbox_addellipse(PBox*,PNum x,PNum y,PNum rx,PNum ry);
474475
static void pik_add_txt(Pik*,PToken*,int);
475
-static int pik_text_length(const PToken *pToken);
476
+static int pik_text_length(const PToken *pToken, const int isMonospace);
476477
static void pik_size_to_fit(Pik*,PToken*,int);
477478
static int pik_text_position(int,PToken*);
478479
static PNum pik_property_of(PObj*,PToken*);
479480
static PNum pik_func(Pik*,PToken*,PNum,PNum);
480481
static PPoint pik_position_between(PNum x, PPoint p1, PPoint p2);
@@ -489,11 +490,11 @@
489490
static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*);
490491
static PNum pik_dist(PPoint*,PPoint*);
491492
static void pik_add_macro(Pik*,PToken *pId,PToken *pCode);
492493
493494
494
-#line 520 "pikchr.c"
495
+#line 521 "pikchr.c"
495496
/**************** End of %include directives **********************************/
496497
/* These constants specify the various numeric values for terminal symbols.
497498
***************** Begin token definitions *************************************/
498499
#ifndef T_ID
499500
#define T_ID 1
@@ -564,38 +565,39 @@
564565
#define T_RJUST 66
565566
#define T_ABOVE 67
566567
#define T_BELOW 68
567568
#define T_ITALIC 69
568569
#define T_BOLD 70
569
-#define T_ALIGNED 71
570
-#define T_BIG 72
571
-#define T_SMALL 73
572
-#define T_AND 74
573
-#define T_LT 75
574
-#define T_GT 76
575
-#define T_ON 77
576
-#define T_WAY 78
577
-#define T_BETWEEN 79
578
-#define T_THE 80
579
-#define T_NTH 81
580
-#define T_VERTEX 82
581
-#define T_TOP 83
582
-#define T_BOTTOM 84
583
-#define T_START 85
584
-#define T_END 86
585
-#define T_IN 87
586
-#define T_THIS 88
587
-#define T_DOT_U 89
588
-#define T_LAST 90
589
-#define T_NUMBER 91
590
-#define T_FUNC1 92
591
-#define T_FUNC2 93
592
-#define T_DIST 94
593
-#define T_DOT_XY 95
594
-#define T_X 96
595
-#define T_Y 97
596
-#define T_DOT_L 98
570
+#define T_MONO 71
571
+#define T_ALIGNED 72
572
+#define T_BIG 73
573
+#define T_SMALL 74
574
+#define T_AND 75
575
+#define T_LT 76
576
+#define T_GT 77
577
+#define T_ON 78
578
+#define T_WAY 79
579
+#define T_BETWEEN 80
580
+#define T_THE 81
581
+#define T_NTH 82
582
+#define T_VERTEX 83
583
+#define T_TOP 84
584
+#define T_BOTTOM 85
585
+#define T_START 86
586
+#define T_END 87
587
+#define T_IN 88
588
+#define T_THIS 89
589
+#define T_DOT_U 90
590
+#define T_LAST 91
591
+#define T_NUMBER 92
592
+#define T_FUNC1 93
593
+#define T_FUNC2 94
594
+#define T_DIST 95
595
+#define T_DOT_XY 96
596
+#define T_X 97
597
+#define T_Y 98
598
+#define T_DOT_L 99
597599
#endif
598600
/**************** End token definitions ***************************************/
599601
600602
/* The next sections is a series of control #defines.
601603
** various aspects of the generated parser.
@@ -651,22 +653,22 @@
651653
#ifndef INTERFACE
652654
# define INTERFACE 1
653655
#endif
654656
/************* Begin control #defines *****************************************/
655657
#define YYCODETYPE unsigned char
656
-#define YYNOCODE 135
658
+#define YYNOCODE 136
657659
#define YYACTIONTYPE unsigned short int
658660
#define pik_parserTOKENTYPE PToken
659661
typedef union {
660662
int yyinit;
661663
pik_parserTOKENTYPE yy0;
662
- PRel yy10;
663
- PObj* yy36;
664
- PPoint yy79;
665
- PNum yy153;
666
- short int yy164;
667
- PList* yy227;
664
+ PNum yy21;
665
+ PPoint yy63;
666
+ PRel yy72;
667
+ PObj* yy162;
668
+ short int yy188;
669
+ PList* yy235;
668670
} YYMINORTYPE;
669671
#ifndef YYSTACKDEPTH
670672
#define YYSTACKDEPTH 100
671673
#endif
672674
#define pik_parserARG_SDECL
@@ -681,11 +683,11 @@
681683
#define pik_parserCTX_STORE yypParser->p=p;
682684
#define YYFALLBACK 1
683685
#define YYNSTATE 164
684686
#define YYNRULE 156
685687
#define YYNRULE_WITH_ACTION 116
686
-#define YYNTOKEN 99
688
+#define YYNTOKEN 100
687689
#define YY_MAX_SHIFT 163
688690
#define YY_MIN_SHIFTREDUCE 287
689691
#define YY_MAX_SHIFTREDUCE 442
690692
#define YY_ERROR_ACTION 443
691693
#define YY_ACCEPT_ACTION 444
@@ -756,322 +758,324 @@
756758
** yy_reduce_ofst[] For each state, the offset into yy_action for
757759
** shifting non-terminals after a reduce.
758760
** yy_default[] Default action for each state.
759761
**
760762
*********** Begin parsing tables **********************************************/
761
-#define YY_ACTTAB_COUNT (1303)
763
+#define YY_ACTTAB_COUNT (1313)
762764
static const YYACTIONTYPE yy_action[] = {
763765
/* 0 */ 575, 495, 161, 119, 25, 452, 29, 74, 129, 148,
764766
/* 10 */ 575, 492, 161, 119, 453, 113, 120, 161, 119, 530,
765767
/* 20 */ 427, 428, 339, 559, 81, 30, 560, 561, 575, 64,
766768
/* 30 */ 63, 62, 61, 322, 323, 9, 8, 33, 149, 32,
767769
/* 40 */ 7, 71, 127, 38, 335, 66, 48, 37, 28, 339,
768770
/* 50 */ 339, 339, 339, 425, 426, 340, 341, 342, 343, 344,
769771
/* 60 */ 345, 346, 347, 348, 474, 528, 161, 119, 577, 77,
770
- /* 70 */ 577, 73, 376, 148, 474, 533, 161, 119, 112, 113,
771
- /* 80 */ 120, 161, 119, 128, 427, 428, 339, 357, 81, 531,
772
- /* 90 */ 161, 119, 474, 36, 330, 13, 306, 322, 323, 9,
772
+ /* 70 */ 577, 73, 306, 148, 474, 533, 161, 119, 112, 113,
773
+ /* 80 */ 120, 161, 119, 128, 427, 428, 339, 31, 81, 531,
774
+ /* 90 */ 161, 119, 474, 35, 330, 378, 158, 322, 323, 9,
773775
/* 100 */ 8, 33, 149, 32, 7, 71, 127, 328, 335, 66,
774
- /* 110 */ 579, 310, 31, 339, 339, 339, 339, 425, 426, 340,
776
+ /* 110 */ 579, 378, 158, 339, 339, 339, 339, 425, 426, 340,
775777
/* 120 */ 341, 342, 343, 344, 345, 346, 347, 348, 394, 435,
776
- /* 130 */ 46, 59, 60, 64, 63, 62, 61, 54, 51, 376,
777
- /* 140 */ 69, 108, 2, 47, 403, 83, 297, 435, 375, 84,
778
- /* 150 */ 117, 80, 35, 308, 79, 133, 122, 126, 441, 440,
779
- /* 160 */ 299, 123, 3, 404, 405, 406, 408, 80, 298, 308,
780
- /* 170 */ 79, 4, 411, 412, 413, 414, 441, 440, 350, 350,
781
- /* 180 */ 350, 350, 350, 350, 350, 350, 350, 350, 62, 61,
782
- /* 190 */ 67, 434, 1, 75, 378, 158, 74, 76, 148, 411,
783
- /* 200 */ 412, 413, 414, 124, 113, 120, 161, 119, 106, 434,
784
- /* 210 */ 436, 437, 438, 439, 5, 375, 6, 117, 393, 155,
785
- /* 220 */ 154, 153, 394, 435, 69, 59, 60, 149, 436, 437,
786
- /* 230 */ 438, 439, 535, 376, 398, 399, 2, 424, 427, 428,
787
- /* 240 */ 339, 156, 156, 156, 423, 394, 435, 65, 59, 60,
788
- /* 250 */ 162, 131, 441, 440, 397, 72, 376, 148, 118, 2,
789
- /* 260 */ 380, 157, 125, 113, 120, 161, 119, 339, 339, 339,
790
- /* 270 */ 339, 425, 426, 535, 11, 441, 440, 394, 356, 535,
791
- /* 280 */ 59, 60, 535, 379, 159, 434, 149, 12, 102, 446,
792
- /* 290 */ 432, 42, 138, 14, 435, 139, 301, 302, 303, 36,
793
- /* 300 */ 305, 430, 106, 16, 436, 437, 438, 439, 434, 375,
794
- /* 310 */ 18, 117, 393, 155, 154, 153, 44, 142, 140, 64,
795
- /* 320 */ 63, 62, 61, 441, 440, 106, 19, 436, 437, 438,
796
- /* 330 */ 439, 45, 375, 20, 117, 393, 155, 154, 153, 68,
797
- /* 340 */ 55, 114, 64, 63, 62, 61, 147, 146, 394, 473,
798
- /* 350 */ 359, 59, 60, 43, 23, 391, 434, 106, 26, 376,
799
- /* 360 */ 57, 58, 42, 49, 375, 392, 117, 393, 155, 154,
800
- /* 370 */ 153, 64, 63, 62, 61, 436, 437, 438, 439, 384,
801
- /* 380 */ 382, 383, 22, 21, 377, 473, 160, 70, 39, 445,
802
- /* 390 */ 24, 445, 145, 141, 431, 142, 140, 64, 63, 62,
803
- /* 400 */ 61, 394, 15, 445, 59, 60, 64, 63, 62, 61,
804
- /* 410 */ 391, 445, 376, 445, 445, 42, 445, 445, 55, 391,
805
- /* 420 */ 156, 156, 156, 445, 147, 146, 445, 52, 106, 445,
806
- /* 430 */ 445, 43, 445, 445, 445, 375, 445, 117, 393, 155,
807
- /* 440 */ 154, 153, 445, 394, 143, 445, 59, 60, 64, 63,
808
- /* 450 */ 62, 61, 313, 445, 376, 378, 158, 42, 445, 445,
809
- /* 460 */ 22, 21, 121, 447, 454, 29, 445, 445, 24, 450,
810
- /* 470 */ 145, 141, 431, 142, 140, 64, 63, 62, 61, 445,
811
- /* 480 */ 163, 106, 445, 445, 444, 27, 445, 445, 375, 445,
812
- /* 490 */ 117, 393, 155, 154, 153, 445, 55, 74, 445, 148,
813
- /* 500 */ 445, 445, 147, 146, 497, 113, 120, 161, 119, 43,
814
- /* 510 */ 445, 394, 445, 445, 59, 60, 445, 445, 445, 118,
815
- /* 520 */ 445, 445, 376, 106, 445, 42, 445, 445, 149, 445,
816
- /* 530 */ 375, 445, 117, 393, 155, 154, 153, 445, 22, 21,
817
- /* 540 */ 394, 144, 445, 59, 60, 445, 24, 445, 145, 141,
818
- /* 550 */ 431, 376, 445, 445, 42, 445, 132, 130, 394, 445,
819
- /* 560 */ 445, 59, 60, 109, 447, 454, 29, 445, 445, 376,
820
- /* 570 */ 450, 445, 42, 445, 394, 445, 445, 59, 60, 445,
821
- /* 580 */ 445, 163, 445, 445, 445, 102, 27, 445, 42, 445,
822
- /* 590 */ 445, 106, 445, 64, 63, 62, 61, 445, 375, 445,
823
- /* 600 */ 117, 393, 155, 154, 153, 394, 355, 445, 59, 60,
824
- /* 610 */ 445, 445, 445, 445, 445, 74, 376, 148, 445, 40,
825
- /* 620 */ 106, 445, 496, 113, 120, 161, 119, 375, 445, 117,
826
- /* 630 */ 393, 155, 154, 153, 445, 448, 454, 29, 106, 445,
827
- /* 640 */ 445, 450, 445, 445, 445, 375, 149, 117, 393, 155,
828
- /* 650 */ 154, 153, 163, 445, 106, 445, 445, 27, 445, 445,
829
- /* 660 */ 445, 375, 445, 117, 393, 155, 154, 153, 394, 445,
830
- /* 670 */ 445, 59, 60, 64, 63, 62, 61, 445, 445, 376,
831
- /* 680 */ 445, 445, 41, 445, 445, 106, 354, 64, 63, 62,
832
- /* 690 */ 61, 445, 375, 445, 117, 393, 155, 154, 153, 445,
833
- /* 700 */ 445, 445, 74, 445, 148, 445, 88, 445, 445, 490,
834
- /* 710 */ 113, 120, 161, 119, 445, 120, 161, 119, 17, 74,
835
- /* 720 */ 445, 148, 110, 110, 445, 445, 484, 113, 120, 161,
836
- /* 730 */ 119, 445, 445, 149, 74, 445, 148, 152, 445, 445,
837
- /* 740 */ 445, 483, 113, 120, 161, 119, 445, 445, 106, 445,
838
- /* 750 */ 149, 445, 445, 107, 445, 375, 445, 117, 393, 155,
839
- /* 760 */ 154, 153, 120, 161, 119, 149, 478, 74, 445, 148,
840
- /* 770 */ 445, 88, 445, 445, 480, 113, 120, 161, 119, 445,
841
- /* 780 */ 120, 161, 119, 74, 152, 148, 10, 479, 479, 445,
842
- /* 790 */ 134, 113, 120, 161, 119, 445, 445, 445, 149, 74,
843
- /* 800 */ 445, 148, 152, 445, 445, 445, 517, 113, 120, 161,
844
- /* 810 */ 119, 445, 445, 74, 149, 148, 445, 445, 445, 445,
845
- /* 820 */ 137, 113, 120, 161, 119, 74, 445, 148, 445, 445,
846
- /* 830 */ 149, 445, 525, 113, 120, 161, 119, 445, 74, 445,
847
- /* 840 */ 148, 445, 445, 445, 149, 527, 113, 120, 161, 119,
848
- /* 850 */ 445, 445, 74, 445, 148, 445, 149, 445, 445, 524,
849
- /* 860 */ 113, 120, 161, 119, 74, 445, 148, 445, 445, 149,
850
- /* 870 */ 445, 526, 113, 120, 161, 119, 445, 445, 74, 445,
851
- /* 880 */ 148, 445, 88, 149, 445, 523, 113, 120, 161, 119,
852
- /* 890 */ 445, 120, 161, 119, 74, 149, 148, 85, 111, 111,
853
- /* 900 */ 445, 522, 113, 120, 161, 119, 120, 161, 119, 149,
854
- /* 910 */ 74, 445, 148, 152, 445, 445, 445, 521, 113, 120,
855
- /* 920 */ 161, 119, 445, 445, 74, 149, 148, 445, 152, 445,
856
- /* 930 */ 445, 520, 113, 120, 161, 119, 74, 445, 148, 445,
857
- /* 940 */ 445, 149, 445, 519, 113, 120, 161, 119, 445, 74,
858
- /* 950 */ 445, 148, 445, 445, 445, 149, 150, 113, 120, 161,
859
- /* 960 */ 119, 445, 445, 74, 445, 148, 445, 149, 445, 445,
860
- /* 970 */ 151, 113, 120, 161, 119, 74, 445, 148, 445, 445,
861
- /* 980 */ 149, 445, 136, 113, 120, 161, 119, 445, 445, 74,
862
- /* 990 */ 445, 148, 107, 445, 149, 445, 135, 113, 120, 161,
863
- /* 1000 */ 119, 120, 161, 119, 445, 463, 149, 445, 88, 445,
864
- /* 1010 */ 445, 445, 78, 78, 445, 445, 107, 120, 161, 119,
865
- /* 1020 */ 149, 445, 445, 152, 82, 120, 161, 119, 445, 463,
866
- /* 1030 */ 445, 466, 86, 34, 445, 88, 445, 569, 445, 152,
867
- /* 1040 */ 445, 120, 161, 119, 120, 161, 119, 152, 107, 445,
868
- /* 1050 */ 445, 475, 64, 63, 62, 61, 445, 120, 161, 119,
869
- /* 1060 */ 98, 451, 445, 152, 89, 396, 152, 90, 445, 120,
870
- /* 1070 */ 161, 119, 445, 120, 161, 119, 120, 161, 119, 152,
871
- /* 1080 */ 445, 64, 63, 62, 61, 445, 445, 445, 445, 445,
872
- /* 1090 */ 87, 152, 445, 99, 395, 152, 100, 445, 152, 120,
873
- /* 1100 */ 161, 119, 120, 161, 119, 120, 161, 119, 445, 101,
874
- /* 1110 */ 64, 63, 62, 61, 445, 445, 445, 445, 120, 161,
875
- /* 1120 */ 119, 152, 91, 391, 152, 445, 445, 152, 103, 445,
876
- /* 1130 */ 445, 120, 161, 119, 445, 92, 445, 120, 161, 119,
877
- /* 1140 */ 152, 93, 445, 445, 120, 161, 119, 104, 445, 445,
878
- /* 1150 */ 120, 161, 119, 152, 445, 445, 120, 161, 119, 152,
879
- /* 1160 */ 445, 445, 445, 445, 94, 445, 152, 445, 445, 445,
880
- /* 1170 */ 105, 445, 152, 120, 161, 119, 445, 95, 152, 120,
881
- /* 1180 */ 161, 119, 96, 445, 445, 445, 120, 161, 119, 445,
882
- /* 1190 */ 445, 120, 161, 119, 97, 152, 445, 445, 445, 445,
883
- /* 1200 */ 549, 152, 445, 120, 161, 119, 548, 445, 152, 120,
884
- /* 1210 */ 161, 119, 445, 152, 445, 120, 161, 119, 445, 445,
885
- /* 1220 */ 445, 445, 445, 547, 445, 152, 445, 445, 445, 445,
886
- /* 1230 */ 445, 152, 120, 161, 119, 546, 445, 152, 445, 115,
887
- /* 1240 */ 445, 445, 116, 445, 120, 161, 119, 445, 120, 161,
888
- /* 1250 */ 119, 120, 161, 119, 152, 64, 63, 62, 61, 64,
889
- /* 1260 */ 63, 62, 61, 445, 445, 445, 152, 445, 445, 445,
890
- /* 1270 */ 152, 445, 445, 152, 445, 445, 50, 445, 445, 445,
891
- /* 1280 */ 53, 64, 63, 62, 61, 445, 445, 445, 445, 445,
892
- /* 1290 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
893
- /* 1300 */ 445, 445, 56,
778
+ /* 130 */ 46, 59, 60, 64, 63, 62, 61, 357, 36, 376,
779
+ /* 140 */ 54, 51, 2, 47, 403, 13, 297, 411, 412, 413,
780
+ /* 150 */ 414, 80, 162, 308, 79, 133, 310, 126, 441, 440,
781
+ /* 160 */ 118, 123, 83, 404, 405, 406, 408, 80, 84, 308,
782
+ /* 170 */ 79, 299, 411, 412, 413, 414, 118, 69, 350, 350,
783
+ /* 180 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 62,
784
+ /* 190 */ 61, 434, 64, 63, 62, 61, 313, 398, 399, 427,
785
+ /* 200 */ 428, 339, 380, 157, 64, 63, 62, 61, 122, 106,
786
+ /* 210 */ 535, 436, 437, 438, 439, 298, 375, 391, 117, 393,
787
+ /* 220 */ 155, 154, 153, 394, 435, 49, 59, 60, 339, 339,
788
+ /* 230 */ 339, 339, 425, 426, 376, 3, 4, 2, 64, 63,
789
+ /* 240 */ 62, 61, 156, 156, 156, 394, 379, 159, 59, 60,
790
+ /* 250 */ 76, 67, 535, 441, 440, 5, 102, 6, 535, 42,
791
+ /* 260 */ 131, 535, 69, 107, 301, 302, 303, 394, 305, 15,
792
+ /* 270 */ 59, 60, 120, 161, 119, 446, 463, 424, 376, 423,
793
+ /* 280 */ 1, 42, 397, 78, 78, 36, 434, 11, 394, 435,
794
+ /* 290 */ 356, 59, 60, 12, 152, 139, 432, 14, 16, 376,
795
+ /* 300 */ 18, 65, 2, 138, 106, 430, 436, 437, 438, 439,
796
+ /* 310 */ 44, 375, 19, 117, 393, 155, 154, 153, 441, 440,
797
+ /* 320 */ 142, 140, 64, 63, 62, 61, 106, 20, 68, 376,
798
+ /* 330 */ 359, 107, 23, 375, 45, 117, 393, 155, 154, 153,
799
+ /* 340 */ 120, 161, 119, 55, 463, 114, 26, 57, 106, 147,
800
+ /* 350 */ 146, 434, 569, 58, 392, 375, 43, 117, 393, 155,
801
+ /* 360 */ 154, 153, 152, 384, 64, 63, 62, 61, 382, 106,
802
+ /* 370 */ 383, 436, 437, 438, 439, 377, 375, 70, 117, 393,
803
+ /* 380 */ 155, 154, 153, 160, 39, 22, 21, 445, 142, 140,
804
+ /* 390 */ 64, 63, 62, 61, 24, 17, 145, 141, 431, 108,
805
+ /* 400 */ 445, 445, 445, 391, 445, 445, 375, 445, 117, 445,
806
+ /* 410 */ 445, 55, 74, 445, 148, 445, 445, 147, 146, 124,
807
+ /* 420 */ 113, 120, 161, 119, 43, 445, 445, 142, 140, 64,
808
+ /* 430 */ 63, 62, 61, 445, 394, 445, 445, 59, 60, 64,
809
+ /* 440 */ 63, 62, 61, 149, 445, 376, 445, 445, 42, 445,
810
+ /* 450 */ 55, 445, 391, 22, 21, 445, 147, 146, 445, 445,
811
+ /* 460 */ 52, 445, 24, 43, 145, 141, 431, 394, 445, 445,
812
+ /* 470 */ 59, 60, 64, 63, 62, 61, 445, 445, 376, 132,
813
+ /* 480 */ 130, 42, 445, 445, 445, 355, 156, 156, 156, 445,
814
+ /* 490 */ 445, 445, 22, 21, 445, 394, 473, 445, 59, 60,
815
+ /* 500 */ 445, 24, 445, 145, 141, 431, 376, 445, 107, 42,
816
+ /* 510 */ 64, 63, 62, 61, 445, 106, 445, 120, 161, 119,
817
+ /* 520 */ 445, 478, 375, 354, 117, 393, 155, 154, 153, 445,
818
+ /* 530 */ 394, 143, 473, 59, 60, 64, 63, 62, 61, 152,
819
+ /* 540 */ 445, 376, 445, 445, 42, 445, 445, 445, 106, 64,
820
+ /* 550 */ 63, 62, 61, 445, 445, 375, 50, 117, 393, 155,
821
+ /* 560 */ 154, 153, 445, 394, 144, 445, 59, 60, 445, 445,
822
+ /* 570 */ 53, 72, 445, 148, 376, 445, 106, 42, 125, 113,
823
+ /* 580 */ 120, 161, 119, 375, 445, 117, 393, 155, 154, 153,
824
+ /* 590 */ 394, 445, 445, 59, 60, 445, 445, 445, 445, 445,
825
+ /* 600 */ 445, 102, 149, 445, 42, 445, 74, 445, 148, 445,
826
+ /* 610 */ 445, 106, 445, 497, 113, 120, 161, 119, 375, 445,
827
+ /* 620 */ 117, 393, 155, 154, 153, 394, 445, 445, 59, 60,
828
+ /* 630 */ 445, 445, 88, 445, 445, 445, 376, 149, 445, 40,
829
+ /* 640 */ 445, 120, 161, 119, 106, 445, 445, 435, 110, 110,
830
+ /* 650 */ 445, 375, 445, 117, 393, 155, 154, 153, 394, 445,
831
+ /* 660 */ 445, 59, 60, 152, 85, 445, 445, 445, 445, 376,
832
+ /* 670 */ 445, 106, 41, 120, 161, 119, 441, 440, 375, 445,
833
+ /* 680 */ 117, 393, 155, 154, 153, 448, 454, 29, 445, 445,
834
+ /* 690 */ 74, 450, 148, 75, 88, 152, 445, 496, 113, 120,
835
+ /* 700 */ 161, 119, 163, 120, 161, 119, 106, 27, 445, 434,
836
+ /* 710 */ 111, 111, 445, 375, 445, 117, 393, 155, 154, 153,
837
+ /* 720 */ 445, 149, 445, 445, 445, 152, 74, 445, 148, 436,
838
+ /* 730 */ 437, 438, 439, 490, 113, 120, 161, 119, 445, 106,
839
+ /* 740 */ 121, 447, 454, 29, 445, 445, 375, 450, 117, 393,
840
+ /* 750 */ 155, 154, 153, 445, 445, 445, 445, 149, 163, 74,
841
+ /* 760 */ 445, 148, 444, 27, 445, 445, 484, 113, 120, 161,
842
+ /* 770 */ 119, 445, 445, 445, 74, 445, 148, 445, 445, 445,
843
+ /* 780 */ 445, 483, 113, 120, 161, 119, 74, 445, 148, 86,
844
+ /* 790 */ 149, 445, 445, 480, 113, 120, 161, 119, 120, 161,
845
+ /* 800 */ 119, 445, 74, 445, 148, 149, 445, 445, 445, 134,
846
+ /* 810 */ 113, 120, 161, 119, 74, 445, 148, 149, 445, 445,
847
+ /* 820 */ 152, 517, 113, 120, 161, 119, 88, 64, 63, 62,
848
+ /* 830 */ 61, 445, 445, 149, 445, 120, 161, 119, 445, 74,
849
+ /* 840 */ 396, 148, 475, 445, 445, 149, 137, 113, 120, 161,
850
+ /* 850 */ 119, 74, 445, 148, 445, 445, 445, 152, 525, 113,
851
+ /* 860 */ 120, 161, 119, 445, 74, 445, 148, 445, 445, 445,
852
+ /* 870 */ 149, 527, 113, 120, 161, 119, 445, 445, 445, 74,
853
+ /* 880 */ 445, 148, 149, 445, 445, 445, 524, 113, 120, 161,
854
+ /* 890 */ 119, 74, 445, 148, 98, 149, 445, 445, 526, 113,
855
+ /* 900 */ 120, 161, 119, 120, 161, 119, 445, 74, 445, 148,
856
+ /* 910 */ 149, 445, 445, 445, 523, 113, 120, 161, 119, 74,
857
+ /* 920 */ 445, 148, 149, 445, 445, 152, 522, 113, 120, 161,
858
+ /* 930 */ 119, 89, 64, 63, 62, 61, 445, 445, 149, 445,
859
+ /* 940 */ 120, 161, 119, 445, 74, 395, 148, 445, 445, 445,
860
+ /* 950 */ 149, 521, 113, 120, 161, 119, 74, 445, 148, 445,
861
+ /* 960 */ 445, 445, 152, 520, 113, 120, 161, 119, 445, 74,
862
+ /* 970 */ 445, 148, 445, 445, 445, 149, 519, 113, 120, 161,
863
+ /* 980 */ 119, 445, 445, 445, 74, 445, 148, 149, 445, 445,
864
+ /* 990 */ 445, 150, 113, 120, 161, 119, 74, 445, 148, 90,
865
+ /* 1000 */ 149, 445, 445, 151, 113, 120, 161, 119, 120, 161,
866
+ /* 1010 */ 119, 445, 74, 445, 148, 149, 445, 435, 445, 136,
867
+ /* 1020 */ 113, 120, 161, 119, 74, 445, 148, 149, 445, 445,
868
+ /* 1030 */ 152, 135, 113, 120, 161, 119, 64, 63, 62, 61,
869
+ /* 1040 */ 445, 445, 445, 149, 445, 445, 441, 440, 445, 88,
870
+ /* 1050 */ 445, 445, 445, 445, 445, 149, 445, 56, 120, 161,
871
+ /* 1060 */ 119, 88, 445, 445, 10, 479, 479, 445, 445, 445,
872
+ /* 1070 */ 120, 161, 119, 445, 445, 445, 445, 82, 445, 434,
873
+ /* 1080 */ 152, 445, 445, 445, 466, 445, 34, 109, 447, 454,
874
+ /* 1090 */ 29, 445, 152, 445, 450, 445, 445, 445, 107, 436,
875
+ /* 1100 */ 437, 438, 439, 87, 445, 163, 445, 120, 161, 119,
876
+ /* 1110 */ 27, 451, 120, 161, 119, 99, 445, 64, 63, 62,
877
+ /* 1120 */ 61, 445, 100, 445, 120, 161, 119, 101, 445, 152,
878
+ /* 1130 */ 391, 120, 161, 119, 152, 445, 120, 161, 119, 91,
879
+ /* 1140 */ 445, 445, 445, 445, 445, 445, 152, 445, 120, 161,
880
+ /* 1150 */ 119, 103, 445, 152, 92, 445, 445, 445, 152, 445,
881
+ /* 1160 */ 120, 161, 119, 120, 161, 119, 93, 445, 445, 104,
882
+ /* 1170 */ 152, 445, 445, 445, 445, 120, 161, 119, 120, 161,
883
+ /* 1180 */ 119, 445, 152, 445, 94, 152, 445, 445, 445, 445,
884
+ /* 1190 */ 445, 445, 105, 120, 161, 119, 445, 152, 445, 95,
885
+ /* 1200 */ 152, 120, 161, 119, 445, 445, 445, 96, 120, 161,
886
+ /* 1210 */ 119, 445, 445, 445, 445, 152, 120, 161, 119, 445,
887
+ /* 1220 */ 445, 445, 445, 152, 445, 445, 445, 445, 445, 445,
888
+ /* 1230 */ 152, 97, 445, 445, 549, 445, 445, 548, 152, 445,
889
+ /* 1240 */ 120, 161, 119, 120, 161, 119, 120, 161, 119, 445,
890
+ /* 1250 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
891
+ /* 1260 */ 445, 445, 152, 547, 445, 152, 546, 445, 152, 115,
892
+ /* 1270 */ 445, 445, 120, 161, 119, 120, 161, 119, 120, 161,
893
+ /* 1280 */ 119, 116, 445, 445, 445, 445, 445, 445, 445, 445,
894
+ /* 1290 */ 120, 161, 119, 445, 152, 445, 445, 152, 445, 445,
895
+ /* 1300 */ 152, 445, 445, 445, 445, 445, 445, 445, 445, 445,
896
+ /* 1310 */ 445, 445, 152,
894897
};
895898
static const YYCODETYPE yy_lookahead[] = {
896
- /* 0 */ 0, 112, 113, 114, 133, 101, 102, 103, 105, 105,
897
- /* 10 */ 10, 112, 113, 114, 110, 111, 112, 113, 114, 105,
898
- /* 20 */ 20, 21, 22, 104, 24, 125, 107, 108, 28, 4,
899
- /* 30 */ 5, 6, 7, 33, 34, 35, 36, 37, 134, 39,
900
- /* 40 */ 40, 41, 42, 104, 44, 45, 107, 108, 106, 49,
899
+ /* 0 */ 0, 113, 114, 115, 134, 102, 103, 104, 106, 106,
900
+ /* 10 */ 10, 113, 114, 115, 111, 112, 113, 114, 115, 106,
901
+ /* 20 */ 20, 21, 22, 105, 24, 126, 108, 109, 28, 4,
902
+ /* 30 */ 5, 6, 7, 33, 34, 35, 36, 37, 135, 39,
903
+ /* 40 */ 40, 41, 42, 105, 44, 45, 108, 109, 107, 49,
901904
/* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
902
- /* 60 */ 60, 61, 62, 63, 0, 112, 113, 114, 129, 130,
903
- /* 70 */ 131, 103, 12, 105, 10, 112, 113, 114, 110, 111,
904
- /* 80 */ 112, 113, 114, 105, 20, 21, 22, 17, 24, 112,
905
- /* 90 */ 113, 114, 28, 10, 2, 25, 25, 33, 34, 35,
906
- /* 100 */ 36, 37, 134, 39, 40, 41, 42, 2, 44, 45,
907
- /* 110 */ 132, 28, 127, 49, 50, 51, 52, 53, 54, 55,
905
+ /* 60 */ 60, 61, 62, 63, 0, 113, 114, 115, 130, 131,
906
+ /* 70 */ 132, 104, 25, 106, 10, 113, 114, 115, 111, 112,
907
+ /* 80 */ 113, 114, 115, 106, 20, 21, 22, 128, 24, 113,
908
+ /* 90 */ 114, 115, 28, 129, 2, 26, 27, 33, 34, 35,
909
+ /* 100 */ 36, 37, 135, 39, 40, 41, 42, 2, 44, 45,
910
+ /* 110 */ 133, 26, 27, 49, 50, 51, 52, 53, 54, 55,
908911
/* 120 */ 56, 57, 58, 59, 60, 61, 62, 63, 1, 2,
909
- /* 130 */ 38, 4, 5, 4, 5, 6, 7, 4, 5, 12,
910
- /* 140 */ 3, 81, 15, 38, 1, 115, 17, 2, 88, 115,
911
- /* 150 */ 90, 24, 128, 26, 27, 12, 1, 14, 31, 32,
912
- /* 160 */ 19, 18, 16, 20, 21, 22, 23, 24, 17, 26,
913
- /* 170 */ 27, 15, 29, 30, 31, 32, 31, 32, 64, 65,
914
- /* 180 */ 66, 67, 68, 69, 70, 71, 72, 73, 6, 7,
915
- /* 190 */ 43, 64, 13, 48, 26, 27, 103, 48, 105, 29,
916
- /* 200 */ 30, 31, 32, 110, 111, 112, 113, 114, 81, 64,
917
- /* 210 */ 83, 84, 85, 86, 40, 88, 40, 90, 91, 92,
918
- /* 220 */ 93, 94, 1, 2, 87, 4, 5, 134, 83, 84,
919
- /* 230 */ 85, 86, 48, 12, 96, 97, 15, 41, 20, 21,
920
- /* 240 */ 22, 20, 21, 22, 41, 1, 2, 98, 4, 5,
921
- /* 250 */ 82, 47, 31, 32, 17, 103, 12, 105, 90, 15,
922
- /* 260 */ 26, 27, 110, 111, 112, 113, 114, 49, 50, 51,
923
- /* 270 */ 52, 53, 54, 89, 25, 31, 32, 1, 17, 95,
924
- /* 280 */ 4, 5, 98, 26, 27, 64, 134, 74, 12, 0,
925
- /* 290 */ 79, 15, 78, 3, 2, 80, 20, 21, 22, 10,
926
- /* 300 */ 24, 79, 81, 3, 83, 84, 85, 86, 64, 88,
927
- /* 310 */ 3, 90, 91, 92, 93, 94, 38, 2, 3, 4,
928
- /* 320 */ 5, 6, 7, 31, 32, 81, 3, 83, 84, 85,
929
- /* 330 */ 86, 16, 88, 3, 90, 91, 92, 93, 94, 3,
930
- /* 340 */ 25, 95, 4, 5, 6, 7, 31, 32, 1, 2,
931
- /* 350 */ 76, 4, 5, 38, 25, 17, 64, 81, 15, 12,
932
- /* 360 */ 15, 15, 15, 25, 88, 17, 90, 91, 92, 93,
933
- /* 370 */ 94, 4, 5, 6, 7, 83, 84, 85, 86, 28,
934
- /* 380 */ 28, 28, 67, 68, 12, 38, 89, 3, 11, 135,
935
- /* 390 */ 75, 135, 77, 78, 79, 2, 3, 4, 5, 6,
936
- /* 400 */ 7, 1, 35, 135, 4, 5, 4, 5, 6, 7,
937
- /* 410 */ 17, 135, 12, 135, 135, 15, 135, 135, 25, 17,
938
- /* 420 */ 20, 21, 22, 135, 31, 32, 135, 25, 81, 135,
939
- /* 430 */ 135, 38, 135, 135, 135, 88, 135, 90, 91, 92,
940
- /* 440 */ 93, 94, 135, 1, 2, 135, 4, 5, 4, 5,
941
- /* 450 */ 6, 7, 8, 135, 12, 26, 27, 15, 135, 135,
942
- /* 460 */ 67, 68, 99, 100, 101, 102, 135, 135, 75, 106,
943
- /* 470 */ 77, 78, 79, 2, 3, 4, 5, 6, 7, 135,
944
- /* 480 */ 117, 81, 135, 135, 121, 122, 135, 135, 88, 135,
945
- /* 490 */ 90, 91, 92, 93, 94, 135, 25, 103, 135, 105,
946
- /* 500 */ 135, 135, 31, 32, 110, 111, 112, 113, 114, 38,
947
- /* 510 */ 135, 1, 135, 135, 4, 5, 135, 135, 135, 90,
948
- /* 520 */ 135, 135, 12, 81, 135, 15, 135, 135, 134, 135,
949
- /* 530 */ 88, 135, 90, 91, 92, 93, 94, 135, 67, 68,
950
- /* 540 */ 1, 2, 135, 4, 5, 135, 75, 135, 77, 78,
951
- /* 550 */ 79, 12, 135, 135, 15, 135, 46, 47, 1, 135,
952
- /* 560 */ 135, 4, 5, 99, 100, 101, 102, 135, 135, 12,
953
- /* 570 */ 106, 135, 15, 135, 1, 135, 135, 4, 5, 135,
954
- /* 580 */ 135, 117, 135, 135, 135, 12, 122, 135, 15, 135,
955
- /* 590 */ 135, 81, 135, 4, 5, 6, 7, 135, 88, 135,
956
- /* 600 */ 90, 91, 92, 93, 94, 1, 17, 135, 4, 5,
957
- /* 610 */ 135, 135, 135, 135, 135, 103, 12, 105, 135, 15,
958
- /* 620 */ 81, 135, 110, 111, 112, 113, 114, 88, 135, 90,
959
- /* 630 */ 91, 92, 93, 94, 135, 100, 101, 102, 81, 135,
960
- /* 640 */ 135, 106, 135, 135, 135, 88, 134, 90, 91, 92,
961
- /* 650 */ 93, 94, 117, 135, 81, 135, 135, 122, 135, 135,
962
- /* 660 */ 135, 88, 135, 90, 91, 92, 93, 94, 1, 135,
963
- /* 670 */ 135, 4, 5, 4, 5, 6, 7, 135, 135, 12,
964
- /* 680 */ 135, 135, 15, 135, 135, 81, 17, 4, 5, 6,
965
- /* 690 */ 7, 135, 88, 135, 90, 91, 92, 93, 94, 135,
966
- /* 700 */ 135, 135, 103, 135, 105, 135, 103, 135, 135, 110,
967
- /* 710 */ 111, 112, 113, 114, 135, 112, 113, 114, 35, 103,
968
- /* 720 */ 135, 105, 119, 120, 135, 135, 110, 111, 112, 113,
969
- /* 730 */ 114, 135, 135, 134, 103, 135, 105, 134, 135, 135,
970
- /* 740 */ 135, 110, 111, 112, 113, 114, 135, 135, 81, 135,
971
- /* 750 */ 134, 135, 135, 103, 135, 88, 135, 90, 91, 92,
972
- /* 760 */ 93, 94, 112, 113, 114, 134, 116, 103, 135, 105,
973
- /* 770 */ 135, 103, 135, 135, 110, 111, 112, 113, 114, 135,
974
- /* 780 */ 112, 113, 114, 103, 134, 105, 118, 119, 120, 135,
975
- /* 790 */ 110, 111, 112, 113, 114, 135, 135, 135, 134, 103,
976
- /* 800 */ 135, 105, 134, 135, 135, 135, 110, 111, 112, 113,
977
- /* 810 */ 114, 135, 135, 103, 134, 105, 135, 135, 135, 135,
978
- /* 820 */ 110, 111, 112, 113, 114, 103, 135, 105, 135, 135,
979
- /* 830 */ 134, 135, 110, 111, 112, 113, 114, 135, 103, 135,
980
- /* 840 */ 105, 135, 135, 135, 134, 110, 111, 112, 113, 114,
981
- /* 850 */ 135, 135, 103, 135, 105, 135, 134, 135, 135, 110,
982
- /* 860 */ 111, 112, 113, 114, 103, 135, 105, 135, 135, 134,
983
- /* 870 */ 135, 110, 111, 112, 113, 114, 135, 135, 103, 135,
984
- /* 880 */ 105, 135, 103, 134, 135, 110, 111, 112, 113, 114,
985
- /* 890 */ 135, 112, 113, 114, 103, 134, 105, 103, 119, 120,
986
- /* 900 */ 135, 110, 111, 112, 113, 114, 112, 113, 114, 134,
987
- /* 910 */ 103, 135, 105, 134, 135, 135, 135, 110, 111, 112,
988
- /* 920 */ 113, 114, 135, 135, 103, 134, 105, 135, 134, 135,
989
- /* 930 */ 135, 110, 111, 112, 113, 114, 103, 135, 105, 135,
990
- /* 940 */ 135, 134, 135, 110, 111, 112, 113, 114, 135, 103,
991
- /* 950 */ 135, 105, 135, 135, 135, 134, 110, 111, 112, 113,
992
- /* 960 */ 114, 135, 135, 103, 135, 105, 135, 134, 135, 135,
993
- /* 970 */ 110, 111, 112, 113, 114, 103, 135, 105, 135, 135,
994
- /* 980 */ 134, 135, 110, 111, 112, 113, 114, 135, 135, 103,
995
- /* 990 */ 135, 105, 103, 135, 134, 135, 110, 111, 112, 113,
996
- /* 1000 */ 114, 112, 113, 114, 135, 116, 134, 135, 103, 135,
997
- /* 1010 */ 135, 135, 123, 124, 135, 135, 103, 112, 113, 114,
998
- /* 1020 */ 134, 135, 135, 134, 119, 112, 113, 114, 135, 116,
999
- /* 1030 */ 135, 126, 103, 128, 135, 103, 135, 124, 135, 134,
1000
- /* 1040 */ 135, 112, 113, 114, 112, 113, 114, 134, 103, 135,
1001
- /* 1050 */ 135, 119, 4, 5, 6, 7, 135, 112, 113, 114,
1002
- /* 1060 */ 103, 116, 135, 134, 103, 17, 134, 103, 135, 112,
1003
- /* 1070 */ 113, 114, 135, 112, 113, 114, 112, 113, 114, 134,
1004
- /* 1080 */ 135, 4, 5, 6, 7, 135, 135, 135, 135, 135,
1005
- /* 1090 */ 103, 134, 135, 103, 17, 134, 103, 135, 134, 112,
1006
- /* 1100 */ 113, 114, 112, 113, 114, 112, 113, 114, 135, 103,
1007
- /* 1110 */ 4, 5, 6, 7, 135, 135, 135, 135, 112, 113,
1008
- /* 1120 */ 114, 134, 103, 17, 134, 135, 135, 134, 103, 135,
1009
- /* 1130 */ 135, 112, 113, 114, 135, 103, 135, 112, 113, 114,
1010
- /* 1140 */ 134, 103, 135, 135, 112, 113, 114, 103, 135, 135,
1011
- /* 1150 */ 112, 113, 114, 134, 135, 135, 112, 113, 114, 134,
1012
- /* 1160 */ 135, 135, 135, 135, 103, 135, 134, 135, 135, 135,
1013
- /* 1170 */ 103, 135, 134, 112, 113, 114, 135, 103, 134, 112,
1014
- /* 1180 */ 113, 114, 103, 135, 135, 135, 112, 113, 114, 135,
1015
- /* 1190 */ 135, 112, 113, 114, 103, 134, 135, 135, 135, 135,
1016
- /* 1200 */ 103, 134, 135, 112, 113, 114, 103, 135, 134, 112,
1017
- /* 1210 */ 113, 114, 135, 134, 135, 112, 113, 114, 135, 135,
1018
- /* 1220 */ 135, 135, 135, 103, 135, 134, 135, 135, 135, 135,
1019
- /* 1230 */ 135, 134, 112, 113, 114, 103, 135, 134, 135, 103,
1020
- /* 1240 */ 135, 135, 103, 135, 112, 113, 114, 135, 112, 113,
1021
- /* 1250 */ 114, 112, 113, 114, 134, 4, 5, 6, 7, 4,
1022
- /* 1260 */ 5, 6, 7, 135, 135, 135, 134, 135, 135, 135,
1023
- /* 1270 */ 134, 135, 135, 134, 135, 135, 25, 135, 135, 135,
1024
- /* 1280 */ 25, 4, 5, 6, 7, 135, 135, 135, 135, 135,
1025
- /* 1290 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1026
- /* 1300 */ 135, 135, 25, 135, 135, 135, 135, 135, 135, 135,
1027
- /* 1310 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1028
- /* 1320 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1029
- /* 1330 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1030
- /* 1340 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1031
- /* 1350 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1032
- /* 1360 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1033
- /* 1370 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1034
- /* 1380 */ 135, 99, 99, 99, 99, 99, 99, 99, 99, 99,
1035
- /* 1390 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
1036
- /* 1400 */ 99, 99,
912
+ /* 130 */ 38, 4, 5, 4, 5, 6, 7, 17, 10, 12,
913
+ /* 140 */ 4, 5, 15, 38, 1, 25, 17, 29, 30, 31,
914
+ /* 150 */ 32, 24, 83, 26, 27, 12, 28, 14, 31, 32,
915
+ /* 160 */ 91, 18, 116, 20, 21, 22, 23, 24, 116, 26,
916
+ /* 170 */ 27, 19, 29, 30, 31, 32, 91, 3, 64, 65,
917
+ /* 180 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 6,
918
+ /* 190 */ 7, 64, 4, 5, 6, 7, 8, 97, 98, 20,
919
+ /* 200 */ 21, 22, 26, 27, 4, 5, 6, 7, 1, 82,
920
+ /* 210 */ 48, 84, 85, 86, 87, 17, 89, 17, 91, 92,
921
+ /* 220 */ 93, 94, 95, 1, 2, 25, 4, 5, 49, 50,
922
+ /* 230 */ 51, 52, 53, 54, 12, 16, 15, 15, 4, 5,
923
+ /* 240 */ 6, 7, 20, 21, 22, 1, 26, 27, 4, 5,
924
+ /* 250 */ 48, 43, 90, 31, 32, 40, 12, 40, 96, 15,
925
+ /* 260 */ 47, 99, 88, 104, 20, 21, 22, 1, 24, 35,
926
+ /* 270 */ 4, 5, 113, 114, 115, 0, 117, 41, 12, 41,
927
+ /* 280 */ 13, 15, 17, 124, 125, 10, 64, 25, 1, 2,
928
+ /* 290 */ 17, 4, 5, 75, 135, 81, 80, 3, 3, 12,
929
+ /* 300 */ 3, 99, 15, 79, 82, 80, 84, 85, 86, 87,
930
+ /* 310 */ 38, 89, 3, 91, 92, 93, 94, 95, 31, 32,
931
+ /* 320 */ 2, 3, 4, 5, 6, 7, 82, 3, 3, 12,
932
+ /* 330 */ 77, 104, 25, 89, 16, 91, 92, 93, 94, 95,
933
+ /* 340 */ 113, 114, 115, 25, 117, 96, 15, 15, 82, 31,
934
+ /* 350 */ 32, 64, 125, 15, 17, 89, 38, 91, 92, 93,
935
+ /* 360 */ 94, 95, 135, 28, 4, 5, 6, 7, 28, 82,
936
+ /* 370 */ 28, 84, 85, 86, 87, 12, 89, 3, 91, 92,
937
+ /* 380 */ 93, 94, 95, 90, 11, 67, 68, 136, 2, 3,
938
+ /* 390 */ 4, 5, 6, 7, 76, 35, 78, 79, 80, 82,
939
+ /* 400 */ 136, 136, 136, 17, 136, 136, 89, 136, 91, 136,
940
+ /* 410 */ 136, 25, 104, 136, 106, 136, 136, 31, 32, 111,
941
+ /* 420 */ 112, 113, 114, 115, 38, 136, 136, 2, 3, 4,
942
+ /* 430 */ 5, 6, 7, 136, 1, 136, 136, 4, 5, 4,
943
+ /* 440 */ 5, 6, 7, 135, 136, 12, 136, 136, 15, 136,
944
+ /* 450 */ 25, 136, 17, 67, 68, 136, 31, 32, 136, 136,
945
+ /* 460 */ 25, 136, 76, 38, 78, 79, 80, 1, 136, 136,
946
+ /* 470 */ 4, 5, 4, 5, 6, 7, 136, 136, 12, 46,
947
+ /* 480 */ 47, 15, 136, 136, 136, 17, 20, 21, 22, 136,
948
+ /* 490 */ 136, 136, 67, 68, 136, 1, 2, 136, 4, 5,
949
+ /* 500 */ 136, 76, 136, 78, 79, 80, 12, 136, 104, 15,
950
+ /* 510 */ 4, 5, 6, 7, 136, 82, 136, 113, 114, 115,
951
+ /* 520 */ 136, 117, 89, 17, 91, 92, 93, 94, 95, 136,
952
+ /* 530 */ 1, 2, 38, 4, 5, 4, 5, 6, 7, 135,
953
+ /* 540 */ 136, 12, 136, 136, 15, 136, 136, 136, 82, 4,
954
+ /* 550 */ 5, 6, 7, 136, 136, 89, 25, 91, 92, 93,
955
+ /* 560 */ 94, 95, 136, 1, 2, 136, 4, 5, 136, 136,
956
+ /* 570 */ 25, 104, 136, 106, 12, 136, 82, 15, 111, 112,
957
+ /* 580 */ 113, 114, 115, 89, 136, 91, 92, 93, 94, 95,
958
+ /* 590 */ 1, 136, 136, 4, 5, 136, 136, 136, 136, 136,
959
+ /* 600 */ 136, 12, 135, 136, 15, 136, 104, 136, 106, 136,
960
+ /* 610 */ 136, 82, 136, 111, 112, 113, 114, 115, 89, 136,
961
+ /* 620 */ 91, 92, 93, 94, 95, 1, 136, 136, 4, 5,
962
+ /* 630 */ 136, 136, 104, 136, 136, 136, 12, 135, 136, 15,
963
+ /* 640 */ 136, 113, 114, 115, 82, 136, 136, 2, 120, 121,
964
+ /* 650 */ 136, 89, 136, 91, 92, 93, 94, 95, 1, 136,
965
+ /* 660 */ 136, 4, 5, 135, 104, 136, 136, 136, 136, 12,
966
+ /* 670 */ 136, 82, 15, 113, 114, 115, 31, 32, 89, 136,
967
+ /* 680 */ 91, 92, 93, 94, 95, 101, 102, 103, 136, 136,
968
+ /* 690 */ 104, 107, 106, 48, 104, 135, 136, 111, 112, 113,
969
+ /* 700 */ 114, 115, 118, 113, 114, 115, 82, 123, 136, 64,
970
+ /* 710 */ 120, 121, 136, 89, 136, 91, 92, 93, 94, 95,
971
+ /* 720 */ 136, 135, 136, 136, 136, 135, 104, 136, 106, 84,
972
+ /* 730 */ 85, 86, 87, 111, 112, 113, 114, 115, 136, 82,
973
+ /* 740 */ 100, 101, 102, 103, 136, 136, 89, 107, 91, 92,
974
+ /* 750 */ 93, 94, 95, 136, 136, 136, 136, 135, 118, 104,
975
+ /* 760 */ 136, 106, 122, 123, 136, 136, 111, 112, 113, 114,
976
+ /* 770 */ 115, 136, 136, 136, 104, 136, 106, 136, 136, 136,
977
+ /* 780 */ 136, 111, 112, 113, 114, 115, 104, 136, 106, 104,
978
+ /* 790 */ 135, 136, 136, 111, 112, 113, 114, 115, 113, 114,
979
+ /* 800 */ 115, 136, 104, 136, 106, 135, 136, 136, 136, 111,
980
+ /* 810 */ 112, 113, 114, 115, 104, 136, 106, 135, 136, 136,
981
+ /* 820 */ 135, 111, 112, 113, 114, 115, 104, 4, 5, 6,
982
+ /* 830 */ 7, 136, 136, 135, 136, 113, 114, 115, 136, 104,
983
+ /* 840 */ 17, 106, 120, 136, 136, 135, 111, 112, 113, 114,
984
+ /* 850 */ 115, 104, 136, 106, 136, 136, 136, 135, 111, 112,
985
+ /* 860 */ 113, 114, 115, 136, 104, 136, 106, 136, 136, 136,
986
+ /* 870 */ 135, 111, 112, 113, 114, 115, 136, 136, 136, 104,
987
+ /* 880 */ 136, 106, 135, 136, 136, 136, 111, 112, 113, 114,
988
+ /* 890 */ 115, 104, 136, 106, 104, 135, 136, 136, 111, 112,
989
+ /* 900 */ 113, 114, 115, 113, 114, 115, 136, 104, 136, 106,
990
+ /* 910 */ 135, 136, 136, 136, 111, 112, 113, 114, 115, 104,
991
+ /* 920 */ 136, 106, 135, 136, 136, 135, 111, 112, 113, 114,
992
+ /* 930 */ 115, 104, 4, 5, 6, 7, 136, 136, 135, 136,
993
+ /* 940 */ 113, 114, 115, 136, 104, 17, 106, 136, 136, 136,
994
+ /* 950 */ 135, 111, 112, 113, 114, 115, 104, 136, 106, 136,
995
+ /* 960 */ 136, 136, 135, 111, 112, 113, 114, 115, 136, 104,
996
+ /* 970 */ 136, 106, 136, 136, 136, 135, 111, 112, 113, 114,
997
+ /* 980 */ 115, 136, 136, 136, 104, 136, 106, 135, 136, 136,
998
+ /* 990 */ 136, 111, 112, 113, 114, 115, 104, 136, 106, 104,
999
+ /* 1000 */ 135, 136, 136, 111, 112, 113, 114, 115, 113, 114,
1000
+ /* 1010 */ 115, 136, 104, 136, 106, 135, 136, 2, 136, 111,
1001
+ /* 1020 */ 112, 113, 114, 115, 104, 136, 106, 135, 136, 136,
1002
+ /* 1030 */ 135, 111, 112, 113, 114, 115, 4, 5, 6, 7,
1003
+ /* 1040 */ 136, 136, 136, 135, 136, 136, 31, 32, 136, 104,
1004
+ /* 1050 */ 136, 136, 136, 136, 136, 135, 136, 25, 113, 114,
1005
+ /* 1060 */ 115, 104, 136, 136, 119, 120, 121, 136, 136, 136,
1006
+ /* 1070 */ 113, 114, 115, 136, 136, 136, 136, 120, 136, 64,
1007
+ /* 1080 */ 135, 136, 136, 136, 127, 136, 129, 100, 101, 102,
1008
+ /* 1090 */ 103, 136, 135, 136, 107, 136, 136, 136, 104, 84,
1009
+ /* 1100 */ 85, 86, 87, 104, 136, 118, 136, 113, 114, 115,
1010
+ /* 1110 */ 123, 117, 113, 114, 115, 104, 136, 4, 5, 6,
1011
+ /* 1120 */ 7, 136, 104, 136, 113, 114, 115, 104, 136, 135,
1012
+ /* 1130 */ 17, 113, 114, 115, 135, 136, 113, 114, 115, 104,
1013
+ /* 1140 */ 136, 136, 136, 136, 136, 136, 135, 136, 113, 114,
1014
+ /* 1150 */ 115, 104, 136, 135, 104, 136, 136, 136, 135, 136,
1015
+ /* 1160 */ 113, 114, 115, 113, 114, 115, 104, 136, 136, 104,
1016
+ /* 1170 */ 135, 136, 136, 136, 136, 113, 114, 115, 113, 114,
1017
+ /* 1180 */ 115, 136, 135, 136, 104, 135, 136, 136, 136, 136,
1018
+ /* 1190 */ 136, 136, 104, 113, 114, 115, 136, 135, 136, 104,
1019
+ /* 1200 */ 135, 113, 114, 115, 136, 136, 136, 104, 113, 114,
1020
+ /* 1210 */ 115, 136, 136, 136, 136, 135, 113, 114, 115, 136,
1021
+ /* 1220 */ 136, 136, 136, 135, 136, 136, 136, 136, 136, 136,
1022
+ /* 1230 */ 135, 104, 136, 136, 104, 136, 136, 104, 135, 136,
1023
+ /* 1240 */ 113, 114, 115, 113, 114, 115, 113, 114, 115, 136,
1024
+ /* 1250 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
1025
+ /* 1260 */ 136, 136, 135, 104, 136, 135, 104, 136, 135, 104,
1026
+ /* 1270 */ 136, 136, 113, 114, 115, 113, 114, 115, 113, 114,
1027
+ /* 1280 */ 115, 104, 136, 136, 136, 136, 136, 136, 136, 136,
1028
+ /* 1290 */ 113, 114, 115, 136, 135, 136, 136, 135, 136, 136,
1029
+ /* 1300 */ 135, 136, 136, 136, 136, 136, 136, 136, 136, 136,
1030
+ /* 1310 */ 136, 136, 135, 100, 100, 100, 100, 100, 100, 100,
1031
+ /* 1320 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1032
+ /* 1330 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1033
+ /* 1340 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1034
+ /* 1350 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1035
+ /* 1360 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1036
+ /* 1370 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1037
+ /* 1380 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1038
+ /* 1390 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1039
+ /* 1400 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1040
+ /* 1410 */ 100, 100, 100,
10371041
};
10381042
#define YY_SHIFT_COUNT (163)
10391043
#define YY_SHIFT_MIN (0)
1040
-#define YY_SHIFT_MAX (1277)
1044
+#define YY_SHIFT_MAX (1113)
10411045
static const unsigned short int yy_shift_ofst[] = {
1042
- /* 0 */ 143, 127, 221, 244, 244, 244, 244, 244, 244, 244,
1043
- /* 10 */ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
1044
- /* 20 */ 244, 244, 244, 244, 244, 244, 244, 276, 510, 557,
1045
- /* 30 */ 276, 143, 347, 347, 0, 64, 143, 573, 557, 573,
1046
- /* 40 */ 400, 400, 400, 442, 539, 557, 557, 557, 557, 557,
1047
- /* 50 */ 557, 604, 557, 557, 667, 557, 557, 557, 557, 557,
1048
- /* 60 */ 557, 557, 557, 557, 557, 218, 60, 60, 60, 60,
1049
- /* 70 */ 60, 145, 315, 393, 471, 292, 292, 170, 71, 1303,
1050
- /* 80 */ 1303, 1303, 1303, 114, 114, 338, 402, 129, 444, 367,
1051
- /* 90 */ 683, 589, 1251, 669, 1255, 1048, 1277, 1077, 1106, 25,
1052
- /* 100 */ 25, 25, 184, 25, 25, 25, 168, 25, 429, 83,
1053
- /* 110 */ 92, 105, 70, 133, 138, 182, 182, 234, 257, 137,
1054
- /* 120 */ 149, 289, 141, 155, 151, 146, 156, 147, 174, 176,
1055
- /* 130 */ 196, 203, 204, 179, 237, 249, 213, 261, 211, 214,
1056
- /* 140 */ 215, 222, 290, 300, 307, 278, 323, 330, 336, 246,
1057
- /* 150 */ 274, 329, 246, 343, 345, 346, 348, 351, 352, 353,
1058
- /* 160 */ 372, 297, 384, 377,
1046
+ /* 0 */ 143, 127, 222, 287, 287, 287, 287, 287, 287, 287,
1047
+ /* 10 */ 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
1048
+ /* 20 */ 287, 287, 287, 287, 287, 287, 287, 244, 433, 266,
1049
+ /* 30 */ 244, 143, 494, 494, 0, 64, 143, 589, 266, 589,
1050
+ /* 40 */ 466, 466, 466, 529, 562, 266, 266, 266, 266, 266,
1051
+ /* 50 */ 266, 624, 266, 266, 657, 266, 266, 266, 266, 266,
1052
+ /* 60 */ 266, 266, 266, 266, 266, 179, 317, 317, 317, 317,
1053
+ /* 70 */ 317, 645, 318, 386, 425, 1015, 1015, 118, 47, 1313,
1054
+ /* 80 */ 1313, 1313, 1313, 114, 114, 200, 435, 129, 188, 234,
1055
+ /* 90 */ 360, 468, 531, 506, 545, 823, 1032, 928, 1113, 25,
1056
+ /* 100 */ 25, 25, 162, 25, 25, 25, 69, 25, 85, 128,
1057
+ /* 110 */ 92, 105, 120, 136, 100, 183, 183, 176, 220, 174,
1058
+ /* 120 */ 202, 275, 152, 207, 198, 219, 221, 208, 215, 217,
1059
+ /* 130 */ 236, 238, 213, 267, 265, 262, 218, 273, 216, 224,
1060
+ /* 140 */ 214, 225, 294, 295, 297, 272, 309, 324, 325, 249,
1061
+ /* 150 */ 253, 307, 249, 331, 332, 338, 337, 335, 340, 342,
1062
+ /* 160 */ 363, 293, 374, 373,
10591063
};
10601064
#define YY_REDUCE_COUNT (82)
1061
-#define YY_REDUCE_MIN (-129)
1062
-#define YY_REDUCE_MAX (1139)
1065
+#define YY_REDUCE_MIN (-130)
1066
+#define YY_REDUCE_MAX (1177)
10631067
static const short yy_reduce_ofst[] = {
1064
- /* 0 */ 363, -96, -32, 93, 152, 394, 512, 599, 616, 631,
1065
- /* 10 */ 664, 680, 696, 710, 722, 735, 749, 761, 775, 791,
1066
- /* 20 */ 807, 821, 833, 846, 860, 872, 886, 889, 668, 905,
1067
- /* 30 */ 913, 464, 603, 779, -61, -61, 535, 650, 932, 945,
1068
- /* 40 */ 794, 929, 957, 961, 964, 987, 990, 993, 1006, 1019,
1069
- /* 50 */ 1025, 1032, 1038, 1044, 1061, 1067, 1074, 1079, 1091, 1097,
1070
- /* 60 */ 1103, 1120, 1132, 1136, 1139, -81, -111, -101, -47, -37,
1071
- /* 70 */ -23, -22, -129, -129, -129, -97, -86, -58, -100, -15,
1072
- /* 80 */ 30, 34, 24,
1068
+ /* 0 */ 640, -97, -33, 308, 467, 502, 586, 622, 655, 670,
1069
+ /* 10 */ 682, 698, 710, 735, 747, 760, 775, 787, 803, 815,
1070
+ /* 20 */ 840, 852, 865, 880, 892, 908, 920, 159, 945, 957,
1071
+ /* 30 */ 227, 987, 528, 590, -62, -62, 584, 404, 722, 994,
1072
+ /* 40 */ 560, 685, 790, 827, 895, 999, 1011, 1018, 1023, 1035,
1073
+ /* 50 */ 1047, 1050, 1062, 1065, 1080, 1088, 1095, 1103, 1127, 1130,
1074
+ /* 60 */ 1133, 1159, 1162, 1165, 1177, -82, -112, -102, -48, -38,
1075
+ /* 70 */ -24, -23, -130, -130, -130, -98, -87, -59, -101, -41,
1076
+ /* 80 */ 46, 52, -36,
10731077
};
10741078
static const YYACTIONTYPE yy_default[] = {
10751079
/* 0 */ 449, 443, 443, 443, 443, 443, 443, 443, 443, 443,
10761080
/* 10 */ 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
10771081
/* 20 */ 443, 443, 443, 443, 443, 443, 443, 443, 473, 576,
@@ -1177,10 +1181,11 @@
11771181
0, /* RJUST => nothing */
11781182
0, /* ABOVE => nothing */
11791183
0, /* BELOW => nothing */
11801184
0, /* ITALIC => nothing */
11811185
0, /* BOLD => nothing */
1186
+ 0, /* MONO => nothing */
11821187
0, /* ALIGNED => nothing */
11831188
0, /* BIG => nothing */
11841189
0, /* SMALL => nothing */
11851190
0, /* AND => nothing */
11861191
0, /* LT => nothing */
@@ -1364,74 +1369,75 @@
13641369
/* 66 */ "RJUST",
13651370
/* 67 */ "ABOVE",
13661371
/* 68 */ "BELOW",
13671372
/* 69 */ "ITALIC",
13681373
/* 70 */ "BOLD",
1369
- /* 71 */ "ALIGNED",
1370
- /* 72 */ "BIG",
1371
- /* 73 */ "SMALL",
1372
- /* 74 */ "AND",
1373
- /* 75 */ "LT",
1374
- /* 76 */ "GT",
1375
- /* 77 */ "ON",
1376
- /* 78 */ "WAY",
1377
- /* 79 */ "BETWEEN",
1378
- /* 80 */ "THE",
1379
- /* 81 */ "NTH",
1380
- /* 82 */ "VERTEX",
1381
- /* 83 */ "TOP",
1382
- /* 84 */ "BOTTOM",
1383
- /* 85 */ "START",
1384
- /* 86 */ "END",
1385
- /* 87 */ "IN",
1386
- /* 88 */ "THIS",
1387
- /* 89 */ "DOT_U",
1388
- /* 90 */ "LAST",
1389
- /* 91 */ "NUMBER",
1390
- /* 92 */ "FUNC1",
1391
- /* 93 */ "FUNC2",
1392
- /* 94 */ "DIST",
1393
- /* 95 */ "DOT_XY",
1394
- /* 96 */ "X",
1395
- /* 97 */ "Y",
1396
- /* 98 */ "DOT_L",
1397
- /* 99 */ "statement_list",
1398
- /* 100 */ "statement",
1399
- /* 101 */ "unnamed_statement",
1400
- /* 102 */ "basetype",
1401
- /* 103 */ "expr",
1402
- /* 104 */ "numproperty",
1403
- /* 105 */ "edge",
1404
- /* 106 */ "direction",
1405
- /* 107 */ "dashproperty",
1406
- /* 108 */ "colorproperty",
1407
- /* 109 */ "locproperty",
1408
- /* 110 */ "position",
1409
- /* 111 */ "place",
1410
- /* 112 */ "object",
1411
- /* 113 */ "objectname",
1412
- /* 114 */ "nth",
1413
- /* 115 */ "textposition",
1414
- /* 116 */ "rvalue",
1415
- /* 117 */ "lvalue",
1416
- /* 118 */ "even",
1417
- /* 119 */ "relexpr",
1418
- /* 120 */ "optrelexpr",
1419
- /* 121 */ "document",
1420
- /* 122 */ "print",
1421
- /* 123 */ "prlist",
1422
- /* 124 */ "pritem",
1423
- /* 125 */ "prsep",
1424
- /* 126 */ "attribute_list",
1425
- /* 127 */ "savelist",
1426
- /* 128 */ "alist",
1427
- /* 129 */ "attribute",
1428
- /* 130 */ "go",
1429
- /* 131 */ "boolproperty",
1430
- /* 132 */ "withclause",
1431
- /* 133 */ "between",
1432
- /* 134 */ "place2",
1374
+ /* 71 */ "MONO",
1375
+ /* 72 */ "ALIGNED",
1376
+ /* 73 */ "BIG",
1377
+ /* 74 */ "SMALL",
1378
+ /* 75 */ "AND",
1379
+ /* 76 */ "LT",
1380
+ /* 77 */ "GT",
1381
+ /* 78 */ "ON",
1382
+ /* 79 */ "WAY",
1383
+ /* 80 */ "BETWEEN",
1384
+ /* 81 */ "THE",
1385
+ /* 82 */ "NTH",
1386
+ /* 83 */ "VERTEX",
1387
+ /* 84 */ "TOP",
1388
+ /* 85 */ "BOTTOM",
1389
+ /* 86 */ "START",
1390
+ /* 87 */ "END",
1391
+ /* 88 */ "IN",
1392
+ /* 89 */ "THIS",
1393
+ /* 90 */ "DOT_U",
1394
+ /* 91 */ "LAST",
1395
+ /* 92 */ "NUMBER",
1396
+ /* 93 */ "FUNC1",
1397
+ /* 94 */ "FUNC2",
1398
+ /* 95 */ "DIST",
1399
+ /* 96 */ "DOT_XY",
1400
+ /* 97 */ "X",
1401
+ /* 98 */ "Y",
1402
+ /* 99 */ "DOT_L",
1403
+ /* 100 */ "statement_list",
1404
+ /* 101 */ "statement",
1405
+ /* 102 */ "unnamed_statement",
1406
+ /* 103 */ "basetype",
1407
+ /* 104 */ "expr",
1408
+ /* 105 */ "numproperty",
1409
+ /* 106 */ "edge",
1410
+ /* 107 */ "direction",
1411
+ /* 108 */ "dashproperty",
1412
+ /* 109 */ "colorproperty",
1413
+ /* 110 */ "locproperty",
1414
+ /* 111 */ "position",
1415
+ /* 112 */ "place",
1416
+ /* 113 */ "object",
1417
+ /* 114 */ "objectname",
1418
+ /* 115 */ "nth",
1419
+ /* 116 */ "textposition",
1420
+ /* 117 */ "rvalue",
1421
+ /* 118 */ "lvalue",
1422
+ /* 119 */ "even",
1423
+ /* 120 */ "relexpr",
1424
+ /* 121 */ "optrelexpr",
1425
+ /* 122 */ "document",
1426
+ /* 123 */ "print",
1427
+ /* 124 */ "prlist",
1428
+ /* 125 */ "pritem",
1429
+ /* 126 */ "prsep",
1430
+ /* 127 */ "attribute_list",
1431
+ /* 128 */ "savelist",
1432
+ /* 129 */ "alist",
1433
+ /* 130 */ "attribute",
1434
+ /* 131 */ "go",
1435
+ /* 132 */ "boolproperty",
1436
+ /* 133 */ "withclause",
1437
+ /* 134 */ "between",
1438
+ /* 135 */ "place2",
14331439
};
14341440
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
14351441
14361442
#ifndef NDEBUG
14371443
/* For tracing reduce actions, the names of all rules are required.
@@ -1498,11 +1504,11 @@
14981504
/* 58 */ "boolproperty ::= INVIS",
14991505
/* 59 */ "boolproperty ::= THICK",
15001506
/* 60 */ "boolproperty ::= THIN",
15011507
/* 61 */ "boolproperty ::= SOLID",
15021508
/* 62 */ "textposition ::=",
1503
- /* 63 */ "textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL",
1509
+ /* 63 */ "textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL",
15041510
/* 64 */ "position ::= expr COMMA expr",
15051511
/* 65 */ "position ::= place PLUS expr COMMA expr",
15061512
/* 66 */ "position ::= place MINUS expr COMMA expr",
15071513
/* 67 */ "position ::= place PLUS LP expr COMMA expr RP",
15081514
/* 68 */ "position ::= place MINUS LP expr COMMA expr RP",
@@ -1716,24 +1722,24 @@
17161722
** Note: during a reduce, the only symbols destroyed are those
17171723
** which appear on the RHS of the rule, but which are *not* used
17181724
** inside the C code.
17191725
*/
17201726
/********* Begin destructor definitions ***************************************/
1721
- case 99: /* statement_list */
1722
-{
1723
-#line 509 "pikchr.y"
1724
-pik_elist_free(p,(yypminor->yy227));
1725
-#line 1750 "pikchr.c"
1726
-}
1727
- break;
1728
- case 100: /* statement */
1729
- case 101: /* unnamed_statement */
1730
- case 102: /* basetype */
1731
-{
1732
-#line 511 "pikchr.y"
1733
-pik_elem_free(p,(yypminor->yy36));
1734
-#line 1759 "pikchr.c"
1727
+ case 100: /* statement_list */
1728
+{
1729
+#line 510 "pikchr.y"
1730
+pik_elist_free(p,(yypminor->yy235));
1731
+#line 1756 "pikchr.c"
1732
+}
1733
+ break;
1734
+ case 101: /* statement */
1735
+ case 102: /* unnamed_statement */
1736
+ case 103: /* basetype */
1737
+{
1738
+#line 512 "pikchr.y"
1739
+pik_elem_free(p,(yypminor->yy162));
1740
+#line 1765 "pikchr.c"
17351741
}
17361742
break;
17371743
/********* End destructor definitions *****************************************/
17381744
default: break; /* If no destructor action specified: do nothing */
17391745
}
@@ -1947,14 +1953,14 @@
19471953
#endif
19481954
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
19491955
/* Here code is inserted which will execute if the parser
19501956
** stack every overflows */
19511957
/******** Begin %stack_overflow code ******************************************/
1952
-#line 543 "pikchr.y"
1958
+#line 544 "pikchr.y"
19531959
19541960
pik_error(p, 0, "parser stack overflow");
1955
-#line 1980 "pikchr.c"
1961
+#line 1986 "pikchr.c"
19561962
/******** End %stack_overflow code ********************************************/
19571963
pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
19581964
pik_parserCTX_STORE
19591965
}
19601966
@@ -2022,166 +2028,166 @@
20222028
}
20232029
20242030
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
20252031
** of that rule */
20262032
static const YYCODETYPE yyRuleInfoLhs[] = {
2027
- 121, /* (0) document ::= statement_list */
2028
- 99, /* (1) statement_list ::= statement */
2029
- 99, /* (2) statement_list ::= statement_list EOL statement */
2030
- 100, /* (3) statement ::= */
2031
- 100, /* (4) statement ::= direction */
2032
- 100, /* (5) statement ::= lvalue ASSIGN rvalue */
2033
- 100, /* (6) statement ::= PLACENAME COLON unnamed_statement */
2034
- 100, /* (7) statement ::= PLACENAME COLON position */
2035
- 100, /* (8) statement ::= unnamed_statement */
2036
- 100, /* (9) statement ::= print prlist */
2037
- 100, /* (10) statement ::= ASSERT LP expr EQ expr RP */
2038
- 100, /* (11) statement ::= ASSERT LP position EQ position RP */
2039
- 100, /* (12) statement ::= DEFINE ID CODEBLOCK */
2040
- 116, /* (13) rvalue ::= PLACENAME */
2041
- 124, /* (14) pritem ::= FILL */
2042
- 124, /* (15) pritem ::= COLOR */
2043
- 124, /* (16) pritem ::= THICKNESS */
2044
- 124, /* (17) pritem ::= rvalue */
2045
- 124, /* (18) pritem ::= STRING */
2046
- 125, /* (19) prsep ::= COMMA */
2047
- 101, /* (20) unnamed_statement ::= basetype attribute_list */
2048
- 102, /* (21) basetype ::= CLASSNAME */
2049
- 102, /* (22) basetype ::= STRING textposition */
2050
- 102, /* (23) basetype ::= LB savelist statement_list RB */
2051
- 127, /* (24) savelist ::= */
2052
- 119, /* (25) relexpr ::= expr */
2053
- 119, /* (26) relexpr ::= expr PERCENT */
2054
- 120, /* (27) optrelexpr ::= */
2055
- 126, /* (28) attribute_list ::= relexpr alist */
2056
- 129, /* (29) attribute ::= numproperty relexpr */
2057
- 129, /* (30) attribute ::= dashproperty expr */
2058
- 129, /* (31) attribute ::= dashproperty */
2059
- 129, /* (32) attribute ::= colorproperty rvalue */
2060
- 129, /* (33) attribute ::= go direction optrelexpr */
2061
- 129, /* (34) attribute ::= go direction even position */
2062
- 129, /* (35) attribute ::= CLOSE */
2063
- 129, /* (36) attribute ::= CHOP */
2064
- 129, /* (37) attribute ::= FROM position */
2065
- 129, /* (38) attribute ::= TO position */
2066
- 129, /* (39) attribute ::= THEN */
2067
- 129, /* (40) attribute ::= THEN optrelexpr HEADING expr */
2068
- 129, /* (41) attribute ::= THEN optrelexpr EDGEPT */
2069
- 129, /* (42) attribute ::= GO optrelexpr HEADING expr */
2070
- 129, /* (43) attribute ::= GO optrelexpr EDGEPT */
2071
- 129, /* (44) attribute ::= AT position */
2072
- 129, /* (45) attribute ::= SAME */
2073
- 129, /* (46) attribute ::= SAME AS object */
2074
- 129, /* (47) attribute ::= STRING textposition */
2075
- 129, /* (48) attribute ::= FIT */
2076
- 129, /* (49) attribute ::= BEHIND object */
2077
- 132, /* (50) withclause ::= DOT_E edge AT position */
2078
- 132, /* (51) withclause ::= edge AT position */
2079
- 104, /* (52) numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2080
- 131, /* (53) boolproperty ::= CW */
2081
- 131, /* (54) boolproperty ::= CCW */
2082
- 131, /* (55) boolproperty ::= LARROW */
2083
- 131, /* (56) boolproperty ::= RARROW */
2084
- 131, /* (57) boolproperty ::= LRARROW */
2085
- 131, /* (58) boolproperty ::= INVIS */
2086
- 131, /* (59) boolproperty ::= THICK */
2087
- 131, /* (60) boolproperty ::= THIN */
2088
- 131, /* (61) boolproperty ::= SOLID */
2089
- 115, /* (62) textposition ::= */
2090
- 115, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2091
- 110, /* (64) position ::= expr COMMA expr */
2092
- 110, /* (65) position ::= place PLUS expr COMMA expr */
2093
- 110, /* (66) position ::= place MINUS expr COMMA expr */
2094
- 110, /* (67) position ::= place PLUS LP expr COMMA expr RP */
2095
- 110, /* (68) position ::= place MINUS LP expr COMMA expr RP */
2096
- 110, /* (69) position ::= LP position COMMA position RP */
2097
- 110, /* (70) position ::= LP position RP */
2098
- 110, /* (71) position ::= expr between position AND position */
2099
- 110, /* (72) position ::= expr LT position COMMA position GT */
2100
- 110, /* (73) position ::= expr ABOVE position */
2101
- 110, /* (74) position ::= expr BELOW position */
2102
- 110, /* (75) position ::= expr LEFT OF position */
2103
- 110, /* (76) position ::= expr RIGHT OF position */
2104
- 110, /* (77) position ::= expr ON HEADING EDGEPT OF position */
2105
- 110, /* (78) position ::= expr HEADING EDGEPT OF position */
2106
- 110, /* (79) position ::= expr EDGEPT OF position */
2107
- 110, /* (80) position ::= expr ON HEADING expr FROM position */
2108
- 110, /* (81) position ::= expr HEADING expr FROM position */
2109
- 111, /* (82) place ::= edge OF object */
2110
- 134, /* (83) place2 ::= object */
2111
- 134, /* (84) place2 ::= object DOT_E edge */
2112
- 134, /* (85) place2 ::= NTH VERTEX OF object */
2113
- 112, /* (86) object ::= nth */
2114
- 112, /* (87) object ::= nth OF|IN object */
2115
- 113, /* (88) objectname ::= THIS */
2116
- 113, /* (89) objectname ::= PLACENAME */
2117
- 113, /* (90) objectname ::= objectname DOT_U PLACENAME */
2118
- 114, /* (91) nth ::= NTH CLASSNAME */
2119
- 114, /* (92) nth ::= NTH LAST CLASSNAME */
2120
- 114, /* (93) nth ::= LAST CLASSNAME */
2121
- 114, /* (94) nth ::= LAST */
2122
- 114, /* (95) nth ::= NTH LB RB */
2123
- 114, /* (96) nth ::= NTH LAST LB RB */
2124
- 114, /* (97) nth ::= LAST LB RB */
2125
- 103, /* (98) expr ::= expr PLUS expr */
2126
- 103, /* (99) expr ::= expr MINUS expr */
2127
- 103, /* (100) expr ::= expr STAR expr */
2128
- 103, /* (101) expr ::= expr SLASH expr */
2129
- 103, /* (102) expr ::= MINUS expr */
2130
- 103, /* (103) expr ::= PLUS expr */
2131
- 103, /* (104) expr ::= LP expr RP */
2132
- 103, /* (105) expr ::= LP FILL|COLOR|THICKNESS RP */
2133
- 103, /* (106) expr ::= NUMBER */
2134
- 103, /* (107) expr ::= ID */
2135
- 103, /* (108) expr ::= FUNC1 LP expr RP */
2136
- 103, /* (109) expr ::= FUNC2 LP expr COMMA expr RP */
2137
- 103, /* (110) expr ::= DIST LP position COMMA position RP */
2138
- 103, /* (111) expr ::= place2 DOT_XY X */
2139
- 103, /* (112) expr ::= place2 DOT_XY Y */
2140
- 103, /* (113) expr ::= object DOT_L numproperty */
2141
- 103, /* (114) expr ::= object DOT_L dashproperty */
2142
- 103, /* (115) expr ::= object DOT_L colorproperty */
2143
- 117, /* (116) lvalue ::= ID */
2144
- 117, /* (117) lvalue ::= FILL */
2145
- 117, /* (118) lvalue ::= COLOR */
2146
- 117, /* (119) lvalue ::= THICKNESS */
2147
- 116, /* (120) rvalue ::= expr */
2148
- 122, /* (121) print ::= PRINT */
2149
- 123, /* (122) prlist ::= pritem */
2150
- 123, /* (123) prlist ::= prlist prsep pritem */
2151
- 106, /* (124) direction ::= UP */
2152
- 106, /* (125) direction ::= DOWN */
2153
- 106, /* (126) direction ::= LEFT */
2154
- 106, /* (127) direction ::= RIGHT */
2155
- 120, /* (128) optrelexpr ::= relexpr */
2156
- 126, /* (129) attribute_list ::= alist */
2157
- 128, /* (130) alist ::= */
2158
- 128, /* (131) alist ::= alist attribute */
2159
- 129, /* (132) attribute ::= boolproperty */
2160
- 129, /* (133) attribute ::= WITH withclause */
2161
- 130, /* (134) go ::= GO */
2162
- 130, /* (135) go ::= */
2163
- 118, /* (136) even ::= UNTIL EVEN WITH */
2164
- 118, /* (137) even ::= EVEN WITH */
2165
- 107, /* (138) dashproperty ::= DOTTED */
2166
- 107, /* (139) dashproperty ::= DASHED */
2167
- 108, /* (140) colorproperty ::= FILL */
2168
- 108, /* (141) colorproperty ::= COLOR */
2169
- 110, /* (142) position ::= place */
2170
- 133, /* (143) between ::= WAY BETWEEN */
2171
- 133, /* (144) between ::= BETWEEN */
2172
- 133, /* (145) between ::= OF THE WAY BETWEEN */
2173
- 111, /* (146) place ::= place2 */
2174
- 105, /* (147) edge ::= CENTER */
2175
- 105, /* (148) edge ::= EDGEPT */
2176
- 105, /* (149) edge ::= TOP */
2177
- 105, /* (150) edge ::= BOTTOM */
2178
- 105, /* (151) edge ::= START */
2179
- 105, /* (152) edge ::= END */
2180
- 105, /* (153) edge ::= RIGHT */
2181
- 105, /* (154) edge ::= LEFT */
2182
- 112, /* (155) object ::= objectname */
2033
+ 122, /* (0) document ::= statement_list */
2034
+ 100, /* (1) statement_list ::= statement */
2035
+ 100, /* (2) statement_list ::= statement_list EOL statement */
2036
+ 101, /* (3) statement ::= */
2037
+ 101, /* (4) statement ::= direction */
2038
+ 101, /* (5) statement ::= lvalue ASSIGN rvalue */
2039
+ 101, /* (6) statement ::= PLACENAME COLON unnamed_statement */
2040
+ 101, /* (7) statement ::= PLACENAME COLON position */
2041
+ 101, /* (8) statement ::= unnamed_statement */
2042
+ 101, /* (9) statement ::= print prlist */
2043
+ 101, /* (10) statement ::= ASSERT LP expr EQ expr RP */
2044
+ 101, /* (11) statement ::= ASSERT LP position EQ position RP */
2045
+ 101, /* (12) statement ::= DEFINE ID CODEBLOCK */
2046
+ 117, /* (13) rvalue ::= PLACENAME */
2047
+ 125, /* (14) pritem ::= FILL */
2048
+ 125, /* (15) pritem ::= COLOR */
2049
+ 125, /* (16) pritem ::= THICKNESS */
2050
+ 125, /* (17) pritem ::= rvalue */
2051
+ 125, /* (18) pritem ::= STRING */
2052
+ 126, /* (19) prsep ::= COMMA */
2053
+ 102, /* (20) unnamed_statement ::= basetype attribute_list */
2054
+ 103, /* (21) basetype ::= CLASSNAME */
2055
+ 103, /* (22) basetype ::= STRING textposition */
2056
+ 103, /* (23) basetype ::= LB savelist statement_list RB */
2057
+ 128, /* (24) savelist ::= */
2058
+ 120, /* (25) relexpr ::= expr */
2059
+ 120, /* (26) relexpr ::= expr PERCENT */
2060
+ 121, /* (27) optrelexpr ::= */
2061
+ 127, /* (28) attribute_list ::= relexpr alist */
2062
+ 130, /* (29) attribute ::= numproperty relexpr */
2063
+ 130, /* (30) attribute ::= dashproperty expr */
2064
+ 130, /* (31) attribute ::= dashproperty */
2065
+ 130, /* (32) attribute ::= colorproperty rvalue */
2066
+ 130, /* (33) attribute ::= go direction optrelexpr */
2067
+ 130, /* (34) attribute ::= go direction even position */
2068
+ 130, /* (35) attribute ::= CLOSE */
2069
+ 130, /* (36) attribute ::= CHOP */
2070
+ 130, /* (37) attribute ::= FROM position */
2071
+ 130, /* (38) attribute ::= TO position */
2072
+ 130, /* (39) attribute ::= THEN */
2073
+ 130, /* (40) attribute ::= THEN optrelexpr HEADING expr */
2074
+ 130, /* (41) attribute ::= THEN optrelexpr EDGEPT */
2075
+ 130, /* (42) attribute ::= GO optrelexpr HEADING expr */
2076
+ 130, /* (43) attribute ::= GO optrelexpr EDGEPT */
2077
+ 130, /* (44) attribute ::= AT position */
2078
+ 130, /* (45) attribute ::= SAME */
2079
+ 130, /* (46) attribute ::= SAME AS object */
2080
+ 130, /* (47) attribute ::= STRING textposition */
2081
+ 130, /* (48) attribute ::= FIT */
2082
+ 130, /* (49) attribute ::= BEHIND object */
2083
+ 133, /* (50) withclause ::= DOT_E edge AT position */
2084
+ 133, /* (51) withclause ::= edge AT position */
2085
+ 105, /* (52) numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2086
+ 132, /* (53) boolproperty ::= CW */
2087
+ 132, /* (54) boolproperty ::= CCW */
2088
+ 132, /* (55) boolproperty ::= LARROW */
2089
+ 132, /* (56) boolproperty ::= RARROW */
2090
+ 132, /* (57) boolproperty ::= LRARROW */
2091
+ 132, /* (58) boolproperty ::= INVIS */
2092
+ 132, /* (59) boolproperty ::= THICK */
2093
+ 132, /* (60) boolproperty ::= THIN */
2094
+ 132, /* (61) boolproperty ::= SOLID */
2095
+ 116, /* (62) textposition ::= */
2096
+ 116, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL */
2097
+ 111, /* (64) position ::= expr COMMA expr */
2098
+ 111, /* (65) position ::= place PLUS expr COMMA expr */
2099
+ 111, /* (66) position ::= place MINUS expr COMMA expr */
2100
+ 111, /* (67) position ::= place PLUS LP expr COMMA expr RP */
2101
+ 111, /* (68) position ::= place MINUS LP expr COMMA expr RP */
2102
+ 111, /* (69) position ::= LP position COMMA position RP */
2103
+ 111, /* (70) position ::= LP position RP */
2104
+ 111, /* (71) position ::= expr between position AND position */
2105
+ 111, /* (72) position ::= expr LT position COMMA position GT */
2106
+ 111, /* (73) position ::= expr ABOVE position */
2107
+ 111, /* (74) position ::= expr BELOW position */
2108
+ 111, /* (75) position ::= expr LEFT OF position */
2109
+ 111, /* (76) position ::= expr RIGHT OF position */
2110
+ 111, /* (77) position ::= expr ON HEADING EDGEPT OF position */
2111
+ 111, /* (78) position ::= expr HEADING EDGEPT OF position */
2112
+ 111, /* (79) position ::= expr EDGEPT OF position */
2113
+ 111, /* (80) position ::= expr ON HEADING expr FROM position */
2114
+ 111, /* (81) position ::= expr HEADING expr FROM position */
2115
+ 112, /* (82) place ::= edge OF object */
2116
+ 135, /* (83) place2 ::= object */
2117
+ 135, /* (84) place2 ::= object DOT_E edge */
2118
+ 135, /* (85) place2 ::= NTH VERTEX OF object */
2119
+ 113, /* (86) object ::= nth */
2120
+ 113, /* (87) object ::= nth OF|IN object */
2121
+ 114, /* (88) objectname ::= THIS */
2122
+ 114, /* (89) objectname ::= PLACENAME */
2123
+ 114, /* (90) objectname ::= objectname DOT_U PLACENAME */
2124
+ 115, /* (91) nth ::= NTH CLASSNAME */
2125
+ 115, /* (92) nth ::= NTH LAST CLASSNAME */
2126
+ 115, /* (93) nth ::= LAST CLASSNAME */
2127
+ 115, /* (94) nth ::= LAST */
2128
+ 115, /* (95) nth ::= NTH LB RB */
2129
+ 115, /* (96) nth ::= NTH LAST LB RB */
2130
+ 115, /* (97) nth ::= LAST LB RB */
2131
+ 104, /* (98) expr ::= expr PLUS expr */
2132
+ 104, /* (99) expr ::= expr MINUS expr */
2133
+ 104, /* (100) expr ::= expr STAR expr */
2134
+ 104, /* (101) expr ::= expr SLASH expr */
2135
+ 104, /* (102) expr ::= MINUS expr */
2136
+ 104, /* (103) expr ::= PLUS expr */
2137
+ 104, /* (104) expr ::= LP expr RP */
2138
+ 104, /* (105) expr ::= LP FILL|COLOR|THICKNESS RP */
2139
+ 104, /* (106) expr ::= NUMBER */
2140
+ 104, /* (107) expr ::= ID */
2141
+ 104, /* (108) expr ::= FUNC1 LP expr RP */
2142
+ 104, /* (109) expr ::= FUNC2 LP expr COMMA expr RP */
2143
+ 104, /* (110) expr ::= DIST LP position COMMA position RP */
2144
+ 104, /* (111) expr ::= place2 DOT_XY X */
2145
+ 104, /* (112) expr ::= place2 DOT_XY Y */
2146
+ 104, /* (113) expr ::= object DOT_L numproperty */
2147
+ 104, /* (114) expr ::= object DOT_L dashproperty */
2148
+ 104, /* (115) expr ::= object DOT_L colorproperty */
2149
+ 118, /* (116) lvalue ::= ID */
2150
+ 118, /* (117) lvalue ::= FILL */
2151
+ 118, /* (118) lvalue ::= COLOR */
2152
+ 118, /* (119) lvalue ::= THICKNESS */
2153
+ 117, /* (120) rvalue ::= expr */
2154
+ 123, /* (121) print ::= PRINT */
2155
+ 124, /* (122) prlist ::= pritem */
2156
+ 124, /* (123) prlist ::= prlist prsep pritem */
2157
+ 107, /* (124) direction ::= UP */
2158
+ 107, /* (125) direction ::= DOWN */
2159
+ 107, /* (126) direction ::= LEFT */
2160
+ 107, /* (127) direction ::= RIGHT */
2161
+ 121, /* (128) optrelexpr ::= relexpr */
2162
+ 127, /* (129) attribute_list ::= alist */
2163
+ 129, /* (130) alist ::= */
2164
+ 129, /* (131) alist ::= alist attribute */
2165
+ 130, /* (132) attribute ::= boolproperty */
2166
+ 130, /* (133) attribute ::= WITH withclause */
2167
+ 131, /* (134) go ::= GO */
2168
+ 131, /* (135) go ::= */
2169
+ 119, /* (136) even ::= UNTIL EVEN WITH */
2170
+ 119, /* (137) even ::= EVEN WITH */
2171
+ 108, /* (138) dashproperty ::= DOTTED */
2172
+ 108, /* (139) dashproperty ::= DASHED */
2173
+ 109, /* (140) colorproperty ::= FILL */
2174
+ 109, /* (141) colorproperty ::= COLOR */
2175
+ 111, /* (142) position ::= place */
2176
+ 134, /* (143) between ::= WAY BETWEEN */
2177
+ 134, /* (144) between ::= BETWEEN */
2178
+ 134, /* (145) between ::= OF THE WAY BETWEEN */
2179
+ 112, /* (146) place ::= place2 */
2180
+ 106, /* (147) edge ::= CENTER */
2181
+ 106, /* (148) edge ::= EDGEPT */
2182
+ 106, /* (149) edge ::= TOP */
2183
+ 106, /* (150) edge ::= BOTTOM */
2184
+ 106, /* (151) edge ::= START */
2185
+ 106, /* (152) edge ::= END */
2186
+ 106, /* (153) edge ::= RIGHT */
2187
+ 106, /* (154) edge ::= LEFT */
2188
+ 113, /* (155) object ::= objectname */
21832189
};
21842190
21852191
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
21862192
** of symbols on the right-hand side of that rule. */
21872193
static const signed char yyRuleInfoNRhs[] = {
@@ -2246,11 +2252,11 @@
22462252
-1, /* (58) boolproperty ::= INVIS */
22472253
-1, /* (59) boolproperty ::= THICK */
22482254
-1, /* (60) boolproperty ::= THIN */
22492255
-1, /* (61) boolproperty ::= SOLID */
22502256
0, /* (62) textposition ::= */
2251
- -2, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2257
+ -2, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL */
22522258
-3, /* (64) position ::= expr COMMA expr */
22532259
-5, /* (65) position ::= place PLUS expr COMMA expr */
22542260
-5, /* (66) position ::= place MINUS expr COMMA expr */
22552261
-7, /* (67) position ::= place PLUS LP expr COMMA expr RP */
22562262
-7, /* (68) position ::= place MINUS LP expr COMMA expr RP */
@@ -2381,620 +2387,620 @@
23812387
** break;
23822388
*/
23832389
/********** Begin reduce actions **********************************************/
23842390
YYMINORTYPE yylhsminor;
23852391
case 0: /* document ::= statement_list */
2386
-#line 547 "pikchr.y"
2387
-{pik_render(p,yymsp[0].minor.yy227);}
2388
-#line 2413 "pikchr.c"
2392
+#line 548 "pikchr.y"
2393
+{pik_render(p,yymsp[0].minor.yy235);}
2394
+#line 2419 "pikchr.c"
23892395
break;
23902396
case 1: /* statement_list ::= statement */
2391
-#line 550 "pikchr.y"
2392
-{ yylhsminor.yy227 = pik_elist_append(p,0,yymsp[0].minor.yy36); }
2393
-#line 2418 "pikchr.c"
2394
- yymsp[0].minor.yy227 = yylhsminor.yy227;
2397
+#line 551 "pikchr.y"
2398
+{ yylhsminor.yy235 = pik_elist_append(p,0,yymsp[0].minor.yy162); }
2399
+#line 2424 "pikchr.c"
2400
+ yymsp[0].minor.yy235 = yylhsminor.yy235;
23952401
break;
23962402
case 2: /* statement_list ::= statement_list EOL statement */
2397
-#line 552 "pikchr.y"
2398
-{ yylhsminor.yy227 = pik_elist_append(p,yymsp[-2].minor.yy227,yymsp[0].minor.yy36); }
2399
-#line 2424 "pikchr.c"
2400
- yymsp[-2].minor.yy227 = yylhsminor.yy227;
2403
+#line 553 "pikchr.y"
2404
+{ yylhsminor.yy235 = pik_elist_append(p,yymsp[-2].minor.yy235,yymsp[0].minor.yy162); }
2405
+#line 2430 "pikchr.c"
2406
+ yymsp[-2].minor.yy235 = yylhsminor.yy235;
24012407
break;
24022408
case 3: /* statement ::= */
2403
-#line 555 "pikchr.y"
2404
-{ yymsp[1].minor.yy36 = 0; }
2405
-#line 2430 "pikchr.c"
2409
+#line 556 "pikchr.y"
2410
+{ yymsp[1].minor.yy162 = 0; }
2411
+#line 2436 "pikchr.c"
24062412
break;
24072413
case 4: /* statement ::= direction */
2408
-#line 556 "pikchr.y"
2409
-{ pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy36=0; }
2410
-#line 2435 "pikchr.c"
2411
- yymsp[0].minor.yy36 = yylhsminor.yy36;
2414
+#line 557 "pikchr.y"
2415
+{ pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy162=0; }
2416
+#line 2441 "pikchr.c"
2417
+ yymsp[0].minor.yy162 = yylhsminor.yy162;
24122418
break;
24132419
case 5: /* statement ::= lvalue ASSIGN rvalue */
2414
-#line 557 "pikchr.y"
2415
-{pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy153,&yymsp[-1].minor.yy0); yylhsminor.yy36=0;}
2416
-#line 2441 "pikchr.c"
2417
- yymsp[-2].minor.yy36 = yylhsminor.yy36;
2420
+#line 558 "pikchr.y"
2421
+{pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy21,&yymsp[-1].minor.yy0); yylhsminor.yy162=0;}
2422
+#line 2447 "pikchr.c"
2423
+ yymsp[-2].minor.yy162 = yylhsminor.yy162;
24182424
break;
24192425
case 6: /* statement ::= PLACENAME COLON unnamed_statement */
2420
-#line 559 "pikchr.y"
2421
-{ yylhsminor.yy36 = yymsp[0].minor.yy36; pik_elem_setname(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0); }
2422
-#line 2447 "pikchr.c"
2423
- yymsp[-2].minor.yy36 = yylhsminor.yy36;
2426
+#line 560 "pikchr.y"
2427
+{ yylhsminor.yy162 = yymsp[0].minor.yy162; pik_elem_setname(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0); }
2428
+#line 2453 "pikchr.c"
2429
+ yymsp[-2].minor.yy162 = yylhsminor.yy162;
24242430
break;
24252431
case 7: /* statement ::= PLACENAME COLON position */
2426
-#line 561 "pikchr.y"
2427
-{ yylhsminor.yy36 = pik_elem_new(p,0,0,0);
2428
- if(yylhsminor.yy36){ yylhsminor.yy36->ptAt = yymsp[0].minor.yy79; pik_elem_setname(p,yylhsminor.yy36,&yymsp[-2].minor.yy0); }}
2429
-#line 2454 "pikchr.c"
2430
- yymsp[-2].minor.yy36 = yylhsminor.yy36;
2432
+#line 562 "pikchr.y"
2433
+{ yylhsminor.yy162 = pik_elem_new(p,0,0,0);
2434
+ if(yylhsminor.yy162){ yylhsminor.yy162->ptAt = yymsp[0].minor.yy63; pik_elem_setname(p,yylhsminor.yy162,&yymsp[-2].minor.yy0); }}
2435
+#line 2460 "pikchr.c"
2436
+ yymsp[-2].minor.yy162 = yylhsminor.yy162;
24312437
break;
24322438
case 8: /* statement ::= unnamed_statement */
2433
-#line 563 "pikchr.y"
2434
-{yylhsminor.yy36 = yymsp[0].minor.yy36;}
2435
-#line 2460 "pikchr.c"
2436
- yymsp[0].minor.yy36 = yylhsminor.yy36;
2439
+#line 564 "pikchr.y"
2440
+{yylhsminor.yy162 = yymsp[0].minor.yy162;}
2441
+#line 2466 "pikchr.c"
2442
+ yymsp[0].minor.yy162 = yylhsminor.yy162;
24372443
break;
24382444
case 9: /* statement ::= print prlist */
2439
-#line 564 "pikchr.y"
2440
-{pik_append(p,"<br>\n",5); yymsp[-1].minor.yy36=0;}
2441
-#line 2466 "pikchr.c"
2445
+#line 565 "pikchr.y"
2446
+{pik_append(p,"<br>\n",5); yymsp[-1].minor.yy162=0;}
2447
+#line 2472 "pikchr.c"
24422448
break;
24432449
case 10: /* statement ::= ASSERT LP expr EQ expr RP */
2444
-#line 569 "pikchr.y"
2445
-{yymsp[-5].minor.yy36=pik_assert(p,yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy153);}
2446
-#line 2471 "pikchr.c"
2450
+#line 570 "pikchr.y"
2451
+{yymsp[-5].minor.yy162=pik_assert(p,yymsp[-3].minor.yy21,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy21);}
2452
+#line 2477 "pikchr.c"
24472453
break;
24482454
case 11: /* statement ::= ASSERT LP position EQ position RP */
2449
-#line 571 "pikchr.y"
2450
-{yymsp[-5].minor.yy36=pik_position_assert(p,&yymsp[-3].minor.yy79,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy79);}
2451
-#line 2476 "pikchr.c"
2455
+#line 572 "pikchr.y"
2456
+{yymsp[-5].minor.yy162=pik_position_assert(p,&yymsp[-3].minor.yy63,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy63);}
2457
+#line 2482 "pikchr.c"
24522458
break;
24532459
case 12: /* statement ::= DEFINE ID CODEBLOCK */
2454
-#line 572 "pikchr.y"
2455
-{yymsp[-2].minor.yy36=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
2456
-#line 2481 "pikchr.c"
2460
+#line 573 "pikchr.y"
2461
+{yymsp[-2].minor.yy162=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
2462
+#line 2487 "pikchr.c"
24572463
break;
24582464
case 13: /* rvalue ::= PLACENAME */
2459
-#line 583 "pikchr.y"
2460
-{yylhsminor.yy153 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2461
-#line 2486 "pikchr.c"
2462
- yymsp[0].minor.yy153 = yylhsminor.yy153;
2465
+#line 584 "pikchr.y"
2466
+{yylhsminor.yy21 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2467
+#line 2492 "pikchr.c"
2468
+ yymsp[0].minor.yy21 = yylhsminor.yy21;
24632469
break;
24642470
case 14: /* pritem ::= FILL */
24652471
case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
24662472
case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
2467
-#line 588 "pikchr.y"
2473
+#line 589 "pikchr.y"
24682474
{pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2469
-#line 2494 "pikchr.c"
2475
+#line 2500 "pikchr.c"
24702476
break;
24712477
case 17: /* pritem ::= rvalue */
2472
-#line 591 "pikchr.y"
2473
-{pik_append_num(p,"",yymsp[0].minor.yy153);}
2474
-#line 2499 "pikchr.c"
2478
+#line 592 "pikchr.y"
2479
+{pik_append_num(p,"",yymsp[0].minor.yy21);}
2480
+#line 2505 "pikchr.c"
24752481
break;
24762482
case 18: /* pritem ::= STRING */
2477
-#line 592 "pikchr.y"
2483
+#line 593 "pikchr.y"
24782484
{pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2479
-#line 2504 "pikchr.c"
2485
+#line 2510 "pikchr.c"
24802486
break;
24812487
case 19: /* prsep ::= COMMA */
2482
-#line 593 "pikchr.y"
2488
+#line 594 "pikchr.y"
24832489
{pik_append(p, " ", 1);}
2484
-#line 2509 "pikchr.c"
2490
+#line 2515 "pikchr.c"
24852491
break;
24862492
case 20: /* unnamed_statement ::= basetype attribute_list */
2487
-#line 596 "pikchr.y"
2488
-{yylhsminor.yy36 = yymsp[-1].minor.yy36; pik_after_adding_attributes(p,yylhsminor.yy36);}
2489
-#line 2514 "pikchr.c"
2490
- yymsp[-1].minor.yy36 = yylhsminor.yy36;
2493
+#line 597 "pikchr.y"
2494
+{yylhsminor.yy162 = yymsp[-1].minor.yy162; pik_after_adding_attributes(p,yylhsminor.yy162);}
2495
+#line 2520 "pikchr.c"
2496
+ yymsp[-1].minor.yy162 = yylhsminor.yy162;
24912497
break;
24922498
case 21: /* basetype ::= CLASSNAME */
2493
-#line 598 "pikchr.y"
2494
-{yylhsminor.yy36 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2495
-#line 2520 "pikchr.c"
2496
- yymsp[0].minor.yy36 = yylhsminor.yy36;
2499
+#line 599 "pikchr.y"
2500
+{yylhsminor.yy162 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2501
+#line 2526 "pikchr.c"
2502
+ yymsp[0].minor.yy162 = yylhsminor.yy162;
24972503
break;
24982504
case 22: /* basetype ::= STRING textposition */
2499
-#line 600 "pikchr.y"
2500
-{yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy164; yylhsminor.yy36 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2501
-#line 2526 "pikchr.c"
2502
- yymsp[-1].minor.yy36 = yylhsminor.yy36;
2505
+#line 601 "pikchr.y"
2506
+{yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy188; yylhsminor.yy162 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2507
+#line 2532 "pikchr.c"
2508
+ yymsp[-1].minor.yy162 = yylhsminor.yy162;
25032509
break;
25042510
case 23: /* basetype ::= LB savelist statement_list RB */
2505
-#line 602 "pikchr.y"
2506
-{ p->list = yymsp[-2].minor.yy227; yymsp[-3].minor.yy36 = pik_elem_new(p,0,0,yymsp[-1].minor.yy227); if(yymsp[-3].minor.yy36) yymsp[-3].minor.yy36->errTok = yymsp[0].minor.yy0; }
2507
-#line 2532 "pikchr.c"
2511
+#line 603 "pikchr.y"
2512
+{ p->list = yymsp[-2].minor.yy235; yymsp[-3].minor.yy162 = pik_elem_new(p,0,0,yymsp[-1].minor.yy235); if(yymsp[-3].minor.yy162) yymsp[-3].minor.yy162->errTok = yymsp[0].minor.yy0; }
2513
+#line 2538 "pikchr.c"
25082514
break;
25092515
case 24: /* savelist ::= */
2510
-#line 607 "pikchr.y"
2511
-{yymsp[1].minor.yy227 = p->list; p->list = 0;}
2512
-#line 2537 "pikchr.c"
2516
+#line 608 "pikchr.y"
2517
+{yymsp[1].minor.yy235 = p->list; p->list = 0;}
2518
+#line 2543 "pikchr.c"
25132519
break;
25142520
case 25: /* relexpr ::= expr */
2515
-#line 614 "pikchr.y"
2516
-{yylhsminor.yy10.rAbs = yymsp[0].minor.yy153; yylhsminor.yy10.rRel = 0;}
2517
-#line 2542 "pikchr.c"
2518
- yymsp[0].minor.yy10 = yylhsminor.yy10;
2521
+#line 615 "pikchr.y"
2522
+{yylhsminor.yy72.rAbs = yymsp[0].minor.yy21; yylhsminor.yy72.rRel = 0;}
2523
+#line 2548 "pikchr.c"
2524
+ yymsp[0].minor.yy72 = yylhsminor.yy72;
25192525
break;
25202526
case 26: /* relexpr ::= expr PERCENT */
2521
-#line 615 "pikchr.y"
2522
-{yylhsminor.yy10.rAbs = 0; yylhsminor.yy10.rRel = yymsp[-1].minor.yy153/100;}
2523
-#line 2548 "pikchr.c"
2524
- yymsp[-1].minor.yy10 = yylhsminor.yy10;
2527
+#line 616 "pikchr.y"
2528
+{yylhsminor.yy72.rAbs = 0; yylhsminor.yy72.rRel = yymsp[-1].minor.yy21/100;}
2529
+#line 2554 "pikchr.c"
2530
+ yymsp[-1].minor.yy72 = yylhsminor.yy72;
25252531
break;
25262532
case 27: /* optrelexpr ::= */
2527
-#line 617 "pikchr.y"
2528
-{yymsp[1].minor.yy10.rAbs = 0; yymsp[1].minor.yy10.rRel = 1.0;}
2529
-#line 2554 "pikchr.c"
2533
+#line 618 "pikchr.y"
2534
+{yymsp[1].minor.yy72.rAbs = 0; yymsp[1].minor.yy72.rRel = 1.0;}
2535
+#line 2560 "pikchr.c"
25302536
break;
25312537
case 28: /* attribute_list ::= relexpr alist */
2532
-#line 619 "pikchr.y"
2533
-{pik_add_direction(p,0,&yymsp[-1].minor.yy10);}
2534
-#line 2559 "pikchr.c"
2538
+#line 620 "pikchr.y"
2539
+{pik_add_direction(p,0,&yymsp[-1].minor.yy72);}
2540
+#line 2565 "pikchr.c"
25352541
break;
25362542
case 29: /* attribute ::= numproperty relexpr */
2537
-#line 623 "pikchr.y"
2538
-{ pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10); }
2539
-#line 2564 "pikchr.c"
2543
+#line 624 "pikchr.y"
2544
+{ pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy72); }
2545
+#line 2570 "pikchr.c"
25402546
break;
25412547
case 30: /* attribute ::= dashproperty expr */
2542
-#line 624 "pikchr.y"
2543
-{ pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy153); }
2544
-#line 2569 "pikchr.c"
2548
+#line 625 "pikchr.y"
2549
+{ pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy21); }
2550
+#line 2575 "pikchr.c"
25452551
break;
25462552
case 31: /* attribute ::= dashproperty */
2547
-#line 625 "pikchr.y"
2553
+#line 626 "pikchr.y"
25482554
{ pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2549
-#line 2574 "pikchr.c"
2555
+#line 2580 "pikchr.c"
25502556
break;
25512557
case 32: /* attribute ::= colorproperty rvalue */
2552
-#line 626 "pikchr.y"
2553
-{ pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153); }
2554
-#line 2579 "pikchr.c"
2558
+#line 627 "pikchr.y"
2559
+{ pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy21); }
2560
+#line 2585 "pikchr.c"
25552561
break;
25562562
case 33: /* attribute ::= go direction optrelexpr */
2557
-#line 627 "pikchr.y"
2558
-{ pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10);}
2559
-#line 2584 "pikchr.c"
2563
+#line 628 "pikchr.y"
2564
+{ pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy72);}
2565
+#line 2590 "pikchr.c"
25602566
break;
25612567
case 34: /* attribute ::= go direction even position */
2562
-#line 628 "pikchr.y"
2563
-{pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79);}
2564
-#line 2589 "pikchr.c"
2568
+#line 629 "pikchr.y"
2569
+{pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy63);}
2570
+#line 2595 "pikchr.c"
25652571
break;
25662572
case 35: /* attribute ::= CLOSE */
2567
-#line 629 "pikchr.y"
2573
+#line 630 "pikchr.y"
25682574
{ pik_close_path(p,&yymsp[0].minor.yy0); }
2569
-#line 2594 "pikchr.c"
2575
+#line 2600 "pikchr.c"
25702576
break;
25712577
case 36: /* attribute ::= CHOP */
2572
-#line 630 "pikchr.y"
2578
+#line 631 "pikchr.y"
25732579
{ p->cur->bChop = 1; }
2574
-#line 2599 "pikchr.c"
2580
+#line 2605 "pikchr.c"
25752581
break;
25762582
case 37: /* attribute ::= FROM position */
2577
-#line 631 "pikchr.y"
2578
-{ pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2579
-#line 2604 "pikchr.c"
2583
+#line 632 "pikchr.y"
2584
+{ pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy63); }
2585
+#line 2610 "pikchr.c"
25802586
break;
25812587
case 38: /* attribute ::= TO position */
2582
-#line 632 "pikchr.y"
2583
-{ pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2584
-#line 2609 "pikchr.c"
2588
+#line 633 "pikchr.y"
2589
+{ pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy63); }
2590
+#line 2615 "pikchr.c"
25852591
break;
25862592
case 39: /* attribute ::= THEN */
2587
-#line 633 "pikchr.y"
2593
+#line 634 "pikchr.y"
25882594
{ pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2589
-#line 2614 "pikchr.c"
2595
+#line 2620 "pikchr.c"
25902596
break;
25912597
case 40: /* attribute ::= THEN optrelexpr HEADING expr */
25922598
case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
2593
-#line 635 "pikchr.y"
2594
-{pik_move_hdg(p,&yymsp[-2].minor.yy10,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153,0,&yymsp[-3].minor.yy0);}
2595
-#line 2620 "pikchr.c"
2599
+#line 636 "pikchr.y"
2600
+{pik_move_hdg(p,&yymsp[-2].minor.yy72,&yymsp[-1].minor.yy0,yymsp[0].minor.yy21,0,&yymsp[-3].minor.yy0);}
2601
+#line 2626 "pikchr.c"
25962602
break;
25972603
case 41: /* attribute ::= THEN optrelexpr EDGEPT */
25982604
case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
2599
-#line 636 "pikchr.y"
2600
-{pik_move_hdg(p,&yymsp[-1].minor.yy10,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2601
-#line 2626 "pikchr.c"
2605
+#line 637 "pikchr.y"
2606
+{pik_move_hdg(p,&yymsp[-1].minor.yy72,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2607
+#line 2632 "pikchr.c"
26022608
break;
26032609
case 44: /* attribute ::= AT position */
2604
-#line 641 "pikchr.y"
2605
-{ pik_set_at(p,0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2606
-#line 2631 "pikchr.c"
2610
+#line 642 "pikchr.y"
2611
+{ pik_set_at(p,0,&yymsp[0].minor.yy63,&yymsp[-1].minor.yy0); }
2612
+#line 2637 "pikchr.c"
26072613
break;
26082614
case 45: /* attribute ::= SAME */
2609
-#line 643 "pikchr.y"
2615
+#line 644 "pikchr.y"
26102616
{pik_same(p,0,&yymsp[0].minor.yy0);}
2611
-#line 2636 "pikchr.c"
2617
+#line 2642 "pikchr.c"
26122618
break;
26132619
case 46: /* attribute ::= SAME AS object */
2614
-#line 644 "pikchr.y"
2615
-{pik_same(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2616
-#line 2641 "pikchr.c"
2620
+#line 645 "pikchr.y"
2621
+{pik_same(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0);}
2622
+#line 2647 "pikchr.c"
26172623
break;
26182624
case 47: /* attribute ::= STRING textposition */
2619
-#line 645 "pikchr.y"
2620
-{pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy164);}
2621
-#line 2646 "pikchr.c"
2625
+#line 646 "pikchr.y"
2626
+{pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy188);}
2627
+#line 2652 "pikchr.c"
26222628
break;
26232629
case 48: /* attribute ::= FIT */
2624
-#line 646 "pikchr.y"
2630
+#line 647 "pikchr.y"
26252631
{pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
2626
-#line 2651 "pikchr.c"
2632
+#line 2657 "pikchr.c"
26272633
break;
26282634
case 49: /* attribute ::= BEHIND object */
2629
-#line 647 "pikchr.y"
2630
-{pik_behind(p,yymsp[0].minor.yy36);}
2631
-#line 2656 "pikchr.c"
2635
+#line 648 "pikchr.y"
2636
+{pik_behind(p,yymsp[0].minor.yy162);}
2637
+#line 2662 "pikchr.c"
26322638
break;
26332639
case 50: /* withclause ::= DOT_E edge AT position */
26342640
case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
2635
-#line 655 "pikchr.y"
2636
-{ pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2637
-#line 2662 "pikchr.c"
2641
+#line 656 "pikchr.y"
2642
+{ pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy63,&yymsp[-1].minor.yy0); }
2643
+#line 2668 "pikchr.c"
26382644
break;
26392645
case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2640
-#line 659 "pikchr.y"
2646
+#line 660 "pikchr.y"
26412647
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
2642
-#line 2667 "pikchr.c"
2648
+#line 2673 "pikchr.c"
26432649
yymsp[0].minor.yy0 = yylhsminor.yy0;
26442650
break;
26452651
case 53: /* boolproperty ::= CW */
2646
-#line 670 "pikchr.y"
2652
+#line 671 "pikchr.y"
26472653
{p->cur->cw = 1;}
2648
-#line 2673 "pikchr.c"
2654
+#line 2679 "pikchr.c"
26492655
break;
26502656
case 54: /* boolproperty ::= CCW */
2651
-#line 671 "pikchr.y"
2657
+#line 672 "pikchr.y"
26522658
{p->cur->cw = 0;}
2653
-#line 2678 "pikchr.c"
2659
+#line 2684 "pikchr.c"
26542660
break;
26552661
case 55: /* boolproperty ::= LARROW */
2656
-#line 672 "pikchr.y"
2662
+#line 673 "pikchr.y"
26572663
{p->cur->larrow=1; p->cur->rarrow=0; }
2658
-#line 2683 "pikchr.c"
2664
+#line 2689 "pikchr.c"
26592665
break;
26602666
case 56: /* boolproperty ::= RARROW */
2661
-#line 673 "pikchr.y"
2667
+#line 674 "pikchr.y"
26622668
{p->cur->larrow=0; p->cur->rarrow=1; }
2663
-#line 2688 "pikchr.c"
2669
+#line 2694 "pikchr.c"
26642670
break;
26652671
case 57: /* boolproperty ::= LRARROW */
2666
-#line 674 "pikchr.y"
2672
+#line 675 "pikchr.y"
26672673
{p->cur->larrow=1; p->cur->rarrow=1; }
2668
-#line 2693 "pikchr.c"
2674
+#line 2699 "pikchr.c"
26692675
break;
26702676
case 58: /* boolproperty ::= INVIS */
2671
-#line 675 "pikchr.y"
2677
+#line 676 "pikchr.y"
26722678
{p->cur->sw = 0.0;}
2673
-#line 2698 "pikchr.c"
2679
+#line 2704 "pikchr.c"
26742680
break;
26752681
case 59: /* boolproperty ::= THICK */
2676
-#line 676 "pikchr.y"
2682
+#line 677 "pikchr.y"
26772683
{p->cur->sw *= 1.5;}
2678
-#line 2703 "pikchr.c"
2684
+#line 2709 "pikchr.c"
26792685
break;
26802686
case 60: /* boolproperty ::= THIN */
2681
-#line 677 "pikchr.y"
2687
+#line 678 "pikchr.y"
26822688
{p->cur->sw *= 0.67;}
2683
-#line 2708 "pikchr.c"
2689
+#line 2714 "pikchr.c"
26842690
break;
26852691
case 61: /* boolproperty ::= SOLID */
2686
-#line 678 "pikchr.y"
2692
+#line 679 "pikchr.y"
26872693
{p->cur->sw = pik_value(p,"thickness",9,0);
26882694
p->cur->dotted = p->cur->dashed = 0.0;}
2689
-#line 2714 "pikchr.c"
2695
+#line 2720 "pikchr.c"
26902696
break;
26912697
case 62: /* textposition ::= */
2692
-#line 681 "pikchr.y"
2693
-{yymsp[1].minor.yy164 = 0;}
2694
-#line 2719 "pikchr.c"
2698
+#line 682 "pikchr.y"
2699
+{yymsp[1].minor.yy188 = 0;}
2700
+#line 2725 "pikchr.c"
26952701
break;
2696
- case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2697
-#line 684 "pikchr.y"
2698
-{yylhsminor.yy164 = (short int)pik_text_position(yymsp[-1].minor.yy164,&yymsp[0].minor.yy0);}
2699
-#line 2724 "pikchr.c"
2700
- yymsp[-1].minor.yy164 = yylhsminor.yy164;
2702
+ case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL */
2703
+#line 685 "pikchr.y"
2704
+{yylhsminor.yy188 = (short int)pik_text_position(yymsp[-1].minor.yy188,&yymsp[0].minor.yy0);}
2705
+#line 2730 "pikchr.c"
2706
+ yymsp[-1].minor.yy188 = yylhsminor.yy188;
27012707
break;
27022708
case 64: /* position ::= expr COMMA expr */
2703
-#line 687 "pikchr.y"
2704
-{yylhsminor.yy79.x=yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[0].minor.yy153;}
2705
-#line 2730 "pikchr.c"
2706
- yymsp[-2].minor.yy79 = yylhsminor.yy79;
2709
+#line 688 "pikchr.y"
2710
+{yylhsminor.yy63.x=yymsp[-2].minor.yy21; yylhsminor.yy63.y=yymsp[0].minor.yy21;}
2711
+#line 2736 "pikchr.c"
2712
+ yymsp[-2].minor.yy63 = yylhsminor.yy63;
27072713
break;
27082714
case 65: /* position ::= place PLUS expr COMMA expr */
2709
-#line 689 "pikchr.y"
2710
-{yylhsminor.yy79.x=yymsp[-4].minor.yy79.x+yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y+yymsp[0].minor.yy153;}
2711
-#line 2736 "pikchr.c"
2712
- yymsp[-4].minor.yy79 = yylhsminor.yy79;
2715
+#line 690 "pikchr.y"
2716
+{yylhsminor.yy63.x=yymsp[-4].minor.yy63.x+yymsp[-2].minor.yy21; yylhsminor.yy63.y=yymsp[-4].minor.yy63.y+yymsp[0].minor.yy21;}
2717
+#line 2742 "pikchr.c"
2718
+ yymsp[-4].minor.yy63 = yylhsminor.yy63;
27132719
break;
27142720
case 66: /* position ::= place MINUS expr COMMA expr */
2715
-#line 690 "pikchr.y"
2716
-{yylhsminor.yy79.x=yymsp[-4].minor.yy79.x-yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y-yymsp[0].minor.yy153;}
2717
-#line 2742 "pikchr.c"
2718
- yymsp[-4].minor.yy79 = yylhsminor.yy79;
2721
+#line 691 "pikchr.y"
2722
+{yylhsminor.yy63.x=yymsp[-4].minor.yy63.x-yymsp[-2].minor.yy21; yylhsminor.yy63.y=yymsp[-4].minor.yy63.y-yymsp[0].minor.yy21;}
2723
+#line 2748 "pikchr.c"
2724
+ yymsp[-4].minor.yy63 = yylhsminor.yy63;
27192725
break;
27202726
case 67: /* position ::= place PLUS LP expr COMMA expr RP */
2721
-#line 692 "pikchr.y"
2722
-{yylhsminor.yy79.x=yymsp[-6].minor.yy79.x+yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y+yymsp[-1].minor.yy153;}
2723
-#line 2748 "pikchr.c"
2724
- yymsp[-6].minor.yy79 = yylhsminor.yy79;
2727
+#line 693 "pikchr.y"
2728
+{yylhsminor.yy63.x=yymsp[-6].minor.yy63.x+yymsp[-3].minor.yy21; yylhsminor.yy63.y=yymsp[-6].minor.yy63.y+yymsp[-1].minor.yy21;}
2729
+#line 2754 "pikchr.c"
2730
+ yymsp[-6].minor.yy63 = yylhsminor.yy63;
27252731
break;
27262732
case 68: /* position ::= place MINUS LP expr COMMA expr RP */
2727
-#line 694 "pikchr.y"
2728
-{yylhsminor.yy79.x=yymsp[-6].minor.yy79.x-yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y-yymsp[-1].minor.yy153;}
2729
-#line 2754 "pikchr.c"
2730
- yymsp[-6].minor.yy79 = yylhsminor.yy79;
2733
+#line 695 "pikchr.y"
2734
+{yylhsminor.yy63.x=yymsp[-6].minor.yy63.x-yymsp[-3].minor.yy21; yylhsminor.yy63.y=yymsp[-6].minor.yy63.y-yymsp[-1].minor.yy21;}
2735
+#line 2760 "pikchr.c"
2736
+ yymsp[-6].minor.yy63 = yylhsminor.yy63;
27312737
break;
27322738
case 69: /* position ::= LP position COMMA position RP */
2733
-#line 695 "pikchr.y"
2734
-{yymsp[-4].minor.yy79.x=yymsp[-3].minor.yy79.x; yymsp[-4].minor.yy79.y=yymsp[-1].minor.yy79.y;}
2735
-#line 2760 "pikchr.c"
2739
+#line 696 "pikchr.y"
2740
+{yymsp[-4].minor.yy63.x=yymsp[-3].minor.yy63.x; yymsp[-4].minor.yy63.y=yymsp[-1].minor.yy63.y;}
2741
+#line 2766 "pikchr.c"
27362742
break;
27372743
case 70: /* position ::= LP position RP */
2738
-#line 696 "pikchr.y"
2739
-{yymsp[-2].minor.yy79=yymsp[-1].minor.yy79;}
2740
-#line 2765 "pikchr.c"
2744
+#line 697 "pikchr.y"
2745
+{yymsp[-2].minor.yy63=yymsp[-1].minor.yy63;}
2746
+#line 2771 "pikchr.c"
27412747
break;
27422748
case 71: /* position ::= expr between position AND position */
2743
-#line 698 "pikchr.y"
2744
-{yylhsminor.yy79 = pik_position_between(yymsp[-4].minor.yy153,yymsp[-2].minor.yy79,yymsp[0].minor.yy79);}
2745
-#line 2770 "pikchr.c"
2746
- yymsp[-4].minor.yy79 = yylhsminor.yy79;
2749
+#line 699 "pikchr.y"
2750
+{yylhsminor.yy63 = pik_position_between(yymsp[-4].minor.yy21,yymsp[-2].minor.yy63,yymsp[0].minor.yy63);}
2751
+#line 2776 "pikchr.c"
2752
+ yymsp[-4].minor.yy63 = yylhsminor.yy63;
27472753
break;
27482754
case 72: /* position ::= expr LT position COMMA position GT */
2749
-#line 700 "pikchr.y"
2750
-{yylhsminor.yy79 = pik_position_between(yymsp[-5].minor.yy153,yymsp[-3].minor.yy79,yymsp[-1].minor.yy79);}
2751
-#line 2776 "pikchr.c"
2752
- yymsp[-5].minor.yy79 = yylhsminor.yy79;
2755
+#line 701 "pikchr.y"
2756
+{yylhsminor.yy63 = pik_position_between(yymsp[-5].minor.yy21,yymsp[-3].minor.yy63,yymsp[-1].minor.yy63);}
2757
+#line 2782 "pikchr.c"
2758
+ yymsp[-5].minor.yy63 = yylhsminor.yy63;
27532759
break;
27542760
case 73: /* position ::= expr ABOVE position */
2755
-#line 701 "pikchr.y"
2756
-{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y += yymsp[-2].minor.yy153;}
2757
-#line 2782 "pikchr.c"
2758
- yymsp[-2].minor.yy79 = yylhsminor.yy79;
2761
+#line 702 "pikchr.y"
2762
+{yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.y += yymsp[-2].minor.yy21;}
2763
+#line 2788 "pikchr.c"
2764
+ yymsp[-2].minor.yy63 = yylhsminor.yy63;
27592765
break;
27602766
case 74: /* position ::= expr BELOW position */
2761
-#line 702 "pikchr.y"
2762
-{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y -= yymsp[-2].minor.yy153;}
2763
-#line 2788 "pikchr.c"
2764
- yymsp[-2].minor.yy79 = yylhsminor.yy79;
2767
+#line 703 "pikchr.y"
2768
+{yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.y -= yymsp[-2].minor.yy21;}
2769
+#line 2794 "pikchr.c"
2770
+ yymsp[-2].minor.yy63 = yylhsminor.yy63;
27652771
break;
27662772
case 75: /* position ::= expr LEFT OF position */
2767
-#line 703 "pikchr.y"
2768
-{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x -= yymsp[-3].minor.yy153;}
2769
-#line 2794 "pikchr.c"
2770
- yymsp[-3].minor.yy79 = yylhsminor.yy79;
2773
+#line 704 "pikchr.y"
2774
+{yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.x -= yymsp[-3].minor.yy21;}
2775
+#line 2800 "pikchr.c"
2776
+ yymsp[-3].minor.yy63 = yylhsminor.yy63;
27712777
break;
27722778
case 76: /* position ::= expr RIGHT OF position */
2773
-#line 704 "pikchr.y"
2774
-{yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x += yymsp[-3].minor.yy153;}
2775
-#line 2800 "pikchr.c"
2776
- yymsp[-3].minor.yy79 = yylhsminor.yy79;
2779
+#line 705 "pikchr.y"
2780
+{yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.x += yymsp[-3].minor.yy21;}
2781
+#line 2806 "pikchr.c"
2782
+ yymsp[-3].minor.yy63 = yylhsminor.yy63;
27772783
break;
27782784
case 77: /* position ::= expr ON HEADING EDGEPT OF position */
2779
-#line 706 "pikchr.y"
2780
-{yylhsminor.yy79 = pik_position_at_hdg(yymsp[-5].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2781
-#line 2806 "pikchr.c"
2782
- yymsp[-5].minor.yy79 = yylhsminor.yy79;
2785
+#line 707 "pikchr.y"
2786
+{yylhsminor.yy63 = pik_position_at_hdg(yymsp[-5].minor.yy21,&yymsp[-2].minor.yy0,yymsp[0].minor.yy63);}
2787
+#line 2812 "pikchr.c"
2788
+ yymsp[-5].minor.yy63 = yylhsminor.yy63;
27832789
break;
27842790
case 78: /* position ::= expr HEADING EDGEPT OF position */
2785
-#line 708 "pikchr.y"
2786
-{yylhsminor.yy79 = pik_position_at_hdg(yymsp[-4].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2787
-#line 2812 "pikchr.c"
2788
- yymsp[-4].minor.yy79 = yylhsminor.yy79;
2791
+#line 709 "pikchr.y"
2792
+{yylhsminor.yy63 = pik_position_at_hdg(yymsp[-4].minor.yy21,&yymsp[-2].minor.yy0,yymsp[0].minor.yy63);}
2793
+#line 2818 "pikchr.c"
2794
+ yymsp[-4].minor.yy63 = yylhsminor.yy63;
27892795
break;
27902796
case 79: /* position ::= expr EDGEPT OF position */
2791
-#line 710 "pikchr.y"
2792
-{yylhsminor.yy79 = pik_position_at_hdg(yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2793
-#line 2818 "pikchr.c"
2794
- yymsp[-3].minor.yy79 = yylhsminor.yy79;
2797
+#line 711 "pikchr.y"
2798
+{yylhsminor.yy63 = pik_position_at_hdg(yymsp[-3].minor.yy21,&yymsp[-2].minor.yy0,yymsp[0].minor.yy63);}
2799
+#line 2824 "pikchr.c"
2800
+ yymsp[-3].minor.yy63 = yylhsminor.yy63;
27952801
break;
27962802
case 80: /* position ::= expr ON HEADING expr FROM position */
2797
-#line 712 "pikchr.y"
2798
-{yylhsminor.yy79 = pik_position_at_angle(yymsp[-5].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2799
-#line 2824 "pikchr.c"
2800
- yymsp[-5].minor.yy79 = yylhsminor.yy79;
2803
+#line 713 "pikchr.y"
2804
+{yylhsminor.yy63 = pik_position_at_angle(yymsp[-5].minor.yy21,yymsp[-2].minor.yy21,yymsp[0].minor.yy63);}
2805
+#line 2830 "pikchr.c"
2806
+ yymsp[-5].minor.yy63 = yylhsminor.yy63;
28012807
break;
28022808
case 81: /* position ::= expr HEADING expr FROM position */
2803
-#line 714 "pikchr.y"
2804
-{yylhsminor.yy79 = pik_position_at_angle(yymsp[-4].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2805
-#line 2830 "pikchr.c"
2806
- yymsp[-4].minor.yy79 = yylhsminor.yy79;
2809
+#line 715 "pikchr.y"
2810
+{yylhsminor.yy63 = pik_position_at_angle(yymsp[-4].minor.yy21,yymsp[-2].minor.yy21,yymsp[0].minor.yy63);}
2811
+#line 2836 "pikchr.c"
2812
+ yymsp[-4].minor.yy63 = yylhsminor.yy63;
28072813
break;
28082814
case 82: /* place ::= edge OF object */
2809
-#line 726 "pikchr.y"
2810
-{yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2811
-#line 2836 "pikchr.c"
2812
- yymsp[-2].minor.yy79 = yylhsminor.yy79;
2815
+#line 727 "pikchr.y"
2816
+{yylhsminor.yy63 = pik_place_of_elem(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0);}
2817
+#line 2842 "pikchr.c"
2818
+ yymsp[-2].minor.yy63 = yylhsminor.yy63;
28132819
break;
28142820
case 83: /* place2 ::= object */
2815
-#line 727 "pikchr.y"
2816
-{yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,0);}
2817
-#line 2842 "pikchr.c"
2818
- yymsp[0].minor.yy79 = yylhsminor.yy79;
2821
+#line 728 "pikchr.y"
2822
+{yylhsminor.yy63 = pik_place_of_elem(p,yymsp[0].minor.yy162,0);}
2823
+#line 2848 "pikchr.c"
2824
+ yymsp[0].minor.yy63 = yylhsminor.yy63;
28192825
break;
28202826
case 84: /* place2 ::= object DOT_E edge */
2821
-#line 728 "pikchr.y"
2822
-{yylhsminor.yy79 = pik_place_of_elem(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2823
-#line 2848 "pikchr.c"
2824
- yymsp[-2].minor.yy79 = yylhsminor.yy79;
2827
+#line 729 "pikchr.y"
2828
+{yylhsminor.yy63 = pik_place_of_elem(p,yymsp[-2].minor.yy162,&yymsp[0].minor.yy0);}
2829
+#line 2854 "pikchr.c"
2830
+ yymsp[-2].minor.yy63 = yylhsminor.yy63;
28252831
break;
28262832
case 85: /* place2 ::= NTH VERTEX OF object */
2827
-#line 729 "pikchr.y"
2828
-{yylhsminor.yy79 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy36);}
2829
-#line 2854 "pikchr.c"
2830
- yymsp[-3].minor.yy79 = yylhsminor.yy79;
2833
+#line 730 "pikchr.y"
2834
+{yylhsminor.yy63 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy162);}
2835
+#line 2860 "pikchr.c"
2836
+ yymsp[-3].minor.yy63 = yylhsminor.yy63;
28312837
break;
28322838
case 86: /* object ::= nth */
2833
-#line 741 "pikchr.y"
2834
-{yylhsminor.yy36 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2835
-#line 2860 "pikchr.c"
2836
- yymsp[0].minor.yy36 = yylhsminor.yy36;
2839
+#line 742 "pikchr.y"
2840
+{yylhsminor.yy162 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2841
+#line 2866 "pikchr.c"
2842
+ yymsp[0].minor.yy162 = yylhsminor.yy162;
28372843
break;
28382844
case 87: /* object ::= nth OF|IN object */
2839
-#line 742 "pikchr.y"
2840
-{yylhsminor.yy36 = pik_find_nth(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2841
-#line 2866 "pikchr.c"
2842
- yymsp[-2].minor.yy36 = yylhsminor.yy36;
2845
+#line 743 "pikchr.y"
2846
+{yylhsminor.yy162 = pik_find_nth(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0);}
2847
+#line 2872 "pikchr.c"
2848
+ yymsp[-2].minor.yy162 = yylhsminor.yy162;
28432849
break;
28442850
case 88: /* objectname ::= THIS */
2845
-#line 744 "pikchr.y"
2846
-{yymsp[0].minor.yy36 = p->cur;}
2847
-#line 2872 "pikchr.c"
2851
+#line 745 "pikchr.y"
2852
+{yymsp[0].minor.yy162 = p->cur;}
2853
+#line 2878 "pikchr.c"
28482854
break;
28492855
case 89: /* objectname ::= PLACENAME */
2850
-#line 745 "pikchr.y"
2851
-{yylhsminor.yy36 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2852
-#line 2877 "pikchr.c"
2853
- yymsp[0].minor.yy36 = yylhsminor.yy36;
2856
+#line 746 "pikchr.y"
2857
+{yylhsminor.yy162 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2858
+#line 2883 "pikchr.c"
2859
+ yymsp[0].minor.yy162 = yylhsminor.yy162;
28542860
break;
28552861
case 90: /* objectname ::= objectname DOT_U PLACENAME */
2856
-#line 747 "pikchr.y"
2857
-{yylhsminor.yy36 = pik_find_byname(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2858
-#line 2883 "pikchr.c"
2859
- yymsp[-2].minor.yy36 = yylhsminor.yy36;
2862
+#line 748 "pikchr.y"
2863
+{yylhsminor.yy162 = pik_find_byname(p,yymsp[-2].minor.yy162,&yymsp[0].minor.yy0);}
2864
+#line 2889 "pikchr.c"
2865
+ yymsp[-2].minor.yy162 = yylhsminor.yy162;
28602866
break;
28612867
case 91: /* nth ::= NTH CLASSNAME */
2862
-#line 749 "pikchr.y"
2868
+#line 750 "pikchr.y"
28632869
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2864
-#line 2889 "pikchr.c"
2870
+#line 2895 "pikchr.c"
28652871
yymsp[-1].minor.yy0 = yylhsminor.yy0;
28662872
break;
28672873
case 92: /* nth ::= NTH LAST CLASSNAME */
2868
-#line 750 "pikchr.y"
2874
+#line 751 "pikchr.y"
28692875
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2870
-#line 2895 "pikchr.c"
2876
+#line 2901 "pikchr.c"
28712877
yymsp[-2].minor.yy0 = yylhsminor.yy0;
28722878
break;
28732879
case 93: /* nth ::= LAST CLASSNAME */
2874
-#line 751 "pikchr.y"
2880
+#line 752 "pikchr.y"
28752881
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2876
-#line 2901 "pikchr.c"
2882
+#line 2907 "pikchr.c"
28772883
break;
28782884
case 94: /* nth ::= LAST */
2879
-#line 752 "pikchr.y"
2885
+#line 753 "pikchr.y"
28802886
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2881
-#line 2906 "pikchr.c"
2887
+#line 2912 "pikchr.c"
28822888
yymsp[0].minor.yy0 = yylhsminor.yy0;
28832889
break;
28842890
case 95: /* nth ::= NTH LB RB */
2885
-#line 753 "pikchr.y"
2891
+#line 754 "pikchr.y"
28862892
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2887
-#line 2912 "pikchr.c"
2893
+#line 2918 "pikchr.c"
28882894
yymsp[-2].minor.yy0 = yylhsminor.yy0;
28892895
break;
28902896
case 96: /* nth ::= NTH LAST LB RB */
2891
-#line 754 "pikchr.y"
2897
+#line 755 "pikchr.y"
28922898
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2893
-#line 2918 "pikchr.c"
2899
+#line 2924 "pikchr.c"
28942900
yymsp[-3].minor.yy0 = yylhsminor.yy0;
28952901
break;
28962902
case 97: /* nth ::= LAST LB RB */
2897
-#line 755 "pikchr.y"
2903
+#line 756 "pikchr.y"
28982904
{yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2899
-#line 2924 "pikchr.c"
2905
+#line 2930 "pikchr.c"
29002906
break;
29012907
case 98: /* expr ::= expr PLUS expr */
2902
-#line 757 "pikchr.y"
2903
-{yylhsminor.yy153=yymsp[-2].minor.yy153+yymsp[0].minor.yy153;}
2904
-#line 2929 "pikchr.c"
2905
- yymsp[-2].minor.yy153 = yylhsminor.yy153;
2908
+#line 758 "pikchr.y"
2909
+{yylhsminor.yy21=yymsp[-2].minor.yy21+yymsp[0].minor.yy21;}
2910
+#line 2935 "pikchr.c"
2911
+ yymsp[-2].minor.yy21 = yylhsminor.yy21;
29062912
break;
29072913
case 99: /* expr ::= expr MINUS expr */
2908
-#line 758 "pikchr.y"
2909
-{yylhsminor.yy153=yymsp[-2].minor.yy153-yymsp[0].minor.yy153;}
2910
-#line 2935 "pikchr.c"
2911
- yymsp[-2].minor.yy153 = yylhsminor.yy153;
2914
+#line 759 "pikchr.y"
2915
+{yylhsminor.yy21=yymsp[-2].minor.yy21-yymsp[0].minor.yy21;}
2916
+#line 2941 "pikchr.c"
2917
+ yymsp[-2].minor.yy21 = yylhsminor.yy21;
29122918
break;
29132919
case 100: /* expr ::= expr STAR expr */
2914
-#line 759 "pikchr.y"
2915
-{yylhsminor.yy153=yymsp[-2].minor.yy153*yymsp[0].minor.yy153;}
2916
-#line 2941 "pikchr.c"
2917
- yymsp[-2].minor.yy153 = yylhsminor.yy153;
2920
+#line 760 "pikchr.y"
2921
+{yylhsminor.yy21=yymsp[-2].minor.yy21*yymsp[0].minor.yy21;}
2922
+#line 2947 "pikchr.c"
2923
+ yymsp[-2].minor.yy21 = yylhsminor.yy21;
29182924
break;
29192925
case 101: /* expr ::= expr SLASH expr */
2920
-#line 760 "pikchr.y"
2926
+#line 761 "pikchr.y"
29212927
{
2922
- if( yymsp[0].minor.yy153==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy153 = 0.0; }
2923
- else{ yylhsminor.yy153 = yymsp[-2].minor.yy153/yymsp[0].minor.yy153; }
2928
+ if( yymsp[0].minor.yy21==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy21 = 0.0; }
2929
+ else{ yylhsminor.yy21 = yymsp[-2].minor.yy21/yymsp[0].minor.yy21; }
29242930
}
2925
-#line 2950 "pikchr.c"
2926
- yymsp[-2].minor.yy153 = yylhsminor.yy153;
2931
+#line 2956 "pikchr.c"
2932
+ yymsp[-2].minor.yy21 = yylhsminor.yy21;
29272933
break;
29282934
case 102: /* expr ::= MINUS expr */
2929
-#line 764 "pikchr.y"
2930
-{yymsp[-1].minor.yy153=-yymsp[0].minor.yy153;}
2931
-#line 2956 "pikchr.c"
2935
+#line 765 "pikchr.y"
2936
+{yymsp[-1].minor.yy21=-yymsp[0].minor.yy21;}
2937
+#line 2962 "pikchr.c"
29322938
break;
29332939
case 103: /* expr ::= PLUS expr */
2934
-#line 765 "pikchr.y"
2935
-{yymsp[-1].minor.yy153=yymsp[0].minor.yy153;}
2936
-#line 2961 "pikchr.c"
2940
+#line 766 "pikchr.y"
2941
+{yymsp[-1].minor.yy21=yymsp[0].minor.yy21;}
2942
+#line 2967 "pikchr.c"
29372943
break;
29382944
case 104: /* expr ::= LP expr RP */
2939
-#line 766 "pikchr.y"
2940
-{yymsp[-2].minor.yy153=yymsp[-1].minor.yy153;}
2941
-#line 2966 "pikchr.c"
2945
+#line 767 "pikchr.y"
2946
+{yymsp[-2].minor.yy21=yymsp[-1].minor.yy21;}
2947
+#line 2972 "pikchr.c"
29422948
break;
29432949
case 105: /* expr ::= LP FILL|COLOR|THICKNESS RP */
2944
-#line 767 "pikchr.y"
2945
-{yymsp[-2].minor.yy153=pik_get_var(p,&yymsp[-1].minor.yy0);}
2946
-#line 2971 "pikchr.c"
2950
+#line 768 "pikchr.y"
2951
+{yymsp[-2].minor.yy21=pik_get_var(p,&yymsp[-1].minor.yy0);}
2952
+#line 2977 "pikchr.c"
29472953
break;
29482954
case 106: /* expr ::= NUMBER */
2949
-#line 768 "pikchr.y"
2950
-{yylhsminor.yy153=pik_atof(&yymsp[0].minor.yy0);}
2951
-#line 2976 "pikchr.c"
2952
- yymsp[0].minor.yy153 = yylhsminor.yy153;
2955
+#line 769 "pikchr.y"
2956
+{yylhsminor.yy21=pik_atof(&yymsp[0].minor.yy0);}
2957
+#line 2982 "pikchr.c"
2958
+ yymsp[0].minor.yy21 = yylhsminor.yy21;
29532959
break;
29542960
case 107: /* expr ::= ID */
2955
-#line 769 "pikchr.y"
2956
-{yylhsminor.yy153=pik_get_var(p,&yymsp[0].minor.yy0);}
2957
-#line 2982 "pikchr.c"
2958
- yymsp[0].minor.yy153 = yylhsminor.yy153;
2961
+#line 770 "pikchr.y"
2962
+{yylhsminor.yy21=pik_get_var(p,&yymsp[0].minor.yy0);}
2963
+#line 2988 "pikchr.c"
2964
+ yymsp[0].minor.yy21 = yylhsminor.yy21;
29592965
break;
29602966
case 108: /* expr ::= FUNC1 LP expr RP */
2961
-#line 770 "pikchr.y"
2962
-{yylhsminor.yy153 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy153,0.0);}
2963
-#line 2988 "pikchr.c"
2964
- yymsp[-3].minor.yy153 = yylhsminor.yy153;
2967
+#line 771 "pikchr.y"
2968
+{yylhsminor.yy21 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy21,0.0);}
2969
+#line 2994 "pikchr.c"
2970
+ yymsp[-3].minor.yy21 = yylhsminor.yy21;
29652971
break;
29662972
case 109: /* expr ::= FUNC2 LP expr COMMA expr RP */
2967
-#line 771 "pikchr.y"
2968
-{yylhsminor.yy153 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy153,yymsp[-1].minor.yy153);}
2969
-#line 2994 "pikchr.c"
2970
- yymsp[-5].minor.yy153 = yylhsminor.yy153;
2973
+#line 772 "pikchr.y"
2974
+{yylhsminor.yy21 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy21,yymsp[-1].minor.yy21);}
2975
+#line 3000 "pikchr.c"
2976
+ yymsp[-5].minor.yy21 = yylhsminor.yy21;
29712977
break;
29722978
case 110: /* expr ::= DIST LP position COMMA position RP */
2973
-#line 772 "pikchr.y"
2974
-{yymsp[-5].minor.yy153 = pik_dist(&yymsp[-3].minor.yy79,&yymsp[-1].minor.yy79);}
2975
-#line 3000 "pikchr.c"
2979
+#line 773 "pikchr.y"
2980
+{yymsp[-5].minor.yy21 = pik_dist(&yymsp[-3].minor.yy63,&yymsp[-1].minor.yy63);}
2981
+#line 3006 "pikchr.c"
29762982
break;
29772983
case 111: /* expr ::= place2 DOT_XY X */
2978
-#line 773 "pikchr.y"
2979
-{yylhsminor.yy153 = yymsp[-2].minor.yy79.x;}
2980
-#line 3005 "pikchr.c"
2981
- yymsp[-2].minor.yy153 = yylhsminor.yy153;
2984
+#line 774 "pikchr.y"
2985
+{yylhsminor.yy21 = yymsp[-2].minor.yy63.x;}
2986
+#line 3011 "pikchr.c"
2987
+ yymsp[-2].minor.yy21 = yylhsminor.yy21;
29822988
break;
29832989
case 112: /* expr ::= place2 DOT_XY Y */
2984
-#line 774 "pikchr.y"
2985
-{yylhsminor.yy153 = yymsp[-2].minor.yy79.y;}
2986
-#line 3011 "pikchr.c"
2987
- yymsp[-2].minor.yy153 = yylhsminor.yy153;
2990
+#line 775 "pikchr.y"
2991
+{yylhsminor.yy21 = yymsp[-2].minor.yy63.y;}
2992
+#line 3017 "pikchr.c"
2993
+ yymsp[-2].minor.yy21 = yylhsminor.yy21;
29882994
break;
29892995
case 113: /* expr ::= object DOT_L numproperty */
29902996
case 114: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==114);
29912997
case 115: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==115);
2992
-#line 775 "pikchr.y"
2993
-{yylhsminor.yy153=pik_property_of(yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2994
-#line 3019 "pikchr.c"
2995
- yymsp[-2].minor.yy153 = yylhsminor.yy153;
2998
+#line 776 "pikchr.y"
2999
+{yylhsminor.yy21=pik_property_of(yymsp[-2].minor.yy162,&yymsp[0].minor.yy0);}
3000
+#line 3025 "pikchr.c"
3001
+ yymsp[-2].minor.yy21 = yylhsminor.yy21;
29963002
break;
29973003
default:
29983004
/* (116) lvalue ::= ID */ yytestcase(yyruleno==116);
29993005
/* (117) lvalue ::= FILL */ yytestcase(yyruleno==117);
30003006
/* (118) lvalue ::= COLOR */ yytestcase(yyruleno==118);
@@ -3092,19 +3098,19 @@
30923098
){
30933099
pik_parserARG_FETCH
30943100
pik_parserCTX_FETCH
30953101
#define TOKEN yyminor
30963102
/************ Begin %syntax_error code ****************************************/
3097
-#line 535 "pikchr.y"
3103
+#line 536 "pikchr.y"
30983104
30993105
if( TOKEN.z && TOKEN.z[0] ){
31003106
pik_error(p, &TOKEN, "syntax error");
31013107
}else{
31023108
pik_error(p, 0, "syntax error");
31033109
}
31043110
UNUSED_PARAMETER(yymajor);
3105
-#line 3130 "pikchr.c"
3111
+#line 3136 "pikchr.c"
31063112
/************ End %syntax_error code ******************************************/
31073113
pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
31083114
pik_parserCTX_STORE
31093115
}
31103116
@@ -3376,11 +3382,11 @@
33763382
#else
33773383
(void)iToken;
33783384
return 0;
33793385
#endif
33803386
}
3381
-#line 780 "pikchr.y"
3387
+#line 781 "pikchr.y"
33823388
33833389
33843390
33853391
/* Chart of the 148 official CSS color names with their
33863392
** corresponding RGB values thru Color Module Level 4:
@@ -4978,14 +4984,16 @@
49784984
if( t->eCode & TP_RJUST ) nx += jw;
49794985
49804986
if( pBox!=0 ){
49814987
/* If pBox is not NULL, do not draw any <text>. Instead, just expand
49824988
** pBox to include the text */
4983
- PNum cw = pik_text_length(t)*p->charWidth*xtraFontScale*0.01;
4989
+ PNum cw = pik_text_length(t, t->eCode & TP_MONO)*p->charWidth*xtraFontScale*0.01;
49844990
PNum ch = p->charHeight*0.5*xtraFontScale;
49854991
PNum x0, y0, x1, y1; /* Boundary of text relative to pObj->ptAt */
4986
- if( t->eCode & TP_BOLD ) cw *= 1.1;
4992
+ if( (t->eCode & (TP_BOLD|TP_MONO))==TP_BOLD ){
4993
+ cw *= 1.1;
4994
+ }
49874995
if( t->eCode & TP_RJUST ){
49884996
x0 = nx;
49894997
y0 = y-ch;
49904998
x1 = nx-cw;
49914999
y1 = y+ch;
@@ -5037,10 +5045,13 @@
50375045
pik_append(p, " font-style=\"italic\"", -1);
50385046
}
50395047
if( t->eCode & TP_BOLD ){
50405048
pik_append(p, " font-weight=\"bold\"", -1);
50415049
}
5050
+ if( t->eCode & TP_MONO ){
5051
+ pik_append(p, " font-family=\"monospace\"", -1);
5052
+ }
50425053
if( pObj->color>=0.0 ){
50435054
pik_append_clr(p, " fill=\"", pObj->color, "\"",0);
50445055
}
50455056
xtraFontScale *= p->fontScale;
50465057
if( xtraFontScale<=0.99 || xtraFontScale>=1.01 ){
@@ -6044,12 +6055,13 @@
60446055
case T_LJUST: iRes = (iRes&~TP_JMASK) | TP_LJUST; break;
60456056
case T_RJUST: iRes = (iRes&~TP_JMASK) | TP_RJUST; break;
60466057
case T_ABOVE: iRes = (iRes&~TP_VMASK) | TP_ABOVE; break;
60476058
case T_CENTER: iRes = (iRes&~TP_VMASK) | TP_CENTER; break;
60486059
case T_BELOW: iRes = (iRes&~TP_VMASK) | TP_BELOW; break;
6049
- case T_ITALIC: iRes |= TP_ITALIC; break;
6050
- case T_BOLD: iRes |= TP_BOLD; break;
6060
+ case T_ITALIC: iRes |= TP_ITALIC; break;
6061
+ case T_BOLD: iRes |= TP_BOLD; break;
6062
+ case T_MONO: iRes |= TP_MONO; break;
60516063
case T_ALIGNED: iRes |= TP_ALIGN; break;
60526064
case T_BIG: if( iRes & TP_BIG ) iRes |= TP_XTRA;
60536065
else iRes = (iRes &~TP_SZMASK)|TP_BIG; break;
60546066
case T_SMALL: if( iRes & TP_SMALL ) iRes |= TP_XTRA;
60556067
else iRes = (iRes &~TP_SZMASK)|TP_SMALL; break;
@@ -6180,15 +6192,17 @@
61806192
**
61816193
** Omit "\" used to escape characters. And count entities like
61826194
** "&lt;" as a single character. Multi-byte UTF8 characters count
61836195
** as a single character.
61846196
**
6185
-** Attempt to scale the answer by the actual characters seen. Wide
6186
-** characters count more than narrow characters. But the widths are
6187
-** only guesses.
6197
+** Unless using a monospaced font, attempt to scale the answer by
6198
+** the actual characters seen. Wide characters count more than
6199
+** narrow characters. But the widths are only guesses.
6200
+**
61886201
*/
6189
-static int pik_text_length(const PToken *pToken){
6202
+static int pik_text_length(const PToken *pToken, const int isMonospace){
6203
+ const int stdAvg=100, monoAvg=82;
61906204
int n = pToken->n;
61916205
const char *z = pToken->z;
61926206
int cnt, j;
61936207
for(j=1, cnt=0; j<n-1; j++){
61946208
char c = z[j];
@@ -6196,22 +6210,24 @@
61966210
c = z[++j];
61976211
}else if( c=='&' ){
61986212
int k;
61996213
for(k=j+1; k<j+7 && z[k]!=0 && z[k]!=';'; k++){}
62006214
if( z[k]==';' ) j = k;
6201
- cnt += 150;
6215
+ cnt += (isMonospace ? monoAvg : stdAvg) * 3 / 2;
62026216
continue;
62036217
}
62046218
if( (c & 0xc0)==0xc0 ){
62056219
while( j+1<n-1 && (z[j+1]&0xc0)==0x80 ){ j++; }
6206
- cnt += 100;
6220
+ cnt += isMonospace ? monoAvg : stdAvg;
62076221
continue;
62086222
}
6209
- if( c>=0x20 && c<=0x7e ){
6223
+ if( isMonospace ){
6224
+ cnt += monoAvg;
6225
+ }else if( c >= 0x20 && c <= 0x7e ){
62106226
cnt += awChar[c-0x20];
62116227
}else{
6212
- cnt += 100;
6228
+ cnt += stdAvg;
62136229
}
62146230
}
62156231
return cnt;
62166232
}
62176233
@@ -7195,10 +7211,12 @@
71957211
{ "last", 4, T_LAST, 0, 0 },
71967212
{ "left", 4, T_LEFT, DIR_LEFT, CP_W },
71977213
{ "ljust", 5, T_LJUST, 0, 0 },
71987214
{ "max", 3, T_FUNC2, FN_MAX, 0 },
71997215
{ "min", 3, T_FUNC2, FN_MIN, 0 },
7216
+ { "mono", 4, T_MONO, 0, 0 },
7217
+ { "monospace", 9, T_MONO, 0, 0 },
72007218
{ "n", 1, T_EDGEPT, 0, CP_N },
72017219
{ "ne", 2, T_EDGEPT, 0, CP_NE },
72027220
{ "north", 5, T_EDGEPT, 0, CP_N },
72037221
{ "nw", 2, T_EDGEPT, 0, CP_NW },
72047222
{ "of", 2, T_OF, 0, 0 },
@@ -8122,6 +8140,6 @@
81228140
81238141
81248142
#endif /* PIKCHR_TCL */
81258143
81268144
8127
-#line 8152 "pikchr.c"
8145
+#line 8170 "pikchr.c"
81288146
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -59,11 +59,11 @@
59 ** cc pikchr.c -o pikchr.o
60 **
61 ** Add -DPIKCHR_SHELL to add a main() routine that reads input files
62 ** and sends them through Pikchr, for testing. Add -DPIKCHR_FUZZ for
63 ** -fsanitizer=fuzzer testing.
64 **
65 ****************************************************************************
66 ** IMPLEMENTATION NOTES (for people who want to understand the internal
67 ** operation of this software, perhaps to extend the code or to fix bugs):
68 **
69 ** Each call to pikchr() uses a single instance of the Pik structure to
@@ -203,12 +203,13 @@
203 #define TP_SMALL 0x0200 /* Smaller font */
204 #define TP_XTRA 0x0400 /* Amplify TP_BIG or TP_SMALL */
205 #define TP_SZMASK 0x0700 /* Font size mask */
206 #define TP_ITALIC 0x1000 /* Italic font */
207 #define TP_BOLD 0x2000 /* Bold font */
208 #define TP_FMASK 0x3000 /* Mask for font style */
209 #define TP_ALIGN 0x4000 /* Rotate to align with the line */
 
210
211 /* An object to hold a position in 2-D space */
212 struct PPoint {
213 PNum x, y; /* X and Y coordinates */
214 };
@@ -470,11 +471,11 @@
470 static void pik_bbox_init(PBox*);
471 static void pik_bbox_addbox(PBox*,PBox*);
472 static void pik_bbox_add_xy(PBox*,PNum,PNum);
473 static void pik_bbox_addellipse(PBox*,PNum x,PNum y,PNum rx,PNum ry);
474 static void pik_add_txt(Pik*,PToken*,int);
475 static int pik_text_length(const PToken *pToken);
476 static void pik_size_to_fit(Pik*,PToken*,int);
477 static int pik_text_position(int,PToken*);
478 static PNum pik_property_of(PObj*,PToken*);
479 static PNum pik_func(Pik*,PToken*,PNum,PNum);
480 static PPoint pik_position_between(PNum x, PPoint p1, PPoint p2);
@@ -489,11 +490,11 @@
489 static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*);
490 static PNum pik_dist(PPoint*,PPoint*);
491 static void pik_add_macro(Pik*,PToken *pId,PToken *pCode);
492
493
494 #line 520 "pikchr.c"
495 /**************** End of %include directives **********************************/
496 /* These constants specify the various numeric values for terminal symbols.
497 ***************** Begin token definitions *************************************/
498 #ifndef T_ID
499 #define T_ID 1
@@ -564,38 +565,39 @@
564 #define T_RJUST 66
565 #define T_ABOVE 67
566 #define T_BELOW 68
567 #define T_ITALIC 69
568 #define T_BOLD 70
569 #define T_ALIGNED 71
570 #define T_BIG 72
571 #define T_SMALL 73
572 #define T_AND 74
573 #define T_LT 75
574 #define T_GT 76
575 #define T_ON 77
576 #define T_WAY 78
577 #define T_BETWEEN 79
578 #define T_THE 80
579 #define T_NTH 81
580 #define T_VERTEX 82
581 #define T_TOP 83
582 #define T_BOTTOM 84
583 #define T_START 85
584 #define T_END 86
585 #define T_IN 87
586 #define T_THIS 88
587 #define T_DOT_U 89
588 #define T_LAST 90
589 #define T_NUMBER 91
590 #define T_FUNC1 92
591 #define T_FUNC2 93
592 #define T_DIST 94
593 #define T_DOT_XY 95
594 #define T_X 96
595 #define T_Y 97
596 #define T_DOT_L 98
 
597 #endif
598 /**************** End token definitions ***************************************/
599
600 /* The next sections is a series of control #defines.
601 ** various aspects of the generated parser.
@@ -651,22 +653,22 @@
651 #ifndef INTERFACE
652 # define INTERFACE 1
653 #endif
654 /************* Begin control #defines *****************************************/
655 #define YYCODETYPE unsigned char
656 #define YYNOCODE 135
657 #define YYACTIONTYPE unsigned short int
658 #define pik_parserTOKENTYPE PToken
659 typedef union {
660 int yyinit;
661 pik_parserTOKENTYPE yy0;
662 PRel yy10;
663 PObj* yy36;
664 PPoint yy79;
665 PNum yy153;
666 short int yy164;
667 PList* yy227;
668 } YYMINORTYPE;
669 #ifndef YYSTACKDEPTH
670 #define YYSTACKDEPTH 100
671 #endif
672 #define pik_parserARG_SDECL
@@ -681,11 +683,11 @@
681 #define pik_parserCTX_STORE yypParser->p=p;
682 #define YYFALLBACK 1
683 #define YYNSTATE 164
684 #define YYNRULE 156
685 #define YYNRULE_WITH_ACTION 116
686 #define YYNTOKEN 99
687 #define YY_MAX_SHIFT 163
688 #define YY_MIN_SHIFTREDUCE 287
689 #define YY_MAX_SHIFTREDUCE 442
690 #define YY_ERROR_ACTION 443
691 #define YY_ACCEPT_ACTION 444
@@ -756,322 +758,324 @@
756 ** yy_reduce_ofst[] For each state, the offset into yy_action for
757 ** shifting non-terminals after a reduce.
758 ** yy_default[] Default action for each state.
759 **
760 *********** Begin parsing tables **********************************************/
761 #define YY_ACTTAB_COUNT (1303)
762 static const YYACTIONTYPE yy_action[] = {
763 /* 0 */ 575, 495, 161, 119, 25, 452, 29, 74, 129, 148,
764 /* 10 */ 575, 492, 161, 119, 453, 113, 120, 161, 119, 530,
765 /* 20 */ 427, 428, 339, 559, 81, 30, 560, 561, 575, 64,
766 /* 30 */ 63, 62, 61, 322, 323, 9, 8, 33, 149, 32,
767 /* 40 */ 7, 71, 127, 38, 335, 66, 48, 37, 28, 339,
768 /* 50 */ 339, 339, 339, 425, 426, 340, 341, 342, 343, 344,
769 /* 60 */ 345, 346, 347, 348, 474, 528, 161, 119, 577, 77,
770 /* 70 */ 577, 73, 376, 148, 474, 533, 161, 119, 112, 113,
771 /* 80 */ 120, 161, 119, 128, 427, 428, 339, 357, 81, 531,
772 /* 90 */ 161, 119, 474, 36, 330, 13, 306, 322, 323, 9,
773 /* 100 */ 8, 33, 149, 32, 7, 71, 127, 328, 335, 66,
774 /* 110 */ 579, 310, 31, 339, 339, 339, 339, 425, 426, 340,
775 /* 120 */ 341, 342, 343, 344, 345, 346, 347, 348, 394, 435,
776 /* 130 */ 46, 59, 60, 64, 63, 62, 61, 54, 51, 376,
777 /* 140 */ 69, 108, 2, 47, 403, 83, 297, 435, 375, 84,
778 /* 150 */ 117, 80, 35, 308, 79, 133, 122, 126, 441, 440,
779 /* 160 */ 299, 123, 3, 404, 405, 406, 408, 80, 298, 308,
780 /* 170 */ 79, 4, 411, 412, 413, 414, 441, 440, 350, 350,
781 /* 180 */ 350, 350, 350, 350, 350, 350, 350, 350, 62, 61,
782 /* 190 */ 67, 434, 1, 75, 378, 158, 74, 76, 148, 411,
783 /* 200 */ 412, 413, 414, 124, 113, 120, 161, 119, 106, 434,
784 /* 210 */ 436, 437, 438, 439, 5, 375, 6, 117, 393, 155,
785 /* 220 */ 154, 153, 394, 435, 69, 59, 60, 149, 436, 437,
786 /* 230 */ 438, 439, 535, 376, 398, 399, 2, 424, 427, 428,
787 /* 240 */ 339, 156, 156, 156, 423, 394, 435, 65, 59, 60,
788 /* 250 */ 162, 131, 441, 440, 397, 72, 376, 148, 118, 2,
789 /* 260 */ 380, 157, 125, 113, 120, 161, 119, 339, 339, 339,
790 /* 270 */ 339, 425, 426, 535, 11, 441, 440, 394, 356, 535,
791 /* 280 */ 59, 60, 535, 379, 159, 434, 149, 12, 102, 446,
792 /* 290 */ 432, 42, 138, 14, 435, 139, 301, 302, 303, 36,
793 /* 300 */ 305, 430, 106, 16, 436, 437, 438, 439, 434, 375,
794 /* 310 */ 18, 117, 393, 155, 154, 153, 44, 142, 140, 64,
795 /* 320 */ 63, 62, 61, 441, 440, 106, 19, 436, 437, 438,
796 /* 330 */ 439, 45, 375, 20, 117, 393, 155, 154, 153, 68,
797 /* 340 */ 55, 114, 64, 63, 62, 61, 147, 146, 394, 473,
798 /* 350 */ 359, 59, 60, 43, 23, 391, 434, 106, 26, 376,
799 /* 360 */ 57, 58, 42, 49, 375, 392, 117, 393, 155, 154,
800 /* 370 */ 153, 64, 63, 62, 61, 436, 437, 438, 439, 384,
801 /* 380 */ 382, 383, 22, 21, 377, 473, 160, 70, 39, 445,
802 /* 390 */ 24, 445, 145, 141, 431, 142, 140, 64, 63, 62,
803 /* 400 */ 61, 394, 15, 445, 59, 60, 64, 63, 62, 61,
804 /* 410 */ 391, 445, 376, 445, 445, 42, 445, 445, 55, 391,
805 /* 420 */ 156, 156, 156, 445, 147, 146, 445, 52, 106, 445,
806 /* 430 */ 445, 43, 445, 445, 445, 375, 445, 117, 393, 155,
807 /* 440 */ 154, 153, 445, 394, 143, 445, 59, 60, 64, 63,
808 /* 450 */ 62, 61, 313, 445, 376, 378, 158, 42, 445, 445,
809 /* 460 */ 22, 21, 121, 447, 454, 29, 445, 445, 24, 450,
810 /* 470 */ 145, 141, 431, 142, 140, 64, 63, 62, 61, 445,
811 /* 480 */ 163, 106, 445, 445, 444, 27, 445, 445, 375, 445,
812 /* 490 */ 117, 393, 155, 154, 153, 445, 55, 74, 445, 148,
813 /* 500 */ 445, 445, 147, 146, 497, 113, 120, 161, 119, 43,
814 /* 510 */ 445, 394, 445, 445, 59, 60, 445, 445, 445, 118,
815 /* 520 */ 445, 445, 376, 106, 445, 42, 445, 445, 149, 445,
816 /* 530 */ 375, 445, 117, 393, 155, 154, 153, 445, 22, 21,
817 /* 540 */ 394, 144, 445, 59, 60, 445, 24, 445, 145, 141,
818 /* 550 */ 431, 376, 445, 445, 42, 445, 132, 130, 394, 445,
819 /* 560 */ 445, 59, 60, 109, 447, 454, 29, 445, 445, 376,
820 /* 570 */ 450, 445, 42, 445, 394, 445, 445, 59, 60, 445,
821 /* 580 */ 445, 163, 445, 445, 445, 102, 27, 445, 42, 445,
822 /* 590 */ 445, 106, 445, 64, 63, 62, 61, 445, 375, 445,
823 /* 600 */ 117, 393, 155, 154, 153, 394, 355, 445, 59, 60,
824 /* 610 */ 445, 445, 445, 445, 445, 74, 376, 148, 445, 40,
825 /* 620 */ 106, 445, 496, 113, 120, 161, 119, 375, 445, 117,
826 /* 630 */ 393, 155, 154, 153, 445, 448, 454, 29, 106, 445,
827 /* 640 */ 445, 450, 445, 445, 445, 375, 149, 117, 393, 155,
828 /* 650 */ 154, 153, 163, 445, 106, 445, 445, 27, 445, 445,
829 /* 660 */ 445, 375, 445, 117, 393, 155, 154, 153, 394, 445,
830 /* 670 */ 445, 59, 60, 64, 63, 62, 61, 445, 445, 376,
831 /* 680 */ 445, 445, 41, 445, 445, 106, 354, 64, 63, 62,
832 /* 690 */ 61, 445, 375, 445, 117, 393, 155, 154, 153, 445,
833 /* 700 */ 445, 445, 74, 445, 148, 445, 88, 445, 445, 490,
834 /* 710 */ 113, 120, 161, 119, 445, 120, 161, 119, 17, 74,
835 /* 720 */ 445, 148, 110, 110, 445, 445, 484, 113, 120, 161,
836 /* 730 */ 119, 445, 445, 149, 74, 445, 148, 152, 445, 445,
837 /* 740 */ 445, 483, 113, 120, 161, 119, 445, 445, 106, 445,
838 /* 750 */ 149, 445, 445, 107, 445, 375, 445, 117, 393, 155,
839 /* 760 */ 154, 153, 120, 161, 119, 149, 478, 74, 445, 148,
840 /* 770 */ 445, 88, 445, 445, 480, 113, 120, 161, 119, 445,
841 /* 780 */ 120, 161, 119, 74, 152, 148, 10, 479, 479, 445,
842 /* 790 */ 134, 113, 120, 161, 119, 445, 445, 445, 149, 74,
843 /* 800 */ 445, 148, 152, 445, 445, 445, 517, 113, 120, 161,
844 /* 810 */ 119, 445, 445, 74, 149, 148, 445, 445, 445, 445,
845 /* 820 */ 137, 113, 120, 161, 119, 74, 445, 148, 445, 445,
846 /* 830 */ 149, 445, 525, 113, 120, 161, 119, 445, 74, 445,
847 /* 840 */ 148, 445, 445, 445, 149, 527, 113, 120, 161, 119,
848 /* 850 */ 445, 445, 74, 445, 148, 445, 149, 445, 445, 524,
849 /* 860 */ 113, 120, 161, 119, 74, 445, 148, 445, 445, 149,
850 /* 870 */ 445, 526, 113, 120, 161, 119, 445, 445, 74, 445,
851 /* 880 */ 148, 445, 88, 149, 445, 523, 113, 120, 161, 119,
852 /* 890 */ 445, 120, 161, 119, 74, 149, 148, 85, 111, 111,
853 /* 900 */ 445, 522, 113, 120, 161, 119, 120, 161, 119, 149,
854 /* 910 */ 74, 445, 148, 152, 445, 445, 445, 521, 113, 120,
855 /* 920 */ 161, 119, 445, 445, 74, 149, 148, 445, 152, 445,
856 /* 930 */ 445, 520, 113, 120, 161, 119, 74, 445, 148, 445,
857 /* 940 */ 445, 149, 445, 519, 113, 120, 161, 119, 445, 74,
858 /* 950 */ 445, 148, 445, 445, 445, 149, 150, 113, 120, 161,
859 /* 960 */ 119, 445, 445, 74, 445, 148, 445, 149, 445, 445,
860 /* 970 */ 151, 113, 120, 161, 119, 74, 445, 148, 445, 445,
861 /* 980 */ 149, 445, 136, 113, 120, 161, 119, 445, 445, 74,
862 /* 990 */ 445, 148, 107, 445, 149, 445, 135, 113, 120, 161,
863 /* 1000 */ 119, 120, 161, 119, 445, 463, 149, 445, 88, 445,
864 /* 1010 */ 445, 445, 78, 78, 445, 445, 107, 120, 161, 119,
865 /* 1020 */ 149, 445, 445, 152, 82, 120, 161, 119, 445, 463,
866 /* 1030 */ 445, 466, 86, 34, 445, 88, 445, 569, 445, 152,
867 /* 1040 */ 445, 120, 161, 119, 120, 161, 119, 152, 107, 445,
868 /* 1050 */ 445, 475, 64, 63, 62, 61, 445, 120, 161, 119,
869 /* 1060 */ 98, 451, 445, 152, 89, 396, 152, 90, 445, 120,
870 /* 1070 */ 161, 119, 445, 120, 161, 119, 120, 161, 119, 152,
871 /* 1080 */ 445, 64, 63, 62, 61, 445, 445, 445, 445, 445,
872 /* 1090 */ 87, 152, 445, 99, 395, 152, 100, 445, 152, 120,
873 /* 1100 */ 161, 119, 120, 161, 119, 120, 161, 119, 445, 101,
874 /* 1110 */ 64, 63, 62, 61, 445, 445, 445, 445, 120, 161,
875 /* 1120 */ 119, 152, 91, 391, 152, 445, 445, 152, 103, 445,
876 /* 1130 */ 445, 120, 161, 119, 445, 92, 445, 120, 161, 119,
877 /* 1140 */ 152, 93, 445, 445, 120, 161, 119, 104, 445, 445,
878 /* 1150 */ 120, 161, 119, 152, 445, 445, 120, 161, 119, 152,
879 /* 1160 */ 445, 445, 445, 445, 94, 445, 152, 445, 445, 445,
880 /* 1170 */ 105, 445, 152, 120, 161, 119, 445, 95, 152, 120,
881 /* 1180 */ 161, 119, 96, 445, 445, 445, 120, 161, 119, 445,
882 /* 1190 */ 445, 120, 161, 119, 97, 152, 445, 445, 445, 445,
883 /* 1200 */ 549, 152, 445, 120, 161, 119, 548, 445, 152, 120,
884 /* 1210 */ 161, 119, 445, 152, 445, 120, 161, 119, 445, 445,
885 /* 1220 */ 445, 445, 445, 547, 445, 152, 445, 445, 445, 445,
886 /* 1230 */ 445, 152, 120, 161, 119, 546, 445, 152, 445, 115,
887 /* 1240 */ 445, 445, 116, 445, 120, 161, 119, 445, 120, 161,
888 /* 1250 */ 119, 120, 161, 119, 152, 64, 63, 62, 61, 64,
889 /* 1260 */ 63, 62, 61, 445, 445, 445, 152, 445, 445, 445,
890 /* 1270 */ 152, 445, 445, 152, 445, 445, 50, 445, 445, 445,
891 /* 1280 */ 53, 64, 63, 62, 61, 445, 445, 445, 445, 445,
892 /* 1290 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
893 /* 1300 */ 445, 445, 56,
 
894 };
895 static const YYCODETYPE yy_lookahead[] = {
896 /* 0 */ 0, 112, 113, 114, 133, 101, 102, 103, 105, 105,
897 /* 10 */ 10, 112, 113, 114, 110, 111, 112, 113, 114, 105,
898 /* 20 */ 20, 21, 22, 104, 24, 125, 107, 108, 28, 4,
899 /* 30 */ 5, 6, 7, 33, 34, 35, 36, 37, 134, 39,
900 /* 40 */ 40, 41, 42, 104, 44, 45, 107, 108, 106, 49,
901 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
902 /* 60 */ 60, 61, 62, 63, 0, 112, 113, 114, 129, 130,
903 /* 70 */ 131, 103, 12, 105, 10, 112, 113, 114, 110, 111,
904 /* 80 */ 112, 113, 114, 105, 20, 21, 22, 17, 24, 112,
905 /* 90 */ 113, 114, 28, 10, 2, 25, 25, 33, 34, 35,
906 /* 100 */ 36, 37, 134, 39, 40, 41, 42, 2, 44, 45,
907 /* 110 */ 132, 28, 127, 49, 50, 51, 52, 53, 54, 55,
908 /* 120 */ 56, 57, 58, 59, 60, 61, 62, 63, 1, 2,
909 /* 130 */ 38, 4, 5, 4, 5, 6, 7, 4, 5, 12,
910 /* 140 */ 3, 81, 15, 38, 1, 115, 17, 2, 88, 115,
911 /* 150 */ 90, 24, 128, 26, 27, 12, 1, 14, 31, 32,
912 /* 160 */ 19, 18, 16, 20, 21, 22, 23, 24, 17, 26,
913 /* 170 */ 27, 15, 29, 30, 31, 32, 31, 32, 64, 65,
914 /* 180 */ 66, 67, 68, 69, 70, 71, 72, 73, 6, 7,
915 /* 190 */ 43, 64, 13, 48, 26, 27, 103, 48, 105, 29,
916 /* 200 */ 30, 31, 32, 110, 111, 112, 113, 114, 81, 64,
917 /* 210 */ 83, 84, 85, 86, 40, 88, 40, 90, 91, 92,
918 /* 220 */ 93, 94, 1, 2, 87, 4, 5, 134, 83, 84,
919 /* 230 */ 85, 86, 48, 12, 96, 97, 15, 41, 20, 21,
920 /* 240 */ 22, 20, 21, 22, 41, 1, 2, 98, 4, 5,
921 /* 250 */ 82, 47, 31, 32, 17, 103, 12, 105, 90, 15,
922 /* 260 */ 26, 27, 110, 111, 112, 113, 114, 49, 50, 51,
923 /* 270 */ 52, 53, 54, 89, 25, 31, 32, 1, 17, 95,
924 /* 280 */ 4, 5, 98, 26, 27, 64, 134, 74, 12, 0,
925 /* 290 */ 79, 15, 78, 3, 2, 80, 20, 21, 22, 10,
926 /* 300 */ 24, 79, 81, 3, 83, 84, 85, 86, 64, 88,
927 /* 310 */ 3, 90, 91, 92, 93, 94, 38, 2, 3, 4,
928 /* 320 */ 5, 6, 7, 31, 32, 81, 3, 83, 84, 85,
929 /* 330 */ 86, 16, 88, 3, 90, 91, 92, 93, 94, 3,
930 /* 340 */ 25, 95, 4, 5, 6, 7, 31, 32, 1, 2,
931 /* 350 */ 76, 4, 5, 38, 25, 17, 64, 81, 15, 12,
932 /* 360 */ 15, 15, 15, 25, 88, 17, 90, 91, 92, 93,
933 /* 370 */ 94, 4, 5, 6, 7, 83, 84, 85, 86, 28,
934 /* 380 */ 28, 28, 67, 68, 12, 38, 89, 3, 11, 135,
935 /* 390 */ 75, 135, 77, 78, 79, 2, 3, 4, 5, 6,
936 /* 400 */ 7, 1, 35, 135, 4, 5, 4, 5, 6, 7,
937 /* 410 */ 17, 135, 12, 135, 135, 15, 135, 135, 25, 17,
938 /* 420 */ 20, 21, 22, 135, 31, 32, 135, 25, 81, 135,
939 /* 430 */ 135, 38, 135, 135, 135, 88, 135, 90, 91, 92,
940 /* 440 */ 93, 94, 135, 1, 2, 135, 4, 5, 4, 5,
941 /* 450 */ 6, 7, 8, 135, 12, 26, 27, 15, 135, 135,
942 /* 460 */ 67, 68, 99, 100, 101, 102, 135, 135, 75, 106,
943 /* 470 */ 77, 78, 79, 2, 3, 4, 5, 6, 7, 135,
944 /* 480 */ 117, 81, 135, 135, 121, 122, 135, 135, 88, 135,
945 /* 490 */ 90, 91, 92, 93, 94, 135, 25, 103, 135, 105,
946 /* 500 */ 135, 135, 31, 32, 110, 111, 112, 113, 114, 38,
947 /* 510 */ 135, 1, 135, 135, 4, 5, 135, 135, 135, 90,
948 /* 520 */ 135, 135, 12, 81, 135, 15, 135, 135, 134, 135,
949 /* 530 */ 88, 135, 90, 91, 92, 93, 94, 135, 67, 68,
950 /* 540 */ 1, 2, 135, 4, 5, 135, 75, 135, 77, 78,
951 /* 550 */ 79, 12, 135, 135, 15, 135, 46, 47, 1, 135,
952 /* 560 */ 135, 4, 5, 99, 100, 101, 102, 135, 135, 12,
953 /* 570 */ 106, 135, 15, 135, 1, 135, 135, 4, 5, 135,
954 /* 580 */ 135, 117, 135, 135, 135, 12, 122, 135, 15, 135,
955 /* 590 */ 135, 81, 135, 4, 5, 6, 7, 135, 88, 135,
956 /* 600 */ 90, 91, 92, 93, 94, 1, 17, 135, 4, 5,
957 /* 610 */ 135, 135, 135, 135, 135, 103, 12, 105, 135, 15,
958 /* 620 */ 81, 135, 110, 111, 112, 113, 114, 88, 135, 90,
959 /* 630 */ 91, 92, 93, 94, 135, 100, 101, 102, 81, 135,
960 /* 640 */ 135, 106, 135, 135, 135, 88, 134, 90, 91, 92,
961 /* 650 */ 93, 94, 117, 135, 81, 135, 135, 122, 135, 135,
962 /* 660 */ 135, 88, 135, 90, 91, 92, 93, 94, 1, 135,
963 /* 670 */ 135, 4, 5, 4, 5, 6, 7, 135, 135, 12,
964 /* 680 */ 135, 135, 15, 135, 135, 81, 17, 4, 5, 6,
965 /* 690 */ 7, 135, 88, 135, 90, 91, 92, 93, 94, 135,
966 /* 700 */ 135, 135, 103, 135, 105, 135, 103, 135, 135, 110,
967 /* 710 */ 111, 112, 113, 114, 135, 112, 113, 114, 35, 103,
968 /* 720 */ 135, 105, 119, 120, 135, 135, 110, 111, 112, 113,
969 /* 730 */ 114, 135, 135, 134, 103, 135, 105, 134, 135, 135,
970 /* 740 */ 135, 110, 111, 112, 113, 114, 135, 135, 81, 135,
971 /* 750 */ 134, 135, 135, 103, 135, 88, 135, 90, 91, 92,
972 /* 760 */ 93, 94, 112, 113, 114, 134, 116, 103, 135, 105,
973 /* 770 */ 135, 103, 135, 135, 110, 111, 112, 113, 114, 135,
974 /* 780 */ 112, 113, 114, 103, 134, 105, 118, 119, 120, 135,
975 /* 790 */ 110, 111, 112, 113, 114, 135, 135, 135, 134, 103,
976 /* 800 */ 135, 105, 134, 135, 135, 135, 110, 111, 112, 113,
977 /* 810 */ 114, 135, 135, 103, 134, 105, 135, 135, 135, 135,
978 /* 820 */ 110, 111, 112, 113, 114, 103, 135, 105, 135, 135,
979 /* 830 */ 134, 135, 110, 111, 112, 113, 114, 135, 103, 135,
980 /* 840 */ 105, 135, 135, 135, 134, 110, 111, 112, 113, 114,
981 /* 850 */ 135, 135, 103, 135, 105, 135, 134, 135, 135, 110,
982 /* 860 */ 111, 112, 113, 114, 103, 135, 105, 135, 135, 134,
983 /* 870 */ 135, 110, 111, 112, 113, 114, 135, 135, 103, 135,
984 /* 880 */ 105, 135, 103, 134, 135, 110, 111, 112, 113, 114,
985 /* 890 */ 135, 112, 113, 114, 103, 134, 105, 103, 119, 120,
986 /* 900 */ 135, 110, 111, 112, 113, 114, 112, 113, 114, 134,
987 /* 910 */ 103, 135, 105, 134, 135, 135, 135, 110, 111, 112,
988 /* 920 */ 113, 114, 135, 135, 103, 134, 105, 135, 134, 135,
989 /* 930 */ 135, 110, 111, 112, 113, 114, 103, 135, 105, 135,
990 /* 940 */ 135, 134, 135, 110, 111, 112, 113, 114, 135, 103,
991 /* 950 */ 135, 105, 135, 135, 135, 134, 110, 111, 112, 113,
992 /* 960 */ 114, 135, 135, 103, 135, 105, 135, 134, 135, 135,
993 /* 970 */ 110, 111, 112, 113, 114, 103, 135, 105, 135, 135,
994 /* 980 */ 134, 135, 110, 111, 112, 113, 114, 135, 135, 103,
995 /* 990 */ 135, 105, 103, 135, 134, 135, 110, 111, 112, 113,
996 /* 1000 */ 114, 112, 113, 114, 135, 116, 134, 135, 103, 135,
997 /* 1010 */ 135, 135, 123, 124, 135, 135, 103, 112, 113, 114,
998 /* 1020 */ 134, 135, 135, 134, 119, 112, 113, 114, 135, 116,
999 /* 1030 */ 135, 126, 103, 128, 135, 103, 135, 124, 135, 134,
1000 /* 1040 */ 135, 112, 113, 114, 112, 113, 114, 134, 103, 135,
1001 /* 1050 */ 135, 119, 4, 5, 6, 7, 135, 112, 113, 114,
1002 /* 1060 */ 103, 116, 135, 134, 103, 17, 134, 103, 135, 112,
1003 /* 1070 */ 113, 114, 135, 112, 113, 114, 112, 113, 114, 134,
1004 /* 1080 */ 135, 4, 5, 6, 7, 135, 135, 135, 135, 135,
1005 /* 1090 */ 103, 134, 135, 103, 17, 134, 103, 135, 134, 112,
1006 /* 1100 */ 113, 114, 112, 113, 114, 112, 113, 114, 135, 103,
1007 /* 1110 */ 4, 5, 6, 7, 135, 135, 135, 135, 112, 113,
1008 /* 1120 */ 114, 134, 103, 17, 134, 135, 135, 134, 103, 135,
1009 /* 1130 */ 135, 112, 113, 114, 135, 103, 135, 112, 113, 114,
1010 /* 1140 */ 134, 103, 135, 135, 112, 113, 114, 103, 135, 135,
1011 /* 1150 */ 112, 113, 114, 134, 135, 135, 112, 113, 114, 134,
1012 /* 1160 */ 135, 135, 135, 135, 103, 135, 134, 135, 135, 135,
1013 /* 1170 */ 103, 135, 134, 112, 113, 114, 135, 103, 134, 112,
1014 /* 1180 */ 113, 114, 103, 135, 135, 135, 112, 113, 114, 135,
1015 /* 1190 */ 135, 112, 113, 114, 103, 134, 135, 135, 135, 135,
1016 /* 1200 */ 103, 134, 135, 112, 113, 114, 103, 135, 134, 112,
1017 /* 1210 */ 113, 114, 135, 134, 135, 112, 113, 114, 135, 135,
1018 /* 1220 */ 135, 135, 135, 103, 135, 134, 135, 135, 135, 135,
1019 /* 1230 */ 135, 134, 112, 113, 114, 103, 135, 134, 135, 103,
1020 /* 1240 */ 135, 135, 103, 135, 112, 113, 114, 135, 112, 113,
1021 /* 1250 */ 114, 112, 113, 114, 134, 4, 5, 6, 7, 4,
1022 /* 1260 */ 5, 6, 7, 135, 135, 135, 134, 135, 135, 135,
1023 /* 1270 */ 134, 135, 135, 134, 135, 135, 25, 135, 135, 135,
1024 /* 1280 */ 25, 4, 5, 6, 7, 135, 135, 135, 135, 135,
1025 /* 1290 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1026 /* 1300 */ 135, 135, 25, 135, 135, 135, 135, 135, 135, 135,
1027 /* 1310 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1028 /* 1320 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1029 /* 1330 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1030 /* 1340 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1031 /* 1350 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1032 /* 1360 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1033 /* 1370 */ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
1034 /* 1380 */ 135, 99, 99, 99, 99, 99, 99, 99, 99, 99,
1035 /* 1390 */ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
1036 /* 1400 */ 99, 99,
 
1037 };
1038 #define YY_SHIFT_COUNT (163)
1039 #define YY_SHIFT_MIN (0)
1040 #define YY_SHIFT_MAX (1277)
1041 static const unsigned short int yy_shift_ofst[] = {
1042 /* 0 */ 143, 127, 221, 244, 244, 244, 244, 244, 244, 244,
1043 /* 10 */ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
1044 /* 20 */ 244, 244, 244, 244, 244, 244, 244, 276, 510, 557,
1045 /* 30 */ 276, 143, 347, 347, 0, 64, 143, 573, 557, 573,
1046 /* 40 */ 400, 400, 400, 442, 539, 557, 557, 557, 557, 557,
1047 /* 50 */ 557, 604, 557, 557, 667, 557, 557, 557, 557, 557,
1048 /* 60 */ 557, 557, 557, 557, 557, 218, 60, 60, 60, 60,
1049 /* 70 */ 60, 145, 315, 393, 471, 292, 292, 170, 71, 1303,
1050 /* 80 */ 1303, 1303, 1303, 114, 114, 338, 402, 129, 444, 367,
1051 /* 90 */ 683, 589, 1251, 669, 1255, 1048, 1277, 1077, 1106, 25,
1052 /* 100 */ 25, 25, 184, 25, 25, 25, 168, 25, 429, 83,
1053 /* 110 */ 92, 105, 70, 133, 138, 182, 182, 234, 257, 137,
1054 /* 120 */ 149, 289, 141, 155, 151, 146, 156, 147, 174, 176,
1055 /* 130 */ 196, 203, 204, 179, 237, 249, 213, 261, 211, 214,
1056 /* 140 */ 215, 222, 290, 300, 307, 278, 323, 330, 336, 246,
1057 /* 150 */ 274, 329, 246, 343, 345, 346, 348, 351, 352, 353,
1058 /* 160 */ 372, 297, 384, 377,
1059 };
1060 #define YY_REDUCE_COUNT (82)
1061 #define YY_REDUCE_MIN (-129)
1062 #define YY_REDUCE_MAX (1139)
1063 static const short yy_reduce_ofst[] = {
1064 /* 0 */ 363, -96, -32, 93, 152, 394, 512, 599, 616, 631,
1065 /* 10 */ 664, 680, 696, 710, 722, 735, 749, 761, 775, 791,
1066 /* 20 */ 807, 821, 833, 846, 860, 872, 886, 889, 668, 905,
1067 /* 30 */ 913, 464, 603, 779, -61, -61, 535, 650, 932, 945,
1068 /* 40 */ 794, 929, 957, 961, 964, 987, 990, 993, 1006, 1019,
1069 /* 50 */ 1025, 1032, 1038, 1044, 1061, 1067, 1074, 1079, 1091, 1097,
1070 /* 60 */ 1103, 1120, 1132, 1136, 1139, -81, -111, -101, -47, -37,
1071 /* 70 */ -23, -22, -129, -129, -129, -97, -86, -58, -100, -15,
1072 /* 80 */ 30, 34, 24,
1073 };
1074 static const YYACTIONTYPE yy_default[] = {
1075 /* 0 */ 449, 443, 443, 443, 443, 443, 443, 443, 443, 443,
1076 /* 10 */ 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
1077 /* 20 */ 443, 443, 443, 443, 443, 443, 443, 443, 473, 576,
@@ -1177,10 +1181,11 @@
1177 0, /* RJUST => nothing */
1178 0, /* ABOVE => nothing */
1179 0, /* BELOW => nothing */
1180 0, /* ITALIC => nothing */
1181 0, /* BOLD => nothing */
 
1182 0, /* ALIGNED => nothing */
1183 0, /* BIG => nothing */
1184 0, /* SMALL => nothing */
1185 0, /* AND => nothing */
1186 0, /* LT => nothing */
@@ -1364,74 +1369,75 @@
1364 /* 66 */ "RJUST",
1365 /* 67 */ "ABOVE",
1366 /* 68 */ "BELOW",
1367 /* 69 */ "ITALIC",
1368 /* 70 */ "BOLD",
1369 /* 71 */ "ALIGNED",
1370 /* 72 */ "BIG",
1371 /* 73 */ "SMALL",
1372 /* 74 */ "AND",
1373 /* 75 */ "LT",
1374 /* 76 */ "GT",
1375 /* 77 */ "ON",
1376 /* 78 */ "WAY",
1377 /* 79 */ "BETWEEN",
1378 /* 80 */ "THE",
1379 /* 81 */ "NTH",
1380 /* 82 */ "VERTEX",
1381 /* 83 */ "TOP",
1382 /* 84 */ "BOTTOM",
1383 /* 85 */ "START",
1384 /* 86 */ "END",
1385 /* 87 */ "IN",
1386 /* 88 */ "THIS",
1387 /* 89 */ "DOT_U",
1388 /* 90 */ "LAST",
1389 /* 91 */ "NUMBER",
1390 /* 92 */ "FUNC1",
1391 /* 93 */ "FUNC2",
1392 /* 94 */ "DIST",
1393 /* 95 */ "DOT_XY",
1394 /* 96 */ "X",
1395 /* 97 */ "Y",
1396 /* 98 */ "DOT_L",
1397 /* 99 */ "statement_list",
1398 /* 100 */ "statement",
1399 /* 101 */ "unnamed_statement",
1400 /* 102 */ "basetype",
1401 /* 103 */ "expr",
1402 /* 104 */ "numproperty",
1403 /* 105 */ "edge",
1404 /* 106 */ "direction",
1405 /* 107 */ "dashproperty",
1406 /* 108 */ "colorproperty",
1407 /* 109 */ "locproperty",
1408 /* 110 */ "position",
1409 /* 111 */ "place",
1410 /* 112 */ "object",
1411 /* 113 */ "objectname",
1412 /* 114 */ "nth",
1413 /* 115 */ "textposition",
1414 /* 116 */ "rvalue",
1415 /* 117 */ "lvalue",
1416 /* 118 */ "even",
1417 /* 119 */ "relexpr",
1418 /* 120 */ "optrelexpr",
1419 /* 121 */ "document",
1420 /* 122 */ "print",
1421 /* 123 */ "prlist",
1422 /* 124 */ "pritem",
1423 /* 125 */ "prsep",
1424 /* 126 */ "attribute_list",
1425 /* 127 */ "savelist",
1426 /* 128 */ "alist",
1427 /* 129 */ "attribute",
1428 /* 130 */ "go",
1429 /* 131 */ "boolproperty",
1430 /* 132 */ "withclause",
1431 /* 133 */ "between",
1432 /* 134 */ "place2",
 
1433 };
1434 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
1435
1436 #ifndef NDEBUG
1437 /* For tracing reduce actions, the names of all rules are required.
@@ -1498,11 +1504,11 @@
1498 /* 58 */ "boolproperty ::= INVIS",
1499 /* 59 */ "boolproperty ::= THICK",
1500 /* 60 */ "boolproperty ::= THIN",
1501 /* 61 */ "boolproperty ::= SOLID",
1502 /* 62 */ "textposition ::=",
1503 /* 63 */ "textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL",
1504 /* 64 */ "position ::= expr COMMA expr",
1505 /* 65 */ "position ::= place PLUS expr COMMA expr",
1506 /* 66 */ "position ::= place MINUS expr COMMA expr",
1507 /* 67 */ "position ::= place PLUS LP expr COMMA expr RP",
1508 /* 68 */ "position ::= place MINUS LP expr COMMA expr RP",
@@ -1716,24 +1722,24 @@
1716 ** Note: during a reduce, the only symbols destroyed are those
1717 ** which appear on the RHS of the rule, but which are *not* used
1718 ** inside the C code.
1719 */
1720 /********* Begin destructor definitions ***************************************/
1721 case 99: /* statement_list */
1722 {
1723 #line 509 "pikchr.y"
1724 pik_elist_free(p,(yypminor->yy227));
1725 #line 1750 "pikchr.c"
1726 }
1727 break;
1728 case 100: /* statement */
1729 case 101: /* unnamed_statement */
1730 case 102: /* basetype */
1731 {
1732 #line 511 "pikchr.y"
1733 pik_elem_free(p,(yypminor->yy36));
1734 #line 1759 "pikchr.c"
1735 }
1736 break;
1737 /********* End destructor definitions *****************************************/
1738 default: break; /* If no destructor action specified: do nothing */
1739 }
@@ -1947,14 +1953,14 @@
1947 #endif
1948 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1949 /* Here code is inserted which will execute if the parser
1950 ** stack every overflows */
1951 /******** Begin %stack_overflow code ******************************************/
1952 #line 543 "pikchr.y"
1953
1954 pik_error(p, 0, "parser stack overflow");
1955 #line 1980 "pikchr.c"
1956 /******** End %stack_overflow code ********************************************/
1957 pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
1958 pik_parserCTX_STORE
1959 }
1960
@@ -2022,166 +2028,166 @@
2022 }
2023
2024 /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
2025 ** of that rule */
2026 static const YYCODETYPE yyRuleInfoLhs[] = {
2027 121, /* (0) document ::= statement_list */
2028 99, /* (1) statement_list ::= statement */
2029 99, /* (2) statement_list ::= statement_list EOL statement */
2030 100, /* (3) statement ::= */
2031 100, /* (4) statement ::= direction */
2032 100, /* (5) statement ::= lvalue ASSIGN rvalue */
2033 100, /* (6) statement ::= PLACENAME COLON unnamed_statement */
2034 100, /* (7) statement ::= PLACENAME COLON position */
2035 100, /* (8) statement ::= unnamed_statement */
2036 100, /* (9) statement ::= print prlist */
2037 100, /* (10) statement ::= ASSERT LP expr EQ expr RP */
2038 100, /* (11) statement ::= ASSERT LP position EQ position RP */
2039 100, /* (12) statement ::= DEFINE ID CODEBLOCK */
2040 116, /* (13) rvalue ::= PLACENAME */
2041 124, /* (14) pritem ::= FILL */
2042 124, /* (15) pritem ::= COLOR */
2043 124, /* (16) pritem ::= THICKNESS */
2044 124, /* (17) pritem ::= rvalue */
2045 124, /* (18) pritem ::= STRING */
2046 125, /* (19) prsep ::= COMMA */
2047 101, /* (20) unnamed_statement ::= basetype attribute_list */
2048 102, /* (21) basetype ::= CLASSNAME */
2049 102, /* (22) basetype ::= STRING textposition */
2050 102, /* (23) basetype ::= LB savelist statement_list RB */
2051 127, /* (24) savelist ::= */
2052 119, /* (25) relexpr ::= expr */
2053 119, /* (26) relexpr ::= expr PERCENT */
2054 120, /* (27) optrelexpr ::= */
2055 126, /* (28) attribute_list ::= relexpr alist */
2056 129, /* (29) attribute ::= numproperty relexpr */
2057 129, /* (30) attribute ::= dashproperty expr */
2058 129, /* (31) attribute ::= dashproperty */
2059 129, /* (32) attribute ::= colorproperty rvalue */
2060 129, /* (33) attribute ::= go direction optrelexpr */
2061 129, /* (34) attribute ::= go direction even position */
2062 129, /* (35) attribute ::= CLOSE */
2063 129, /* (36) attribute ::= CHOP */
2064 129, /* (37) attribute ::= FROM position */
2065 129, /* (38) attribute ::= TO position */
2066 129, /* (39) attribute ::= THEN */
2067 129, /* (40) attribute ::= THEN optrelexpr HEADING expr */
2068 129, /* (41) attribute ::= THEN optrelexpr EDGEPT */
2069 129, /* (42) attribute ::= GO optrelexpr HEADING expr */
2070 129, /* (43) attribute ::= GO optrelexpr EDGEPT */
2071 129, /* (44) attribute ::= AT position */
2072 129, /* (45) attribute ::= SAME */
2073 129, /* (46) attribute ::= SAME AS object */
2074 129, /* (47) attribute ::= STRING textposition */
2075 129, /* (48) attribute ::= FIT */
2076 129, /* (49) attribute ::= BEHIND object */
2077 132, /* (50) withclause ::= DOT_E edge AT position */
2078 132, /* (51) withclause ::= edge AT position */
2079 104, /* (52) numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2080 131, /* (53) boolproperty ::= CW */
2081 131, /* (54) boolproperty ::= CCW */
2082 131, /* (55) boolproperty ::= LARROW */
2083 131, /* (56) boolproperty ::= RARROW */
2084 131, /* (57) boolproperty ::= LRARROW */
2085 131, /* (58) boolproperty ::= INVIS */
2086 131, /* (59) boolproperty ::= THICK */
2087 131, /* (60) boolproperty ::= THIN */
2088 131, /* (61) boolproperty ::= SOLID */
2089 115, /* (62) textposition ::= */
2090 115, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2091 110, /* (64) position ::= expr COMMA expr */
2092 110, /* (65) position ::= place PLUS expr COMMA expr */
2093 110, /* (66) position ::= place MINUS expr COMMA expr */
2094 110, /* (67) position ::= place PLUS LP expr COMMA expr RP */
2095 110, /* (68) position ::= place MINUS LP expr COMMA expr RP */
2096 110, /* (69) position ::= LP position COMMA position RP */
2097 110, /* (70) position ::= LP position RP */
2098 110, /* (71) position ::= expr between position AND position */
2099 110, /* (72) position ::= expr LT position COMMA position GT */
2100 110, /* (73) position ::= expr ABOVE position */
2101 110, /* (74) position ::= expr BELOW position */
2102 110, /* (75) position ::= expr LEFT OF position */
2103 110, /* (76) position ::= expr RIGHT OF position */
2104 110, /* (77) position ::= expr ON HEADING EDGEPT OF position */
2105 110, /* (78) position ::= expr HEADING EDGEPT OF position */
2106 110, /* (79) position ::= expr EDGEPT OF position */
2107 110, /* (80) position ::= expr ON HEADING expr FROM position */
2108 110, /* (81) position ::= expr HEADING expr FROM position */
2109 111, /* (82) place ::= edge OF object */
2110 134, /* (83) place2 ::= object */
2111 134, /* (84) place2 ::= object DOT_E edge */
2112 134, /* (85) place2 ::= NTH VERTEX OF object */
2113 112, /* (86) object ::= nth */
2114 112, /* (87) object ::= nth OF|IN object */
2115 113, /* (88) objectname ::= THIS */
2116 113, /* (89) objectname ::= PLACENAME */
2117 113, /* (90) objectname ::= objectname DOT_U PLACENAME */
2118 114, /* (91) nth ::= NTH CLASSNAME */
2119 114, /* (92) nth ::= NTH LAST CLASSNAME */
2120 114, /* (93) nth ::= LAST CLASSNAME */
2121 114, /* (94) nth ::= LAST */
2122 114, /* (95) nth ::= NTH LB RB */
2123 114, /* (96) nth ::= NTH LAST LB RB */
2124 114, /* (97) nth ::= LAST LB RB */
2125 103, /* (98) expr ::= expr PLUS expr */
2126 103, /* (99) expr ::= expr MINUS expr */
2127 103, /* (100) expr ::= expr STAR expr */
2128 103, /* (101) expr ::= expr SLASH expr */
2129 103, /* (102) expr ::= MINUS expr */
2130 103, /* (103) expr ::= PLUS expr */
2131 103, /* (104) expr ::= LP expr RP */
2132 103, /* (105) expr ::= LP FILL|COLOR|THICKNESS RP */
2133 103, /* (106) expr ::= NUMBER */
2134 103, /* (107) expr ::= ID */
2135 103, /* (108) expr ::= FUNC1 LP expr RP */
2136 103, /* (109) expr ::= FUNC2 LP expr COMMA expr RP */
2137 103, /* (110) expr ::= DIST LP position COMMA position RP */
2138 103, /* (111) expr ::= place2 DOT_XY X */
2139 103, /* (112) expr ::= place2 DOT_XY Y */
2140 103, /* (113) expr ::= object DOT_L numproperty */
2141 103, /* (114) expr ::= object DOT_L dashproperty */
2142 103, /* (115) expr ::= object DOT_L colorproperty */
2143 117, /* (116) lvalue ::= ID */
2144 117, /* (117) lvalue ::= FILL */
2145 117, /* (118) lvalue ::= COLOR */
2146 117, /* (119) lvalue ::= THICKNESS */
2147 116, /* (120) rvalue ::= expr */
2148 122, /* (121) print ::= PRINT */
2149 123, /* (122) prlist ::= pritem */
2150 123, /* (123) prlist ::= prlist prsep pritem */
2151 106, /* (124) direction ::= UP */
2152 106, /* (125) direction ::= DOWN */
2153 106, /* (126) direction ::= LEFT */
2154 106, /* (127) direction ::= RIGHT */
2155 120, /* (128) optrelexpr ::= relexpr */
2156 126, /* (129) attribute_list ::= alist */
2157 128, /* (130) alist ::= */
2158 128, /* (131) alist ::= alist attribute */
2159 129, /* (132) attribute ::= boolproperty */
2160 129, /* (133) attribute ::= WITH withclause */
2161 130, /* (134) go ::= GO */
2162 130, /* (135) go ::= */
2163 118, /* (136) even ::= UNTIL EVEN WITH */
2164 118, /* (137) even ::= EVEN WITH */
2165 107, /* (138) dashproperty ::= DOTTED */
2166 107, /* (139) dashproperty ::= DASHED */
2167 108, /* (140) colorproperty ::= FILL */
2168 108, /* (141) colorproperty ::= COLOR */
2169 110, /* (142) position ::= place */
2170 133, /* (143) between ::= WAY BETWEEN */
2171 133, /* (144) between ::= BETWEEN */
2172 133, /* (145) between ::= OF THE WAY BETWEEN */
2173 111, /* (146) place ::= place2 */
2174 105, /* (147) edge ::= CENTER */
2175 105, /* (148) edge ::= EDGEPT */
2176 105, /* (149) edge ::= TOP */
2177 105, /* (150) edge ::= BOTTOM */
2178 105, /* (151) edge ::= START */
2179 105, /* (152) edge ::= END */
2180 105, /* (153) edge ::= RIGHT */
2181 105, /* (154) edge ::= LEFT */
2182 112, /* (155) object ::= objectname */
2183 };
2184
2185 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
2186 ** of symbols on the right-hand side of that rule. */
2187 static const signed char yyRuleInfoNRhs[] = {
@@ -2246,11 +2252,11 @@
2246 -1, /* (58) boolproperty ::= INVIS */
2247 -1, /* (59) boolproperty ::= THICK */
2248 -1, /* (60) boolproperty ::= THIN */
2249 -1, /* (61) boolproperty ::= SOLID */
2250 0, /* (62) textposition ::= */
2251 -2, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2252 -3, /* (64) position ::= expr COMMA expr */
2253 -5, /* (65) position ::= place PLUS expr COMMA expr */
2254 -5, /* (66) position ::= place MINUS expr COMMA expr */
2255 -7, /* (67) position ::= place PLUS LP expr COMMA expr RP */
2256 -7, /* (68) position ::= place MINUS LP expr COMMA expr RP */
@@ -2381,620 +2387,620 @@
2381 ** break;
2382 */
2383 /********** Begin reduce actions **********************************************/
2384 YYMINORTYPE yylhsminor;
2385 case 0: /* document ::= statement_list */
2386 #line 547 "pikchr.y"
2387 {pik_render(p,yymsp[0].minor.yy227);}
2388 #line 2413 "pikchr.c"
2389 break;
2390 case 1: /* statement_list ::= statement */
2391 #line 550 "pikchr.y"
2392 { yylhsminor.yy227 = pik_elist_append(p,0,yymsp[0].minor.yy36); }
2393 #line 2418 "pikchr.c"
2394 yymsp[0].minor.yy227 = yylhsminor.yy227;
2395 break;
2396 case 2: /* statement_list ::= statement_list EOL statement */
2397 #line 552 "pikchr.y"
2398 { yylhsminor.yy227 = pik_elist_append(p,yymsp[-2].minor.yy227,yymsp[0].minor.yy36); }
2399 #line 2424 "pikchr.c"
2400 yymsp[-2].minor.yy227 = yylhsminor.yy227;
2401 break;
2402 case 3: /* statement ::= */
2403 #line 555 "pikchr.y"
2404 { yymsp[1].minor.yy36 = 0; }
2405 #line 2430 "pikchr.c"
2406 break;
2407 case 4: /* statement ::= direction */
2408 #line 556 "pikchr.y"
2409 { pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy36=0; }
2410 #line 2435 "pikchr.c"
2411 yymsp[0].minor.yy36 = yylhsminor.yy36;
2412 break;
2413 case 5: /* statement ::= lvalue ASSIGN rvalue */
2414 #line 557 "pikchr.y"
2415 {pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy153,&yymsp[-1].minor.yy0); yylhsminor.yy36=0;}
2416 #line 2441 "pikchr.c"
2417 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2418 break;
2419 case 6: /* statement ::= PLACENAME COLON unnamed_statement */
2420 #line 559 "pikchr.y"
2421 { yylhsminor.yy36 = yymsp[0].minor.yy36; pik_elem_setname(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0); }
2422 #line 2447 "pikchr.c"
2423 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2424 break;
2425 case 7: /* statement ::= PLACENAME COLON position */
2426 #line 561 "pikchr.y"
2427 { yylhsminor.yy36 = pik_elem_new(p,0,0,0);
2428 if(yylhsminor.yy36){ yylhsminor.yy36->ptAt = yymsp[0].minor.yy79; pik_elem_setname(p,yylhsminor.yy36,&yymsp[-2].minor.yy0); }}
2429 #line 2454 "pikchr.c"
2430 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2431 break;
2432 case 8: /* statement ::= unnamed_statement */
2433 #line 563 "pikchr.y"
2434 {yylhsminor.yy36 = yymsp[0].minor.yy36;}
2435 #line 2460 "pikchr.c"
2436 yymsp[0].minor.yy36 = yylhsminor.yy36;
2437 break;
2438 case 9: /* statement ::= print prlist */
2439 #line 564 "pikchr.y"
2440 {pik_append(p,"<br>\n",5); yymsp[-1].minor.yy36=0;}
2441 #line 2466 "pikchr.c"
2442 break;
2443 case 10: /* statement ::= ASSERT LP expr EQ expr RP */
2444 #line 569 "pikchr.y"
2445 {yymsp[-5].minor.yy36=pik_assert(p,yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy153);}
2446 #line 2471 "pikchr.c"
2447 break;
2448 case 11: /* statement ::= ASSERT LP position EQ position RP */
2449 #line 571 "pikchr.y"
2450 {yymsp[-5].minor.yy36=pik_position_assert(p,&yymsp[-3].minor.yy79,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy79);}
2451 #line 2476 "pikchr.c"
2452 break;
2453 case 12: /* statement ::= DEFINE ID CODEBLOCK */
2454 #line 572 "pikchr.y"
2455 {yymsp[-2].minor.yy36=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
2456 #line 2481 "pikchr.c"
2457 break;
2458 case 13: /* rvalue ::= PLACENAME */
2459 #line 583 "pikchr.y"
2460 {yylhsminor.yy153 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2461 #line 2486 "pikchr.c"
2462 yymsp[0].minor.yy153 = yylhsminor.yy153;
2463 break;
2464 case 14: /* pritem ::= FILL */
2465 case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
2466 case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
2467 #line 588 "pikchr.y"
2468 {pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2469 #line 2494 "pikchr.c"
2470 break;
2471 case 17: /* pritem ::= rvalue */
2472 #line 591 "pikchr.y"
2473 {pik_append_num(p,"",yymsp[0].minor.yy153);}
2474 #line 2499 "pikchr.c"
2475 break;
2476 case 18: /* pritem ::= STRING */
2477 #line 592 "pikchr.y"
2478 {pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2479 #line 2504 "pikchr.c"
2480 break;
2481 case 19: /* prsep ::= COMMA */
2482 #line 593 "pikchr.y"
2483 {pik_append(p, " ", 1);}
2484 #line 2509 "pikchr.c"
2485 break;
2486 case 20: /* unnamed_statement ::= basetype attribute_list */
2487 #line 596 "pikchr.y"
2488 {yylhsminor.yy36 = yymsp[-1].minor.yy36; pik_after_adding_attributes(p,yylhsminor.yy36);}
2489 #line 2514 "pikchr.c"
2490 yymsp[-1].minor.yy36 = yylhsminor.yy36;
2491 break;
2492 case 21: /* basetype ::= CLASSNAME */
2493 #line 598 "pikchr.y"
2494 {yylhsminor.yy36 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2495 #line 2520 "pikchr.c"
2496 yymsp[0].minor.yy36 = yylhsminor.yy36;
2497 break;
2498 case 22: /* basetype ::= STRING textposition */
2499 #line 600 "pikchr.y"
2500 {yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy164; yylhsminor.yy36 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2501 #line 2526 "pikchr.c"
2502 yymsp[-1].minor.yy36 = yylhsminor.yy36;
2503 break;
2504 case 23: /* basetype ::= LB savelist statement_list RB */
2505 #line 602 "pikchr.y"
2506 { p->list = yymsp[-2].minor.yy227; yymsp[-3].minor.yy36 = pik_elem_new(p,0,0,yymsp[-1].minor.yy227); if(yymsp[-3].minor.yy36) yymsp[-3].minor.yy36->errTok = yymsp[0].minor.yy0; }
2507 #line 2532 "pikchr.c"
2508 break;
2509 case 24: /* savelist ::= */
2510 #line 607 "pikchr.y"
2511 {yymsp[1].minor.yy227 = p->list; p->list = 0;}
2512 #line 2537 "pikchr.c"
2513 break;
2514 case 25: /* relexpr ::= expr */
2515 #line 614 "pikchr.y"
2516 {yylhsminor.yy10.rAbs = yymsp[0].minor.yy153; yylhsminor.yy10.rRel = 0;}
2517 #line 2542 "pikchr.c"
2518 yymsp[0].minor.yy10 = yylhsminor.yy10;
2519 break;
2520 case 26: /* relexpr ::= expr PERCENT */
2521 #line 615 "pikchr.y"
2522 {yylhsminor.yy10.rAbs = 0; yylhsminor.yy10.rRel = yymsp[-1].minor.yy153/100;}
2523 #line 2548 "pikchr.c"
2524 yymsp[-1].minor.yy10 = yylhsminor.yy10;
2525 break;
2526 case 27: /* optrelexpr ::= */
2527 #line 617 "pikchr.y"
2528 {yymsp[1].minor.yy10.rAbs = 0; yymsp[1].minor.yy10.rRel = 1.0;}
2529 #line 2554 "pikchr.c"
2530 break;
2531 case 28: /* attribute_list ::= relexpr alist */
2532 #line 619 "pikchr.y"
2533 {pik_add_direction(p,0,&yymsp[-1].minor.yy10);}
2534 #line 2559 "pikchr.c"
2535 break;
2536 case 29: /* attribute ::= numproperty relexpr */
2537 #line 623 "pikchr.y"
2538 { pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10); }
2539 #line 2564 "pikchr.c"
2540 break;
2541 case 30: /* attribute ::= dashproperty expr */
2542 #line 624 "pikchr.y"
2543 { pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy153); }
2544 #line 2569 "pikchr.c"
2545 break;
2546 case 31: /* attribute ::= dashproperty */
2547 #line 625 "pikchr.y"
2548 { pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2549 #line 2574 "pikchr.c"
2550 break;
2551 case 32: /* attribute ::= colorproperty rvalue */
2552 #line 626 "pikchr.y"
2553 { pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153); }
2554 #line 2579 "pikchr.c"
2555 break;
2556 case 33: /* attribute ::= go direction optrelexpr */
2557 #line 627 "pikchr.y"
2558 { pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy10);}
2559 #line 2584 "pikchr.c"
2560 break;
2561 case 34: /* attribute ::= go direction even position */
2562 #line 628 "pikchr.y"
2563 {pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79);}
2564 #line 2589 "pikchr.c"
2565 break;
2566 case 35: /* attribute ::= CLOSE */
2567 #line 629 "pikchr.y"
2568 { pik_close_path(p,&yymsp[0].minor.yy0); }
2569 #line 2594 "pikchr.c"
2570 break;
2571 case 36: /* attribute ::= CHOP */
2572 #line 630 "pikchr.y"
2573 { p->cur->bChop = 1; }
2574 #line 2599 "pikchr.c"
2575 break;
2576 case 37: /* attribute ::= FROM position */
2577 #line 631 "pikchr.y"
2578 { pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2579 #line 2604 "pikchr.c"
2580 break;
2581 case 38: /* attribute ::= TO position */
2582 #line 632 "pikchr.y"
2583 { pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy79); }
2584 #line 2609 "pikchr.c"
2585 break;
2586 case 39: /* attribute ::= THEN */
2587 #line 633 "pikchr.y"
2588 { pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2589 #line 2614 "pikchr.c"
2590 break;
2591 case 40: /* attribute ::= THEN optrelexpr HEADING expr */
2592 case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
2593 #line 635 "pikchr.y"
2594 {pik_move_hdg(p,&yymsp[-2].minor.yy10,&yymsp[-1].minor.yy0,yymsp[0].minor.yy153,0,&yymsp[-3].minor.yy0);}
2595 #line 2620 "pikchr.c"
2596 break;
2597 case 41: /* attribute ::= THEN optrelexpr EDGEPT */
2598 case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
2599 #line 636 "pikchr.y"
2600 {pik_move_hdg(p,&yymsp[-1].minor.yy10,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2601 #line 2626 "pikchr.c"
2602 break;
2603 case 44: /* attribute ::= AT position */
2604 #line 641 "pikchr.y"
2605 { pik_set_at(p,0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2606 #line 2631 "pikchr.c"
2607 break;
2608 case 45: /* attribute ::= SAME */
2609 #line 643 "pikchr.y"
2610 {pik_same(p,0,&yymsp[0].minor.yy0);}
2611 #line 2636 "pikchr.c"
2612 break;
2613 case 46: /* attribute ::= SAME AS object */
2614 #line 644 "pikchr.y"
2615 {pik_same(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2616 #line 2641 "pikchr.c"
2617 break;
2618 case 47: /* attribute ::= STRING textposition */
2619 #line 645 "pikchr.y"
2620 {pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy164);}
2621 #line 2646 "pikchr.c"
2622 break;
2623 case 48: /* attribute ::= FIT */
2624 #line 646 "pikchr.y"
2625 {pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
2626 #line 2651 "pikchr.c"
2627 break;
2628 case 49: /* attribute ::= BEHIND object */
2629 #line 647 "pikchr.y"
2630 {pik_behind(p,yymsp[0].minor.yy36);}
2631 #line 2656 "pikchr.c"
2632 break;
2633 case 50: /* withclause ::= DOT_E edge AT position */
2634 case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
2635 #line 655 "pikchr.y"
2636 { pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy79,&yymsp[-1].minor.yy0); }
2637 #line 2662 "pikchr.c"
2638 break;
2639 case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2640 #line 659 "pikchr.y"
2641 {yylhsminor.yy0 = yymsp[0].minor.yy0;}
2642 #line 2667 "pikchr.c"
2643 yymsp[0].minor.yy0 = yylhsminor.yy0;
2644 break;
2645 case 53: /* boolproperty ::= CW */
2646 #line 670 "pikchr.y"
2647 {p->cur->cw = 1;}
2648 #line 2673 "pikchr.c"
2649 break;
2650 case 54: /* boolproperty ::= CCW */
2651 #line 671 "pikchr.y"
2652 {p->cur->cw = 0;}
2653 #line 2678 "pikchr.c"
2654 break;
2655 case 55: /* boolproperty ::= LARROW */
2656 #line 672 "pikchr.y"
2657 {p->cur->larrow=1; p->cur->rarrow=0; }
2658 #line 2683 "pikchr.c"
2659 break;
2660 case 56: /* boolproperty ::= RARROW */
2661 #line 673 "pikchr.y"
2662 {p->cur->larrow=0; p->cur->rarrow=1; }
2663 #line 2688 "pikchr.c"
2664 break;
2665 case 57: /* boolproperty ::= LRARROW */
2666 #line 674 "pikchr.y"
2667 {p->cur->larrow=1; p->cur->rarrow=1; }
2668 #line 2693 "pikchr.c"
2669 break;
2670 case 58: /* boolproperty ::= INVIS */
2671 #line 675 "pikchr.y"
2672 {p->cur->sw = 0.0;}
2673 #line 2698 "pikchr.c"
2674 break;
2675 case 59: /* boolproperty ::= THICK */
2676 #line 676 "pikchr.y"
2677 {p->cur->sw *= 1.5;}
2678 #line 2703 "pikchr.c"
2679 break;
2680 case 60: /* boolproperty ::= THIN */
2681 #line 677 "pikchr.y"
2682 {p->cur->sw *= 0.67;}
2683 #line 2708 "pikchr.c"
2684 break;
2685 case 61: /* boolproperty ::= SOLID */
2686 #line 678 "pikchr.y"
2687 {p->cur->sw = pik_value(p,"thickness",9,0);
2688 p->cur->dotted = p->cur->dashed = 0.0;}
2689 #line 2714 "pikchr.c"
2690 break;
2691 case 62: /* textposition ::= */
2692 #line 681 "pikchr.y"
2693 {yymsp[1].minor.yy164 = 0;}
2694 #line 2719 "pikchr.c"
2695 break;
2696 case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
2697 #line 684 "pikchr.y"
2698 {yylhsminor.yy164 = (short int)pik_text_position(yymsp[-1].minor.yy164,&yymsp[0].minor.yy0);}
2699 #line 2724 "pikchr.c"
2700 yymsp[-1].minor.yy164 = yylhsminor.yy164;
2701 break;
2702 case 64: /* position ::= expr COMMA expr */
2703 #line 687 "pikchr.y"
2704 {yylhsminor.yy79.x=yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[0].minor.yy153;}
2705 #line 2730 "pikchr.c"
2706 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2707 break;
2708 case 65: /* position ::= place PLUS expr COMMA expr */
2709 #line 689 "pikchr.y"
2710 {yylhsminor.yy79.x=yymsp[-4].minor.yy79.x+yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y+yymsp[0].minor.yy153;}
2711 #line 2736 "pikchr.c"
2712 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2713 break;
2714 case 66: /* position ::= place MINUS expr COMMA expr */
2715 #line 690 "pikchr.y"
2716 {yylhsminor.yy79.x=yymsp[-4].minor.yy79.x-yymsp[-2].minor.yy153; yylhsminor.yy79.y=yymsp[-4].minor.yy79.y-yymsp[0].minor.yy153;}
2717 #line 2742 "pikchr.c"
2718 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2719 break;
2720 case 67: /* position ::= place PLUS LP expr COMMA expr RP */
2721 #line 692 "pikchr.y"
2722 {yylhsminor.yy79.x=yymsp[-6].minor.yy79.x+yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y+yymsp[-1].minor.yy153;}
2723 #line 2748 "pikchr.c"
2724 yymsp[-6].minor.yy79 = yylhsminor.yy79;
2725 break;
2726 case 68: /* position ::= place MINUS LP expr COMMA expr RP */
2727 #line 694 "pikchr.y"
2728 {yylhsminor.yy79.x=yymsp[-6].minor.yy79.x-yymsp[-3].minor.yy153; yylhsminor.yy79.y=yymsp[-6].minor.yy79.y-yymsp[-1].minor.yy153;}
2729 #line 2754 "pikchr.c"
2730 yymsp[-6].minor.yy79 = yylhsminor.yy79;
2731 break;
2732 case 69: /* position ::= LP position COMMA position RP */
2733 #line 695 "pikchr.y"
2734 {yymsp[-4].minor.yy79.x=yymsp[-3].minor.yy79.x; yymsp[-4].minor.yy79.y=yymsp[-1].minor.yy79.y;}
2735 #line 2760 "pikchr.c"
2736 break;
2737 case 70: /* position ::= LP position RP */
2738 #line 696 "pikchr.y"
2739 {yymsp[-2].minor.yy79=yymsp[-1].minor.yy79;}
2740 #line 2765 "pikchr.c"
2741 break;
2742 case 71: /* position ::= expr between position AND position */
2743 #line 698 "pikchr.y"
2744 {yylhsminor.yy79 = pik_position_between(yymsp[-4].minor.yy153,yymsp[-2].minor.yy79,yymsp[0].minor.yy79);}
2745 #line 2770 "pikchr.c"
2746 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2747 break;
2748 case 72: /* position ::= expr LT position COMMA position GT */
2749 #line 700 "pikchr.y"
2750 {yylhsminor.yy79 = pik_position_between(yymsp[-5].minor.yy153,yymsp[-3].minor.yy79,yymsp[-1].minor.yy79);}
2751 #line 2776 "pikchr.c"
2752 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2753 break;
2754 case 73: /* position ::= expr ABOVE position */
2755 #line 701 "pikchr.y"
2756 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y += yymsp[-2].minor.yy153;}
2757 #line 2782 "pikchr.c"
2758 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2759 break;
2760 case 74: /* position ::= expr BELOW position */
2761 #line 702 "pikchr.y"
2762 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.y -= yymsp[-2].minor.yy153;}
2763 #line 2788 "pikchr.c"
2764 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2765 break;
2766 case 75: /* position ::= expr LEFT OF position */
2767 #line 703 "pikchr.y"
2768 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x -= yymsp[-3].minor.yy153;}
2769 #line 2794 "pikchr.c"
2770 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2771 break;
2772 case 76: /* position ::= expr RIGHT OF position */
2773 #line 704 "pikchr.y"
2774 {yylhsminor.yy79=yymsp[0].minor.yy79; yylhsminor.yy79.x += yymsp[-3].minor.yy153;}
2775 #line 2800 "pikchr.c"
2776 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2777 break;
2778 case 77: /* position ::= expr ON HEADING EDGEPT OF position */
2779 #line 706 "pikchr.y"
2780 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-5].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2781 #line 2806 "pikchr.c"
2782 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2783 break;
2784 case 78: /* position ::= expr HEADING EDGEPT OF position */
2785 #line 708 "pikchr.y"
2786 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-4].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2787 #line 2812 "pikchr.c"
2788 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2789 break;
2790 case 79: /* position ::= expr EDGEPT OF position */
2791 #line 710 "pikchr.y"
2792 {yylhsminor.yy79 = pik_position_at_hdg(yymsp[-3].minor.yy153,&yymsp[-2].minor.yy0,yymsp[0].minor.yy79);}
2793 #line 2818 "pikchr.c"
2794 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2795 break;
2796 case 80: /* position ::= expr ON HEADING expr FROM position */
2797 #line 712 "pikchr.y"
2798 {yylhsminor.yy79 = pik_position_at_angle(yymsp[-5].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2799 #line 2824 "pikchr.c"
2800 yymsp[-5].minor.yy79 = yylhsminor.yy79;
2801 break;
2802 case 81: /* position ::= expr HEADING expr FROM position */
2803 #line 714 "pikchr.y"
2804 {yylhsminor.yy79 = pik_position_at_angle(yymsp[-4].minor.yy153,yymsp[-2].minor.yy153,yymsp[0].minor.yy79);}
2805 #line 2830 "pikchr.c"
2806 yymsp[-4].minor.yy79 = yylhsminor.yy79;
2807 break;
2808 case 82: /* place ::= edge OF object */
2809 #line 726 "pikchr.y"
2810 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2811 #line 2836 "pikchr.c"
2812 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2813 break;
2814 case 83: /* place2 ::= object */
2815 #line 727 "pikchr.y"
2816 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[0].minor.yy36,0);}
2817 #line 2842 "pikchr.c"
2818 yymsp[0].minor.yy79 = yylhsminor.yy79;
2819 break;
2820 case 84: /* place2 ::= object DOT_E edge */
2821 #line 728 "pikchr.y"
2822 {yylhsminor.yy79 = pik_place_of_elem(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2823 #line 2848 "pikchr.c"
2824 yymsp[-2].minor.yy79 = yylhsminor.yy79;
2825 break;
2826 case 85: /* place2 ::= NTH VERTEX OF object */
2827 #line 729 "pikchr.y"
2828 {yylhsminor.yy79 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy36);}
2829 #line 2854 "pikchr.c"
2830 yymsp[-3].minor.yy79 = yylhsminor.yy79;
2831 break;
2832 case 86: /* object ::= nth */
2833 #line 741 "pikchr.y"
2834 {yylhsminor.yy36 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2835 #line 2860 "pikchr.c"
2836 yymsp[0].minor.yy36 = yylhsminor.yy36;
2837 break;
2838 case 87: /* object ::= nth OF|IN object */
2839 #line 742 "pikchr.y"
2840 {yylhsminor.yy36 = pik_find_nth(p,yymsp[0].minor.yy36,&yymsp[-2].minor.yy0);}
2841 #line 2866 "pikchr.c"
2842 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2843 break;
2844 case 88: /* objectname ::= THIS */
2845 #line 744 "pikchr.y"
2846 {yymsp[0].minor.yy36 = p->cur;}
2847 #line 2872 "pikchr.c"
2848 break;
2849 case 89: /* objectname ::= PLACENAME */
2850 #line 745 "pikchr.y"
2851 {yylhsminor.yy36 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2852 #line 2877 "pikchr.c"
2853 yymsp[0].minor.yy36 = yylhsminor.yy36;
2854 break;
2855 case 90: /* objectname ::= objectname DOT_U PLACENAME */
2856 #line 747 "pikchr.y"
2857 {yylhsminor.yy36 = pik_find_byname(p,yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2858 #line 2883 "pikchr.c"
2859 yymsp[-2].minor.yy36 = yylhsminor.yy36;
2860 break;
2861 case 91: /* nth ::= NTH CLASSNAME */
2862 #line 749 "pikchr.y"
2863 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2864 #line 2889 "pikchr.c"
2865 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2866 break;
2867 case 92: /* nth ::= NTH LAST CLASSNAME */
2868 #line 750 "pikchr.y"
2869 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2870 #line 2895 "pikchr.c"
2871 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2872 break;
2873 case 93: /* nth ::= LAST CLASSNAME */
2874 #line 751 "pikchr.y"
2875 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2876 #line 2901 "pikchr.c"
2877 break;
2878 case 94: /* nth ::= LAST */
2879 #line 752 "pikchr.y"
2880 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2881 #line 2906 "pikchr.c"
2882 yymsp[0].minor.yy0 = yylhsminor.yy0;
2883 break;
2884 case 95: /* nth ::= NTH LB RB */
2885 #line 753 "pikchr.y"
2886 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2887 #line 2912 "pikchr.c"
2888 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2889 break;
2890 case 96: /* nth ::= NTH LAST LB RB */
2891 #line 754 "pikchr.y"
2892 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2893 #line 2918 "pikchr.c"
2894 yymsp[-3].minor.yy0 = yylhsminor.yy0;
2895 break;
2896 case 97: /* nth ::= LAST LB RB */
2897 #line 755 "pikchr.y"
2898 {yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2899 #line 2924 "pikchr.c"
2900 break;
2901 case 98: /* expr ::= expr PLUS expr */
2902 #line 757 "pikchr.y"
2903 {yylhsminor.yy153=yymsp[-2].minor.yy153+yymsp[0].minor.yy153;}
2904 #line 2929 "pikchr.c"
2905 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2906 break;
2907 case 99: /* expr ::= expr MINUS expr */
2908 #line 758 "pikchr.y"
2909 {yylhsminor.yy153=yymsp[-2].minor.yy153-yymsp[0].minor.yy153;}
2910 #line 2935 "pikchr.c"
2911 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2912 break;
2913 case 100: /* expr ::= expr STAR expr */
2914 #line 759 "pikchr.y"
2915 {yylhsminor.yy153=yymsp[-2].minor.yy153*yymsp[0].minor.yy153;}
2916 #line 2941 "pikchr.c"
2917 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2918 break;
2919 case 101: /* expr ::= expr SLASH expr */
2920 #line 760 "pikchr.y"
2921 {
2922 if( yymsp[0].minor.yy153==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy153 = 0.0; }
2923 else{ yylhsminor.yy153 = yymsp[-2].minor.yy153/yymsp[0].minor.yy153; }
2924 }
2925 #line 2950 "pikchr.c"
2926 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2927 break;
2928 case 102: /* expr ::= MINUS expr */
2929 #line 764 "pikchr.y"
2930 {yymsp[-1].minor.yy153=-yymsp[0].minor.yy153;}
2931 #line 2956 "pikchr.c"
2932 break;
2933 case 103: /* expr ::= PLUS expr */
2934 #line 765 "pikchr.y"
2935 {yymsp[-1].minor.yy153=yymsp[0].minor.yy153;}
2936 #line 2961 "pikchr.c"
2937 break;
2938 case 104: /* expr ::= LP expr RP */
2939 #line 766 "pikchr.y"
2940 {yymsp[-2].minor.yy153=yymsp[-1].minor.yy153;}
2941 #line 2966 "pikchr.c"
2942 break;
2943 case 105: /* expr ::= LP FILL|COLOR|THICKNESS RP */
2944 #line 767 "pikchr.y"
2945 {yymsp[-2].minor.yy153=pik_get_var(p,&yymsp[-1].minor.yy0);}
2946 #line 2971 "pikchr.c"
2947 break;
2948 case 106: /* expr ::= NUMBER */
2949 #line 768 "pikchr.y"
2950 {yylhsminor.yy153=pik_atof(&yymsp[0].minor.yy0);}
2951 #line 2976 "pikchr.c"
2952 yymsp[0].minor.yy153 = yylhsminor.yy153;
2953 break;
2954 case 107: /* expr ::= ID */
2955 #line 769 "pikchr.y"
2956 {yylhsminor.yy153=pik_get_var(p,&yymsp[0].minor.yy0);}
2957 #line 2982 "pikchr.c"
2958 yymsp[0].minor.yy153 = yylhsminor.yy153;
2959 break;
2960 case 108: /* expr ::= FUNC1 LP expr RP */
2961 #line 770 "pikchr.y"
2962 {yylhsminor.yy153 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy153,0.0);}
2963 #line 2988 "pikchr.c"
2964 yymsp[-3].minor.yy153 = yylhsminor.yy153;
2965 break;
2966 case 109: /* expr ::= FUNC2 LP expr COMMA expr RP */
2967 #line 771 "pikchr.y"
2968 {yylhsminor.yy153 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy153,yymsp[-1].minor.yy153);}
2969 #line 2994 "pikchr.c"
2970 yymsp[-5].minor.yy153 = yylhsminor.yy153;
2971 break;
2972 case 110: /* expr ::= DIST LP position COMMA position RP */
2973 #line 772 "pikchr.y"
2974 {yymsp[-5].minor.yy153 = pik_dist(&yymsp[-3].minor.yy79,&yymsp[-1].minor.yy79);}
2975 #line 3000 "pikchr.c"
2976 break;
2977 case 111: /* expr ::= place2 DOT_XY X */
2978 #line 773 "pikchr.y"
2979 {yylhsminor.yy153 = yymsp[-2].minor.yy79.x;}
2980 #line 3005 "pikchr.c"
2981 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2982 break;
2983 case 112: /* expr ::= place2 DOT_XY Y */
2984 #line 774 "pikchr.y"
2985 {yylhsminor.yy153 = yymsp[-2].minor.yy79.y;}
2986 #line 3011 "pikchr.c"
2987 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2988 break;
2989 case 113: /* expr ::= object DOT_L numproperty */
2990 case 114: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==114);
2991 case 115: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==115);
2992 #line 775 "pikchr.y"
2993 {yylhsminor.yy153=pik_property_of(yymsp[-2].minor.yy36,&yymsp[0].minor.yy0);}
2994 #line 3019 "pikchr.c"
2995 yymsp[-2].minor.yy153 = yylhsminor.yy153;
2996 break;
2997 default:
2998 /* (116) lvalue ::= ID */ yytestcase(yyruleno==116);
2999 /* (117) lvalue ::= FILL */ yytestcase(yyruleno==117);
3000 /* (118) lvalue ::= COLOR */ yytestcase(yyruleno==118);
@@ -3092,19 +3098,19 @@
3092 ){
3093 pik_parserARG_FETCH
3094 pik_parserCTX_FETCH
3095 #define TOKEN yyminor
3096 /************ Begin %syntax_error code ****************************************/
3097 #line 535 "pikchr.y"
3098
3099 if( TOKEN.z && TOKEN.z[0] ){
3100 pik_error(p, &TOKEN, "syntax error");
3101 }else{
3102 pik_error(p, 0, "syntax error");
3103 }
3104 UNUSED_PARAMETER(yymajor);
3105 #line 3130 "pikchr.c"
3106 /************ End %syntax_error code ******************************************/
3107 pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
3108 pik_parserCTX_STORE
3109 }
3110
@@ -3376,11 +3382,11 @@
3376 #else
3377 (void)iToken;
3378 return 0;
3379 #endif
3380 }
3381 #line 780 "pikchr.y"
3382
3383
3384
3385 /* Chart of the 148 official CSS color names with their
3386 ** corresponding RGB values thru Color Module Level 4:
@@ -4978,14 +4984,16 @@
4978 if( t->eCode & TP_RJUST ) nx += jw;
4979
4980 if( pBox!=0 ){
4981 /* If pBox is not NULL, do not draw any <text>. Instead, just expand
4982 ** pBox to include the text */
4983 PNum cw = pik_text_length(t)*p->charWidth*xtraFontScale*0.01;
4984 PNum ch = p->charHeight*0.5*xtraFontScale;
4985 PNum x0, y0, x1, y1; /* Boundary of text relative to pObj->ptAt */
4986 if( t->eCode & TP_BOLD ) cw *= 1.1;
 
 
4987 if( t->eCode & TP_RJUST ){
4988 x0 = nx;
4989 y0 = y-ch;
4990 x1 = nx-cw;
4991 y1 = y+ch;
@@ -5037,10 +5045,13 @@
5037 pik_append(p, " font-style=\"italic\"", -1);
5038 }
5039 if( t->eCode & TP_BOLD ){
5040 pik_append(p, " font-weight=\"bold\"", -1);
5041 }
 
 
 
5042 if( pObj->color>=0.0 ){
5043 pik_append_clr(p, " fill=\"", pObj->color, "\"",0);
5044 }
5045 xtraFontScale *= p->fontScale;
5046 if( xtraFontScale<=0.99 || xtraFontScale>=1.01 ){
@@ -6044,12 +6055,13 @@
6044 case T_LJUST: iRes = (iRes&~TP_JMASK) | TP_LJUST; break;
6045 case T_RJUST: iRes = (iRes&~TP_JMASK) | TP_RJUST; break;
6046 case T_ABOVE: iRes = (iRes&~TP_VMASK) | TP_ABOVE; break;
6047 case T_CENTER: iRes = (iRes&~TP_VMASK) | TP_CENTER; break;
6048 case T_BELOW: iRes = (iRes&~TP_VMASK) | TP_BELOW; break;
6049 case T_ITALIC: iRes |= TP_ITALIC; break;
6050 case T_BOLD: iRes |= TP_BOLD; break;
 
6051 case T_ALIGNED: iRes |= TP_ALIGN; break;
6052 case T_BIG: if( iRes & TP_BIG ) iRes |= TP_XTRA;
6053 else iRes = (iRes &~TP_SZMASK)|TP_BIG; break;
6054 case T_SMALL: if( iRes & TP_SMALL ) iRes |= TP_XTRA;
6055 else iRes = (iRes &~TP_SZMASK)|TP_SMALL; break;
@@ -6180,15 +6192,17 @@
6180 **
6181 ** Omit "\" used to escape characters. And count entities like
6182 ** "&lt;" as a single character. Multi-byte UTF8 characters count
6183 ** as a single character.
6184 **
6185 ** Attempt to scale the answer by the actual characters seen. Wide
6186 ** characters count more than narrow characters. But the widths are
6187 ** only guesses.
 
6188 */
6189 static int pik_text_length(const PToken *pToken){
 
6190 int n = pToken->n;
6191 const char *z = pToken->z;
6192 int cnt, j;
6193 for(j=1, cnt=0; j<n-1; j++){
6194 char c = z[j];
@@ -6196,22 +6210,24 @@
6196 c = z[++j];
6197 }else if( c=='&' ){
6198 int k;
6199 for(k=j+1; k<j+7 && z[k]!=0 && z[k]!=';'; k++){}
6200 if( z[k]==';' ) j = k;
6201 cnt += 150;
6202 continue;
6203 }
6204 if( (c & 0xc0)==0xc0 ){
6205 while( j+1<n-1 && (z[j+1]&0xc0)==0x80 ){ j++; }
6206 cnt += 100;
6207 continue;
6208 }
6209 if( c>=0x20 && c<=0x7e ){
 
 
6210 cnt += awChar[c-0x20];
6211 }else{
6212 cnt += 100;
6213 }
6214 }
6215 return cnt;
6216 }
6217
@@ -7195,10 +7211,12 @@
7195 { "last", 4, T_LAST, 0, 0 },
7196 { "left", 4, T_LEFT, DIR_LEFT, CP_W },
7197 { "ljust", 5, T_LJUST, 0, 0 },
7198 { "max", 3, T_FUNC2, FN_MAX, 0 },
7199 { "min", 3, T_FUNC2, FN_MIN, 0 },
 
 
7200 { "n", 1, T_EDGEPT, 0, CP_N },
7201 { "ne", 2, T_EDGEPT, 0, CP_NE },
7202 { "north", 5, T_EDGEPT, 0, CP_N },
7203 { "nw", 2, T_EDGEPT, 0, CP_NW },
7204 { "of", 2, T_OF, 0, 0 },
@@ -8122,6 +8140,6 @@
8122
8123
8124 #endif /* PIKCHR_TCL */
8125
8126
8127 #line 8152 "pikchr.c"
8128
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -59,11 +59,11 @@
59 ** cc pikchr.c -o pikchr.o
60 **
61 ** Add -DPIKCHR_SHELL to add a main() routine that reads input files
62 ** and sends them through Pikchr, for testing. Add -DPIKCHR_FUZZ for
63 ** -fsanitizer=fuzzer testing.
64 **
65 ****************************************************************************
66 ** IMPLEMENTATION NOTES (for people who want to understand the internal
67 ** operation of this software, perhaps to extend the code or to fix bugs):
68 **
69 ** Each call to pikchr() uses a single instance of the Pik structure to
@@ -203,12 +203,13 @@
203 #define TP_SMALL 0x0200 /* Smaller font */
204 #define TP_XTRA 0x0400 /* Amplify TP_BIG or TP_SMALL */
205 #define TP_SZMASK 0x0700 /* Font size mask */
206 #define TP_ITALIC 0x1000 /* Italic font */
207 #define TP_BOLD 0x2000 /* Bold font */
208 #define TP_MONO 0x4000 /* Monospace font family */
209 #define TP_FMASK 0x7000 /* Mask for font style */
210 #define TP_ALIGN 0x8000 /* Rotate to align with the line */
211
212 /* An object to hold a position in 2-D space */
213 struct PPoint {
214 PNum x, y; /* X and Y coordinates */
215 };
@@ -470,11 +471,11 @@
471 static void pik_bbox_init(PBox*);
472 static void pik_bbox_addbox(PBox*,PBox*);
473 static void pik_bbox_add_xy(PBox*,PNum,PNum);
474 static void pik_bbox_addellipse(PBox*,PNum x,PNum y,PNum rx,PNum ry);
475 static void pik_add_txt(Pik*,PToken*,int);
476 static int pik_text_length(const PToken *pToken, const int isMonospace);
477 static void pik_size_to_fit(Pik*,PToken*,int);
478 static int pik_text_position(int,PToken*);
479 static PNum pik_property_of(PObj*,PToken*);
480 static PNum pik_func(Pik*,PToken*,PNum,PNum);
481 static PPoint pik_position_between(PNum x, PPoint p1, PPoint p2);
@@ -489,11 +490,11 @@
490 static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*);
491 static PNum pik_dist(PPoint*,PPoint*);
492 static void pik_add_macro(Pik*,PToken *pId,PToken *pCode);
493
494
495 #line 521 "pikchr.c"
496 /**************** End of %include directives **********************************/
497 /* These constants specify the various numeric values for terminal symbols.
498 ***************** Begin token definitions *************************************/
499 #ifndef T_ID
500 #define T_ID 1
@@ -564,38 +565,39 @@
565 #define T_RJUST 66
566 #define T_ABOVE 67
567 #define T_BELOW 68
568 #define T_ITALIC 69
569 #define T_BOLD 70
570 #define T_MONO 71
571 #define T_ALIGNED 72
572 #define T_BIG 73
573 #define T_SMALL 74
574 #define T_AND 75
575 #define T_LT 76
576 #define T_GT 77
577 #define T_ON 78
578 #define T_WAY 79
579 #define T_BETWEEN 80
580 #define T_THE 81
581 #define T_NTH 82
582 #define T_VERTEX 83
583 #define T_TOP 84
584 #define T_BOTTOM 85
585 #define T_START 86
586 #define T_END 87
587 #define T_IN 88
588 #define T_THIS 89
589 #define T_DOT_U 90
590 #define T_LAST 91
591 #define T_NUMBER 92
592 #define T_FUNC1 93
593 #define T_FUNC2 94
594 #define T_DIST 95
595 #define T_DOT_XY 96
596 #define T_X 97
597 #define T_Y 98
598 #define T_DOT_L 99
599 #endif
600 /**************** End token definitions ***************************************/
601
602 /* The next sections is a series of control #defines.
603 ** various aspects of the generated parser.
@@ -651,22 +653,22 @@
653 #ifndef INTERFACE
654 # define INTERFACE 1
655 #endif
656 /************* Begin control #defines *****************************************/
657 #define YYCODETYPE unsigned char
658 #define YYNOCODE 136
659 #define YYACTIONTYPE unsigned short int
660 #define pik_parserTOKENTYPE PToken
661 typedef union {
662 int yyinit;
663 pik_parserTOKENTYPE yy0;
664 PNum yy21;
665 PPoint yy63;
666 PRel yy72;
667 PObj* yy162;
668 short int yy188;
669 PList* yy235;
670 } YYMINORTYPE;
671 #ifndef YYSTACKDEPTH
672 #define YYSTACKDEPTH 100
673 #endif
674 #define pik_parserARG_SDECL
@@ -681,11 +683,11 @@
683 #define pik_parserCTX_STORE yypParser->p=p;
684 #define YYFALLBACK 1
685 #define YYNSTATE 164
686 #define YYNRULE 156
687 #define YYNRULE_WITH_ACTION 116
688 #define YYNTOKEN 100
689 #define YY_MAX_SHIFT 163
690 #define YY_MIN_SHIFTREDUCE 287
691 #define YY_MAX_SHIFTREDUCE 442
692 #define YY_ERROR_ACTION 443
693 #define YY_ACCEPT_ACTION 444
@@ -756,322 +758,324 @@
758 ** yy_reduce_ofst[] For each state, the offset into yy_action for
759 ** shifting non-terminals after a reduce.
760 ** yy_default[] Default action for each state.
761 **
762 *********** Begin parsing tables **********************************************/
763 #define YY_ACTTAB_COUNT (1313)
764 static const YYACTIONTYPE yy_action[] = {
765 /* 0 */ 575, 495, 161, 119, 25, 452, 29, 74, 129, 148,
766 /* 10 */ 575, 492, 161, 119, 453, 113, 120, 161, 119, 530,
767 /* 20 */ 427, 428, 339, 559, 81, 30, 560, 561, 575, 64,
768 /* 30 */ 63, 62, 61, 322, 323, 9, 8, 33, 149, 32,
769 /* 40 */ 7, 71, 127, 38, 335, 66, 48, 37, 28, 339,
770 /* 50 */ 339, 339, 339, 425, 426, 340, 341, 342, 343, 344,
771 /* 60 */ 345, 346, 347, 348, 474, 528, 161, 119, 577, 77,
772 /* 70 */ 577, 73, 306, 148, 474, 533, 161, 119, 112, 113,
773 /* 80 */ 120, 161, 119, 128, 427, 428, 339, 31, 81, 531,
774 /* 90 */ 161, 119, 474, 35, 330, 378, 158, 322, 323, 9,
775 /* 100 */ 8, 33, 149, 32, 7, 71, 127, 328, 335, 66,
776 /* 110 */ 579, 378, 158, 339, 339, 339, 339, 425, 426, 340,
777 /* 120 */ 341, 342, 343, 344, 345, 346, 347, 348, 394, 435,
778 /* 130 */ 46, 59, 60, 64, 63, 62, 61, 357, 36, 376,
779 /* 140 */ 54, 51, 2, 47, 403, 13, 297, 411, 412, 413,
780 /* 150 */ 414, 80, 162, 308, 79, 133, 310, 126, 441, 440,
781 /* 160 */ 118, 123, 83, 404, 405, 406, 408, 80, 84, 308,
782 /* 170 */ 79, 299, 411, 412, 413, 414, 118, 69, 350, 350,
783 /* 180 */ 350, 350, 350, 350, 350, 350, 350, 350, 350, 62,
784 /* 190 */ 61, 434, 64, 63, 62, 61, 313, 398, 399, 427,
785 /* 200 */ 428, 339, 380, 157, 64, 63, 62, 61, 122, 106,
786 /* 210 */ 535, 436, 437, 438, 439, 298, 375, 391, 117, 393,
787 /* 220 */ 155, 154, 153, 394, 435, 49, 59, 60, 339, 339,
788 /* 230 */ 339, 339, 425, 426, 376, 3, 4, 2, 64, 63,
789 /* 240 */ 62, 61, 156, 156, 156, 394, 379, 159, 59, 60,
790 /* 250 */ 76, 67, 535, 441, 440, 5, 102, 6, 535, 42,
791 /* 260 */ 131, 535, 69, 107, 301, 302, 303, 394, 305, 15,
792 /* 270 */ 59, 60, 120, 161, 119, 446, 463, 424, 376, 423,
793 /* 280 */ 1, 42, 397, 78, 78, 36, 434, 11, 394, 435,
794 /* 290 */ 356, 59, 60, 12, 152, 139, 432, 14, 16, 376,
795 /* 300 */ 18, 65, 2, 138, 106, 430, 436, 437, 438, 439,
796 /* 310 */ 44, 375, 19, 117, 393, 155, 154, 153, 441, 440,
797 /* 320 */ 142, 140, 64, 63, 62, 61, 106, 20, 68, 376,
798 /* 330 */ 359, 107, 23, 375, 45, 117, 393, 155, 154, 153,
799 /* 340 */ 120, 161, 119, 55, 463, 114, 26, 57, 106, 147,
800 /* 350 */ 146, 434, 569, 58, 392, 375, 43, 117, 393, 155,
801 /* 360 */ 154, 153, 152, 384, 64, 63, 62, 61, 382, 106,
802 /* 370 */ 383, 436, 437, 438, 439, 377, 375, 70, 117, 393,
803 /* 380 */ 155, 154, 153, 160, 39, 22, 21, 445, 142, 140,
804 /* 390 */ 64, 63, 62, 61, 24, 17, 145, 141, 431, 108,
805 /* 400 */ 445, 445, 445, 391, 445, 445, 375, 445, 117, 445,
806 /* 410 */ 445, 55, 74, 445, 148, 445, 445, 147, 146, 124,
807 /* 420 */ 113, 120, 161, 119, 43, 445, 445, 142, 140, 64,
808 /* 430 */ 63, 62, 61, 445, 394, 445, 445, 59, 60, 64,
809 /* 440 */ 63, 62, 61, 149, 445, 376, 445, 445, 42, 445,
810 /* 450 */ 55, 445, 391, 22, 21, 445, 147, 146, 445, 445,
811 /* 460 */ 52, 445, 24, 43, 145, 141, 431, 394, 445, 445,
812 /* 470 */ 59, 60, 64, 63, 62, 61, 445, 445, 376, 132,
813 /* 480 */ 130, 42, 445, 445, 445, 355, 156, 156, 156, 445,
814 /* 490 */ 445, 445, 22, 21, 445, 394, 473, 445, 59, 60,
815 /* 500 */ 445, 24, 445, 145, 141, 431, 376, 445, 107, 42,
816 /* 510 */ 64, 63, 62, 61, 445, 106, 445, 120, 161, 119,
817 /* 520 */ 445, 478, 375, 354, 117, 393, 155, 154, 153, 445,
818 /* 530 */ 394, 143, 473, 59, 60, 64, 63, 62, 61, 152,
819 /* 540 */ 445, 376, 445, 445, 42, 445, 445, 445, 106, 64,
820 /* 550 */ 63, 62, 61, 445, 445, 375, 50, 117, 393, 155,
821 /* 560 */ 154, 153, 445, 394, 144, 445, 59, 60, 445, 445,
822 /* 570 */ 53, 72, 445, 148, 376, 445, 106, 42, 125, 113,
823 /* 580 */ 120, 161, 119, 375, 445, 117, 393, 155, 154, 153,
824 /* 590 */ 394, 445, 445, 59, 60, 445, 445, 445, 445, 445,
825 /* 600 */ 445, 102, 149, 445, 42, 445, 74, 445, 148, 445,
826 /* 610 */ 445, 106, 445, 497, 113, 120, 161, 119, 375, 445,
827 /* 620 */ 117, 393, 155, 154, 153, 394, 445, 445, 59, 60,
828 /* 630 */ 445, 445, 88, 445, 445, 445, 376, 149, 445, 40,
829 /* 640 */ 445, 120, 161, 119, 106, 445, 445, 435, 110, 110,
830 /* 650 */ 445, 375, 445, 117, 393, 155, 154, 153, 394, 445,
831 /* 660 */ 445, 59, 60, 152, 85, 445, 445, 445, 445, 376,
832 /* 670 */ 445, 106, 41, 120, 161, 119, 441, 440, 375, 445,
833 /* 680 */ 117, 393, 155, 154, 153, 448, 454, 29, 445, 445,
834 /* 690 */ 74, 450, 148, 75, 88, 152, 445, 496, 113, 120,
835 /* 700 */ 161, 119, 163, 120, 161, 119, 106, 27, 445, 434,
836 /* 710 */ 111, 111, 445, 375, 445, 117, 393, 155, 154, 153,
837 /* 720 */ 445, 149, 445, 445, 445, 152, 74, 445, 148, 436,
838 /* 730 */ 437, 438, 439, 490, 113, 120, 161, 119, 445, 106,
839 /* 740 */ 121, 447, 454, 29, 445, 445, 375, 450, 117, 393,
840 /* 750 */ 155, 154, 153, 445, 445, 445, 445, 149, 163, 74,
841 /* 760 */ 445, 148, 444, 27, 445, 445, 484, 113, 120, 161,
842 /* 770 */ 119, 445, 445, 445, 74, 445, 148, 445, 445, 445,
843 /* 780 */ 445, 483, 113, 120, 161, 119, 74, 445, 148, 86,
844 /* 790 */ 149, 445, 445, 480, 113, 120, 161, 119, 120, 161,
845 /* 800 */ 119, 445, 74, 445, 148, 149, 445, 445, 445, 134,
846 /* 810 */ 113, 120, 161, 119, 74, 445, 148, 149, 445, 445,
847 /* 820 */ 152, 517, 113, 120, 161, 119, 88, 64, 63, 62,
848 /* 830 */ 61, 445, 445, 149, 445, 120, 161, 119, 445, 74,
849 /* 840 */ 396, 148, 475, 445, 445, 149, 137, 113, 120, 161,
850 /* 850 */ 119, 74, 445, 148, 445, 445, 445, 152, 525, 113,
851 /* 860 */ 120, 161, 119, 445, 74, 445, 148, 445, 445, 445,
852 /* 870 */ 149, 527, 113, 120, 161, 119, 445, 445, 445, 74,
853 /* 880 */ 445, 148, 149, 445, 445, 445, 524, 113, 120, 161,
854 /* 890 */ 119, 74, 445, 148, 98, 149, 445, 445, 526, 113,
855 /* 900 */ 120, 161, 119, 120, 161, 119, 445, 74, 445, 148,
856 /* 910 */ 149, 445, 445, 445, 523, 113, 120, 161, 119, 74,
857 /* 920 */ 445, 148, 149, 445, 445, 152, 522, 113, 120, 161,
858 /* 930 */ 119, 89, 64, 63, 62, 61, 445, 445, 149, 445,
859 /* 940 */ 120, 161, 119, 445, 74, 395, 148, 445, 445, 445,
860 /* 950 */ 149, 521, 113, 120, 161, 119, 74, 445, 148, 445,
861 /* 960 */ 445, 445, 152, 520, 113, 120, 161, 119, 445, 74,
862 /* 970 */ 445, 148, 445, 445, 445, 149, 519, 113, 120, 161,
863 /* 980 */ 119, 445, 445, 445, 74, 445, 148, 149, 445, 445,
864 /* 990 */ 445, 150, 113, 120, 161, 119, 74, 445, 148, 90,
865 /* 1000 */ 149, 445, 445, 151, 113, 120, 161, 119, 120, 161,
866 /* 1010 */ 119, 445, 74, 445, 148, 149, 445, 435, 445, 136,
867 /* 1020 */ 113, 120, 161, 119, 74, 445, 148, 149, 445, 445,
868 /* 1030 */ 152, 135, 113, 120, 161, 119, 64, 63, 62, 61,
869 /* 1040 */ 445, 445, 445, 149, 445, 445, 441, 440, 445, 88,
870 /* 1050 */ 445, 445, 445, 445, 445, 149, 445, 56, 120, 161,
871 /* 1060 */ 119, 88, 445, 445, 10, 479, 479, 445, 445, 445,
872 /* 1070 */ 120, 161, 119, 445, 445, 445, 445, 82, 445, 434,
873 /* 1080 */ 152, 445, 445, 445, 466, 445, 34, 109, 447, 454,
874 /* 1090 */ 29, 445, 152, 445, 450, 445, 445, 445, 107, 436,
875 /* 1100 */ 437, 438, 439, 87, 445, 163, 445, 120, 161, 119,
876 /* 1110 */ 27, 451, 120, 161, 119, 99, 445, 64, 63, 62,
877 /* 1120 */ 61, 445, 100, 445, 120, 161, 119, 101, 445, 152,
878 /* 1130 */ 391, 120, 161, 119, 152, 445, 120, 161, 119, 91,
879 /* 1140 */ 445, 445, 445, 445, 445, 445, 152, 445, 120, 161,
880 /* 1150 */ 119, 103, 445, 152, 92, 445, 445, 445, 152, 445,
881 /* 1160 */ 120, 161, 119, 120, 161, 119, 93, 445, 445, 104,
882 /* 1170 */ 152, 445, 445, 445, 445, 120, 161, 119, 120, 161,
883 /* 1180 */ 119, 445, 152, 445, 94, 152, 445, 445, 445, 445,
884 /* 1190 */ 445, 445, 105, 120, 161, 119, 445, 152, 445, 95,
885 /* 1200 */ 152, 120, 161, 119, 445, 445, 445, 96, 120, 161,
886 /* 1210 */ 119, 445, 445, 445, 445, 152, 120, 161, 119, 445,
887 /* 1220 */ 445, 445, 445, 152, 445, 445, 445, 445, 445, 445,
888 /* 1230 */ 152, 97, 445, 445, 549, 445, 445, 548, 152, 445,
889 /* 1240 */ 120, 161, 119, 120, 161, 119, 120, 161, 119, 445,
890 /* 1250 */ 445, 445, 445, 445, 445, 445, 445, 445, 445, 445,
891 /* 1260 */ 445, 445, 152, 547, 445, 152, 546, 445, 152, 115,
892 /* 1270 */ 445, 445, 120, 161, 119, 120, 161, 119, 120, 161,
893 /* 1280 */ 119, 116, 445, 445, 445, 445, 445, 445, 445, 445,
894 /* 1290 */ 120, 161, 119, 445, 152, 445, 445, 152, 445, 445,
895 /* 1300 */ 152, 445, 445, 445, 445, 445, 445, 445, 445, 445,
896 /* 1310 */ 445, 445, 152,
897 };
898 static const YYCODETYPE yy_lookahead[] = {
899 /* 0 */ 0, 113, 114, 115, 134, 102, 103, 104, 106, 106,
900 /* 10 */ 10, 113, 114, 115, 111, 112, 113, 114, 115, 106,
901 /* 20 */ 20, 21, 22, 105, 24, 126, 108, 109, 28, 4,
902 /* 30 */ 5, 6, 7, 33, 34, 35, 36, 37, 135, 39,
903 /* 40 */ 40, 41, 42, 105, 44, 45, 108, 109, 107, 49,
904 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
905 /* 60 */ 60, 61, 62, 63, 0, 113, 114, 115, 130, 131,
906 /* 70 */ 132, 104, 25, 106, 10, 113, 114, 115, 111, 112,
907 /* 80 */ 113, 114, 115, 106, 20, 21, 22, 128, 24, 113,
908 /* 90 */ 114, 115, 28, 129, 2, 26, 27, 33, 34, 35,
909 /* 100 */ 36, 37, 135, 39, 40, 41, 42, 2, 44, 45,
910 /* 110 */ 133, 26, 27, 49, 50, 51, 52, 53, 54, 55,
911 /* 120 */ 56, 57, 58, 59, 60, 61, 62, 63, 1, 2,
912 /* 130 */ 38, 4, 5, 4, 5, 6, 7, 17, 10, 12,
913 /* 140 */ 4, 5, 15, 38, 1, 25, 17, 29, 30, 31,
914 /* 150 */ 32, 24, 83, 26, 27, 12, 28, 14, 31, 32,
915 /* 160 */ 91, 18, 116, 20, 21, 22, 23, 24, 116, 26,
916 /* 170 */ 27, 19, 29, 30, 31, 32, 91, 3, 64, 65,
917 /* 180 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 6,
918 /* 190 */ 7, 64, 4, 5, 6, 7, 8, 97, 98, 20,
919 /* 200 */ 21, 22, 26, 27, 4, 5, 6, 7, 1, 82,
920 /* 210 */ 48, 84, 85, 86, 87, 17, 89, 17, 91, 92,
921 /* 220 */ 93, 94, 95, 1, 2, 25, 4, 5, 49, 50,
922 /* 230 */ 51, 52, 53, 54, 12, 16, 15, 15, 4, 5,
923 /* 240 */ 6, 7, 20, 21, 22, 1, 26, 27, 4, 5,
924 /* 250 */ 48, 43, 90, 31, 32, 40, 12, 40, 96, 15,
925 /* 260 */ 47, 99, 88, 104, 20, 21, 22, 1, 24, 35,
926 /* 270 */ 4, 5, 113, 114, 115, 0, 117, 41, 12, 41,
927 /* 280 */ 13, 15, 17, 124, 125, 10, 64, 25, 1, 2,
928 /* 290 */ 17, 4, 5, 75, 135, 81, 80, 3, 3, 12,
929 /* 300 */ 3, 99, 15, 79, 82, 80, 84, 85, 86, 87,
930 /* 310 */ 38, 89, 3, 91, 92, 93, 94, 95, 31, 32,
931 /* 320 */ 2, 3, 4, 5, 6, 7, 82, 3, 3, 12,
932 /* 330 */ 77, 104, 25, 89, 16, 91, 92, 93, 94, 95,
933 /* 340 */ 113, 114, 115, 25, 117, 96, 15, 15, 82, 31,
934 /* 350 */ 32, 64, 125, 15, 17, 89, 38, 91, 92, 93,
935 /* 360 */ 94, 95, 135, 28, 4, 5, 6, 7, 28, 82,
936 /* 370 */ 28, 84, 85, 86, 87, 12, 89, 3, 91, 92,
937 /* 380 */ 93, 94, 95, 90, 11, 67, 68, 136, 2, 3,
938 /* 390 */ 4, 5, 6, 7, 76, 35, 78, 79, 80, 82,
939 /* 400 */ 136, 136, 136, 17, 136, 136, 89, 136, 91, 136,
940 /* 410 */ 136, 25, 104, 136, 106, 136, 136, 31, 32, 111,
941 /* 420 */ 112, 113, 114, 115, 38, 136, 136, 2, 3, 4,
942 /* 430 */ 5, 6, 7, 136, 1, 136, 136, 4, 5, 4,
943 /* 440 */ 5, 6, 7, 135, 136, 12, 136, 136, 15, 136,
944 /* 450 */ 25, 136, 17, 67, 68, 136, 31, 32, 136, 136,
945 /* 460 */ 25, 136, 76, 38, 78, 79, 80, 1, 136, 136,
946 /* 470 */ 4, 5, 4, 5, 6, 7, 136, 136, 12, 46,
947 /* 480 */ 47, 15, 136, 136, 136, 17, 20, 21, 22, 136,
948 /* 490 */ 136, 136, 67, 68, 136, 1, 2, 136, 4, 5,
949 /* 500 */ 136, 76, 136, 78, 79, 80, 12, 136, 104, 15,
950 /* 510 */ 4, 5, 6, 7, 136, 82, 136, 113, 114, 115,
951 /* 520 */ 136, 117, 89, 17, 91, 92, 93, 94, 95, 136,
952 /* 530 */ 1, 2, 38, 4, 5, 4, 5, 6, 7, 135,
953 /* 540 */ 136, 12, 136, 136, 15, 136, 136, 136, 82, 4,
954 /* 550 */ 5, 6, 7, 136, 136, 89, 25, 91, 92, 93,
955 /* 560 */ 94, 95, 136, 1, 2, 136, 4, 5, 136, 136,
956 /* 570 */ 25, 104, 136, 106, 12, 136, 82, 15, 111, 112,
957 /* 580 */ 113, 114, 115, 89, 136, 91, 92, 93, 94, 95,
958 /* 590 */ 1, 136, 136, 4, 5, 136, 136, 136, 136, 136,
959 /* 600 */ 136, 12, 135, 136, 15, 136, 104, 136, 106, 136,
960 /* 610 */ 136, 82, 136, 111, 112, 113, 114, 115, 89, 136,
961 /* 620 */ 91, 92, 93, 94, 95, 1, 136, 136, 4, 5,
962 /* 630 */ 136, 136, 104, 136, 136, 136, 12, 135, 136, 15,
963 /* 640 */ 136, 113, 114, 115, 82, 136, 136, 2, 120, 121,
964 /* 650 */ 136, 89, 136, 91, 92, 93, 94, 95, 1, 136,
965 /* 660 */ 136, 4, 5, 135, 104, 136, 136, 136, 136, 12,
966 /* 670 */ 136, 82, 15, 113, 114, 115, 31, 32, 89, 136,
967 /* 680 */ 91, 92, 93, 94, 95, 101, 102, 103, 136, 136,
968 /* 690 */ 104, 107, 106, 48, 104, 135, 136, 111, 112, 113,
969 /* 700 */ 114, 115, 118, 113, 114, 115, 82, 123, 136, 64,
970 /* 710 */ 120, 121, 136, 89, 136, 91, 92, 93, 94, 95,
971 /* 720 */ 136, 135, 136, 136, 136, 135, 104, 136, 106, 84,
972 /* 730 */ 85, 86, 87, 111, 112, 113, 114, 115, 136, 82,
973 /* 740 */ 100, 101, 102, 103, 136, 136, 89, 107, 91, 92,
974 /* 750 */ 93, 94, 95, 136, 136, 136, 136, 135, 118, 104,
975 /* 760 */ 136, 106, 122, 123, 136, 136, 111, 112, 113, 114,
976 /* 770 */ 115, 136, 136, 136, 104, 136, 106, 136, 136, 136,
977 /* 780 */ 136, 111, 112, 113, 114, 115, 104, 136, 106, 104,
978 /* 790 */ 135, 136, 136, 111, 112, 113, 114, 115, 113, 114,
979 /* 800 */ 115, 136, 104, 136, 106, 135, 136, 136, 136, 111,
980 /* 810 */ 112, 113, 114, 115, 104, 136, 106, 135, 136, 136,
981 /* 820 */ 135, 111, 112, 113, 114, 115, 104, 4, 5, 6,
982 /* 830 */ 7, 136, 136, 135, 136, 113, 114, 115, 136, 104,
983 /* 840 */ 17, 106, 120, 136, 136, 135, 111, 112, 113, 114,
984 /* 850 */ 115, 104, 136, 106, 136, 136, 136, 135, 111, 112,
985 /* 860 */ 113, 114, 115, 136, 104, 136, 106, 136, 136, 136,
986 /* 870 */ 135, 111, 112, 113, 114, 115, 136, 136, 136, 104,
987 /* 880 */ 136, 106, 135, 136, 136, 136, 111, 112, 113, 114,
988 /* 890 */ 115, 104, 136, 106, 104, 135, 136, 136, 111, 112,
989 /* 900 */ 113, 114, 115, 113, 114, 115, 136, 104, 136, 106,
990 /* 910 */ 135, 136, 136, 136, 111, 112, 113, 114, 115, 104,
991 /* 920 */ 136, 106, 135, 136, 136, 135, 111, 112, 113, 114,
992 /* 930 */ 115, 104, 4, 5, 6, 7, 136, 136, 135, 136,
993 /* 940 */ 113, 114, 115, 136, 104, 17, 106, 136, 136, 136,
994 /* 950 */ 135, 111, 112, 113, 114, 115, 104, 136, 106, 136,
995 /* 960 */ 136, 136, 135, 111, 112, 113, 114, 115, 136, 104,
996 /* 970 */ 136, 106, 136, 136, 136, 135, 111, 112, 113, 114,
997 /* 980 */ 115, 136, 136, 136, 104, 136, 106, 135, 136, 136,
998 /* 990 */ 136, 111, 112, 113, 114, 115, 104, 136, 106, 104,
999 /* 1000 */ 135, 136, 136, 111, 112, 113, 114, 115, 113, 114,
1000 /* 1010 */ 115, 136, 104, 136, 106, 135, 136, 2, 136, 111,
1001 /* 1020 */ 112, 113, 114, 115, 104, 136, 106, 135, 136, 136,
1002 /* 1030 */ 135, 111, 112, 113, 114, 115, 4, 5, 6, 7,
1003 /* 1040 */ 136, 136, 136, 135, 136, 136, 31, 32, 136, 104,
1004 /* 1050 */ 136, 136, 136, 136, 136, 135, 136, 25, 113, 114,
1005 /* 1060 */ 115, 104, 136, 136, 119, 120, 121, 136, 136, 136,
1006 /* 1070 */ 113, 114, 115, 136, 136, 136, 136, 120, 136, 64,
1007 /* 1080 */ 135, 136, 136, 136, 127, 136, 129, 100, 101, 102,
1008 /* 1090 */ 103, 136, 135, 136, 107, 136, 136, 136, 104, 84,
1009 /* 1100 */ 85, 86, 87, 104, 136, 118, 136, 113, 114, 115,
1010 /* 1110 */ 123, 117, 113, 114, 115, 104, 136, 4, 5, 6,
1011 /* 1120 */ 7, 136, 104, 136, 113, 114, 115, 104, 136, 135,
1012 /* 1130 */ 17, 113, 114, 115, 135, 136, 113, 114, 115, 104,
1013 /* 1140 */ 136, 136, 136, 136, 136, 136, 135, 136, 113, 114,
1014 /* 1150 */ 115, 104, 136, 135, 104, 136, 136, 136, 135, 136,
1015 /* 1160 */ 113, 114, 115, 113, 114, 115, 104, 136, 136, 104,
1016 /* 1170 */ 135, 136, 136, 136, 136, 113, 114, 115, 113, 114,
1017 /* 1180 */ 115, 136, 135, 136, 104, 135, 136, 136, 136, 136,
1018 /* 1190 */ 136, 136, 104, 113, 114, 115, 136, 135, 136, 104,
1019 /* 1200 */ 135, 113, 114, 115, 136, 136, 136, 104, 113, 114,
1020 /* 1210 */ 115, 136, 136, 136, 136, 135, 113, 114, 115, 136,
1021 /* 1220 */ 136, 136, 136, 135, 136, 136, 136, 136, 136, 136,
1022 /* 1230 */ 135, 104, 136, 136, 104, 136, 136, 104, 135, 136,
1023 /* 1240 */ 113, 114, 115, 113, 114, 115, 113, 114, 115, 136,
1024 /* 1250 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
1025 /* 1260 */ 136, 136, 135, 104, 136, 135, 104, 136, 135, 104,
1026 /* 1270 */ 136, 136, 113, 114, 115, 113, 114, 115, 113, 114,
1027 /* 1280 */ 115, 104, 136, 136, 136, 136, 136, 136, 136, 136,
1028 /* 1290 */ 113, 114, 115, 136, 135, 136, 136, 135, 136, 136,
1029 /* 1300 */ 135, 136, 136, 136, 136, 136, 136, 136, 136, 136,
1030 /* 1310 */ 136, 136, 135, 100, 100, 100, 100, 100, 100, 100,
1031 /* 1320 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1032 /* 1330 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1033 /* 1340 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1034 /* 1350 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1035 /* 1360 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1036 /* 1370 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1037 /* 1380 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1038 /* 1390 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1039 /* 1400 */ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1040 /* 1410 */ 100, 100, 100,
1041 };
1042 #define YY_SHIFT_COUNT (163)
1043 #define YY_SHIFT_MIN (0)
1044 #define YY_SHIFT_MAX (1113)
1045 static const unsigned short int yy_shift_ofst[] = {
1046 /* 0 */ 143, 127, 222, 287, 287, 287, 287, 287, 287, 287,
1047 /* 10 */ 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
1048 /* 20 */ 287, 287, 287, 287, 287, 287, 287, 244, 433, 266,
1049 /* 30 */ 244, 143, 494, 494, 0, 64, 143, 589, 266, 589,
1050 /* 40 */ 466, 466, 466, 529, 562, 266, 266, 266, 266, 266,
1051 /* 50 */ 266, 624, 266, 266, 657, 266, 266, 266, 266, 266,
1052 /* 60 */ 266, 266, 266, 266, 266, 179, 317, 317, 317, 317,
1053 /* 70 */ 317, 645, 318, 386, 425, 1015, 1015, 118, 47, 1313,
1054 /* 80 */ 1313, 1313, 1313, 114, 114, 200, 435, 129, 188, 234,
1055 /* 90 */ 360, 468, 531, 506, 545, 823, 1032, 928, 1113, 25,
1056 /* 100 */ 25, 25, 162, 25, 25, 25, 69, 25, 85, 128,
1057 /* 110 */ 92, 105, 120, 136, 100, 183, 183, 176, 220, 174,
1058 /* 120 */ 202, 275, 152, 207, 198, 219, 221, 208, 215, 217,
1059 /* 130 */ 236, 238, 213, 267, 265, 262, 218, 273, 216, 224,
1060 /* 140 */ 214, 225, 294, 295, 297, 272, 309, 324, 325, 249,
1061 /* 150 */ 253, 307, 249, 331, 332, 338, 337, 335, 340, 342,
1062 /* 160 */ 363, 293, 374, 373,
1063 };
1064 #define YY_REDUCE_COUNT (82)
1065 #define YY_REDUCE_MIN (-130)
1066 #define YY_REDUCE_MAX (1177)
1067 static const short yy_reduce_ofst[] = {
1068 /* 0 */ 640, -97, -33, 308, 467, 502, 586, 622, 655, 670,
1069 /* 10 */ 682, 698, 710, 735, 747, 760, 775, 787, 803, 815,
1070 /* 20 */ 840, 852, 865, 880, 892, 908, 920, 159, 945, 957,
1071 /* 30 */ 227, 987, 528, 590, -62, -62, 584, 404, 722, 994,
1072 /* 40 */ 560, 685, 790, 827, 895, 999, 1011, 1018, 1023, 1035,
1073 /* 50 */ 1047, 1050, 1062, 1065, 1080, 1088, 1095, 1103, 1127, 1130,
1074 /* 60 */ 1133, 1159, 1162, 1165, 1177, -82, -112, -102, -48, -38,
1075 /* 70 */ -24, -23, -130, -130, -130, -98, -87, -59, -101, -41,
1076 /* 80 */ 46, 52, -36,
1077 };
1078 static const YYACTIONTYPE yy_default[] = {
1079 /* 0 */ 449, 443, 443, 443, 443, 443, 443, 443, 443, 443,
1080 /* 10 */ 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
1081 /* 20 */ 443, 443, 443, 443, 443, 443, 443, 443, 473, 576,
@@ -1177,10 +1181,11 @@
1181 0, /* RJUST => nothing */
1182 0, /* ABOVE => nothing */
1183 0, /* BELOW => nothing */
1184 0, /* ITALIC => nothing */
1185 0, /* BOLD => nothing */
1186 0, /* MONO => nothing */
1187 0, /* ALIGNED => nothing */
1188 0, /* BIG => nothing */
1189 0, /* SMALL => nothing */
1190 0, /* AND => nothing */
1191 0, /* LT => nothing */
@@ -1364,74 +1369,75 @@
1369 /* 66 */ "RJUST",
1370 /* 67 */ "ABOVE",
1371 /* 68 */ "BELOW",
1372 /* 69 */ "ITALIC",
1373 /* 70 */ "BOLD",
1374 /* 71 */ "MONO",
1375 /* 72 */ "ALIGNED",
1376 /* 73 */ "BIG",
1377 /* 74 */ "SMALL",
1378 /* 75 */ "AND",
1379 /* 76 */ "LT",
1380 /* 77 */ "GT",
1381 /* 78 */ "ON",
1382 /* 79 */ "WAY",
1383 /* 80 */ "BETWEEN",
1384 /* 81 */ "THE",
1385 /* 82 */ "NTH",
1386 /* 83 */ "VERTEX",
1387 /* 84 */ "TOP",
1388 /* 85 */ "BOTTOM",
1389 /* 86 */ "START",
1390 /* 87 */ "END",
1391 /* 88 */ "IN",
1392 /* 89 */ "THIS",
1393 /* 90 */ "DOT_U",
1394 /* 91 */ "LAST",
1395 /* 92 */ "NUMBER",
1396 /* 93 */ "FUNC1",
1397 /* 94 */ "FUNC2",
1398 /* 95 */ "DIST",
1399 /* 96 */ "DOT_XY",
1400 /* 97 */ "X",
1401 /* 98 */ "Y",
1402 /* 99 */ "DOT_L",
1403 /* 100 */ "statement_list",
1404 /* 101 */ "statement",
1405 /* 102 */ "unnamed_statement",
1406 /* 103 */ "basetype",
1407 /* 104 */ "expr",
1408 /* 105 */ "numproperty",
1409 /* 106 */ "edge",
1410 /* 107 */ "direction",
1411 /* 108 */ "dashproperty",
1412 /* 109 */ "colorproperty",
1413 /* 110 */ "locproperty",
1414 /* 111 */ "position",
1415 /* 112 */ "place",
1416 /* 113 */ "object",
1417 /* 114 */ "objectname",
1418 /* 115 */ "nth",
1419 /* 116 */ "textposition",
1420 /* 117 */ "rvalue",
1421 /* 118 */ "lvalue",
1422 /* 119 */ "even",
1423 /* 120 */ "relexpr",
1424 /* 121 */ "optrelexpr",
1425 /* 122 */ "document",
1426 /* 123 */ "print",
1427 /* 124 */ "prlist",
1428 /* 125 */ "pritem",
1429 /* 126 */ "prsep",
1430 /* 127 */ "attribute_list",
1431 /* 128 */ "savelist",
1432 /* 129 */ "alist",
1433 /* 130 */ "attribute",
1434 /* 131 */ "go",
1435 /* 132 */ "boolproperty",
1436 /* 133 */ "withclause",
1437 /* 134 */ "between",
1438 /* 135 */ "place2",
1439 };
1440 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
1441
1442 #ifndef NDEBUG
1443 /* For tracing reduce actions, the names of all rules are required.
@@ -1498,11 +1504,11 @@
1504 /* 58 */ "boolproperty ::= INVIS",
1505 /* 59 */ "boolproperty ::= THICK",
1506 /* 60 */ "boolproperty ::= THIN",
1507 /* 61 */ "boolproperty ::= SOLID",
1508 /* 62 */ "textposition ::=",
1509 /* 63 */ "textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL",
1510 /* 64 */ "position ::= expr COMMA expr",
1511 /* 65 */ "position ::= place PLUS expr COMMA expr",
1512 /* 66 */ "position ::= place MINUS expr COMMA expr",
1513 /* 67 */ "position ::= place PLUS LP expr COMMA expr RP",
1514 /* 68 */ "position ::= place MINUS LP expr COMMA expr RP",
@@ -1716,24 +1722,24 @@
1722 ** Note: during a reduce, the only symbols destroyed are those
1723 ** which appear on the RHS of the rule, but which are *not* used
1724 ** inside the C code.
1725 */
1726 /********* Begin destructor definitions ***************************************/
1727 case 100: /* statement_list */
1728 {
1729 #line 510 "pikchr.y"
1730 pik_elist_free(p,(yypminor->yy235));
1731 #line 1756 "pikchr.c"
1732 }
1733 break;
1734 case 101: /* statement */
1735 case 102: /* unnamed_statement */
1736 case 103: /* basetype */
1737 {
1738 #line 512 "pikchr.y"
1739 pik_elem_free(p,(yypminor->yy162));
1740 #line 1765 "pikchr.c"
1741 }
1742 break;
1743 /********* End destructor definitions *****************************************/
1744 default: break; /* If no destructor action specified: do nothing */
1745 }
@@ -1947,14 +1953,14 @@
1953 #endif
1954 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1955 /* Here code is inserted which will execute if the parser
1956 ** stack every overflows */
1957 /******** Begin %stack_overflow code ******************************************/
1958 #line 544 "pikchr.y"
1959
1960 pik_error(p, 0, "parser stack overflow");
1961 #line 1986 "pikchr.c"
1962 /******** End %stack_overflow code ********************************************/
1963 pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
1964 pik_parserCTX_STORE
1965 }
1966
@@ -2022,166 +2028,166 @@
2028 }
2029
2030 /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
2031 ** of that rule */
2032 static const YYCODETYPE yyRuleInfoLhs[] = {
2033 122, /* (0) document ::= statement_list */
2034 100, /* (1) statement_list ::= statement */
2035 100, /* (2) statement_list ::= statement_list EOL statement */
2036 101, /* (3) statement ::= */
2037 101, /* (4) statement ::= direction */
2038 101, /* (5) statement ::= lvalue ASSIGN rvalue */
2039 101, /* (6) statement ::= PLACENAME COLON unnamed_statement */
2040 101, /* (7) statement ::= PLACENAME COLON position */
2041 101, /* (8) statement ::= unnamed_statement */
2042 101, /* (9) statement ::= print prlist */
2043 101, /* (10) statement ::= ASSERT LP expr EQ expr RP */
2044 101, /* (11) statement ::= ASSERT LP position EQ position RP */
2045 101, /* (12) statement ::= DEFINE ID CODEBLOCK */
2046 117, /* (13) rvalue ::= PLACENAME */
2047 125, /* (14) pritem ::= FILL */
2048 125, /* (15) pritem ::= COLOR */
2049 125, /* (16) pritem ::= THICKNESS */
2050 125, /* (17) pritem ::= rvalue */
2051 125, /* (18) pritem ::= STRING */
2052 126, /* (19) prsep ::= COMMA */
2053 102, /* (20) unnamed_statement ::= basetype attribute_list */
2054 103, /* (21) basetype ::= CLASSNAME */
2055 103, /* (22) basetype ::= STRING textposition */
2056 103, /* (23) basetype ::= LB savelist statement_list RB */
2057 128, /* (24) savelist ::= */
2058 120, /* (25) relexpr ::= expr */
2059 120, /* (26) relexpr ::= expr PERCENT */
2060 121, /* (27) optrelexpr ::= */
2061 127, /* (28) attribute_list ::= relexpr alist */
2062 130, /* (29) attribute ::= numproperty relexpr */
2063 130, /* (30) attribute ::= dashproperty expr */
2064 130, /* (31) attribute ::= dashproperty */
2065 130, /* (32) attribute ::= colorproperty rvalue */
2066 130, /* (33) attribute ::= go direction optrelexpr */
2067 130, /* (34) attribute ::= go direction even position */
2068 130, /* (35) attribute ::= CLOSE */
2069 130, /* (36) attribute ::= CHOP */
2070 130, /* (37) attribute ::= FROM position */
2071 130, /* (38) attribute ::= TO position */
2072 130, /* (39) attribute ::= THEN */
2073 130, /* (40) attribute ::= THEN optrelexpr HEADING expr */
2074 130, /* (41) attribute ::= THEN optrelexpr EDGEPT */
2075 130, /* (42) attribute ::= GO optrelexpr HEADING expr */
2076 130, /* (43) attribute ::= GO optrelexpr EDGEPT */
2077 130, /* (44) attribute ::= AT position */
2078 130, /* (45) attribute ::= SAME */
2079 130, /* (46) attribute ::= SAME AS object */
2080 130, /* (47) attribute ::= STRING textposition */
2081 130, /* (48) attribute ::= FIT */
2082 130, /* (49) attribute ::= BEHIND object */
2083 133, /* (50) withclause ::= DOT_E edge AT position */
2084 133, /* (51) withclause ::= edge AT position */
2085 105, /* (52) numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2086 132, /* (53) boolproperty ::= CW */
2087 132, /* (54) boolproperty ::= CCW */
2088 132, /* (55) boolproperty ::= LARROW */
2089 132, /* (56) boolproperty ::= RARROW */
2090 132, /* (57) boolproperty ::= LRARROW */
2091 132, /* (58) boolproperty ::= INVIS */
2092 132, /* (59) boolproperty ::= THICK */
2093 132, /* (60) boolproperty ::= THIN */
2094 132, /* (61) boolproperty ::= SOLID */
2095 116, /* (62) textposition ::= */
2096 116, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL */
2097 111, /* (64) position ::= expr COMMA expr */
2098 111, /* (65) position ::= place PLUS expr COMMA expr */
2099 111, /* (66) position ::= place MINUS expr COMMA expr */
2100 111, /* (67) position ::= place PLUS LP expr COMMA expr RP */
2101 111, /* (68) position ::= place MINUS LP expr COMMA expr RP */
2102 111, /* (69) position ::= LP position COMMA position RP */
2103 111, /* (70) position ::= LP position RP */
2104 111, /* (71) position ::= expr between position AND position */
2105 111, /* (72) position ::= expr LT position COMMA position GT */
2106 111, /* (73) position ::= expr ABOVE position */
2107 111, /* (74) position ::= expr BELOW position */
2108 111, /* (75) position ::= expr LEFT OF position */
2109 111, /* (76) position ::= expr RIGHT OF position */
2110 111, /* (77) position ::= expr ON HEADING EDGEPT OF position */
2111 111, /* (78) position ::= expr HEADING EDGEPT OF position */
2112 111, /* (79) position ::= expr EDGEPT OF position */
2113 111, /* (80) position ::= expr ON HEADING expr FROM position */
2114 111, /* (81) position ::= expr HEADING expr FROM position */
2115 112, /* (82) place ::= edge OF object */
2116 135, /* (83) place2 ::= object */
2117 135, /* (84) place2 ::= object DOT_E edge */
2118 135, /* (85) place2 ::= NTH VERTEX OF object */
2119 113, /* (86) object ::= nth */
2120 113, /* (87) object ::= nth OF|IN object */
2121 114, /* (88) objectname ::= THIS */
2122 114, /* (89) objectname ::= PLACENAME */
2123 114, /* (90) objectname ::= objectname DOT_U PLACENAME */
2124 115, /* (91) nth ::= NTH CLASSNAME */
2125 115, /* (92) nth ::= NTH LAST CLASSNAME */
2126 115, /* (93) nth ::= LAST CLASSNAME */
2127 115, /* (94) nth ::= LAST */
2128 115, /* (95) nth ::= NTH LB RB */
2129 115, /* (96) nth ::= NTH LAST LB RB */
2130 115, /* (97) nth ::= LAST LB RB */
2131 104, /* (98) expr ::= expr PLUS expr */
2132 104, /* (99) expr ::= expr MINUS expr */
2133 104, /* (100) expr ::= expr STAR expr */
2134 104, /* (101) expr ::= expr SLASH expr */
2135 104, /* (102) expr ::= MINUS expr */
2136 104, /* (103) expr ::= PLUS expr */
2137 104, /* (104) expr ::= LP expr RP */
2138 104, /* (105) expr ::= LP FILL|COLOR|THICKNESS RP */
2139 104, /* (106) expr ::= NUMBER */
2140 104, /* (107) expr ::= ID */
2141 104, /* (108) expr ::= FUNC1 LP expr RP */
2142 104, /* (109) expr ::= FUNC2 LP expr COMMA expr RP */
2143 104, /* (110) expr ::= DIST LP position COMMA position RP */
2144 104, /* (111) expr ::= place2 DOT_XY X */
2145 104, /* (112) expr ::= place2 DOT_XY Y */
2146 104, /* (113) expr ::= object DOT_L numproperty */
2147 104, /* (114) expr ::= object DOT_L dashproperty */
2148 104, /* (115) expr ::= object DOT_L colorproperty */
2149 118, /* (116) lvalue ::= ID */
2150 118, /* (117) lvalue ::= FILL */
2151 118, /* (118) lvalue ::= COLOR */
2152 118, /* (119) lvalue ::= THICKNESS */
2153 117, /* (120) rvalue ::= expr */
2154 123, /* (121) print ::= PRINT */
2155 124, /* (122) prlist ::= pritem */
2156 124, /* (123) prlist ::= prlist prsep pritem */
2157 107, /* (124) direction ::= UP */
2158 107, /* (125) direction ::= DOWN */
2159 107, /* (126) direction ::= LEFT */
2160 107, /* (127) direction ::= RIGHT */
2161 121, /* (128) optrelexpr ::= relexpr */
2162 127, /* (129) attribute_list ::= alist */
2163 129, /* (130) alist ::= */
2164 129, /* (131) alist ::= alist attribute */
2165 130, /* (132) attribute ::= boolproperty */
2166 130, /* (133) attribute ::= WITH withclause */
2167 131, /* (134) go ::= GO */
2168 131, /* (135) go ::= */
2169 119, /* (136) even ::= UNTIL EVEN WITH */
2170 119, /* (137) even ::= EVEN WITH */
2171 108, /* (138) dashproperty ::= DOTTED */
2172 108, /* (139) dashproperty ::= DASHED */
2173 109, /* (140) colorproperty ::= FILL */
2174 109, /* (141) colorproperty ::= COLOR */
2175 111, /* (142) position ::= place */
2176 134, /* (143) between ::= WAY BETWEEN */
2177 134, /* (144) between ::= BETWEEN */
2178 134, /* (145) between ::= OF THE WAY BETWEEN */
2179 112, /* (146) place ::= place2 */
2180 106, /* (147) edge ::= CENTER */
2181 106, /* (148) edge ::= EDGEPT */
2182 106, /* (149) edge ::= TOP */
2183 106, /* (150) edge ::= BOTTOM */
2184 106, /* (151) edge ::= START */
2185 106, /* (152) edge ::= END */
2186 106, /* (153) edge ::= RIGHT */
2187 106, /* (154) edge ::= LEFT */
2188 113, /* (155) object ::= objectname */
2189 };
2190
2191 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
2192 ** of symbols on the right-hand side of that rule. */
2193 static const signed char yyRuleInfoNRhs[] = {
@@ -2246,11 +2252,11 @@
2252 -1, /* (58) boolproperty ::= INVIS */
2253 -1, /* (59) boolproperty ::= THICK */
2254 -1, /* (60) boolproperty ::= THIN */
2255 -1, /* (61) boolproperty ::= SOLID */
2256 0, /* (62) textposition ::= */
2257 -2, /* (63) textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL */
2258 -3, /* (64) position ::= expr COMMA expr */
2259 -5, /* (65) position ::= place PLUS expr COMMA expr */
2260 -5, /* (66) position ::= place MINUS expr COMMA expr */
2261 -7, /* (67) position ::= place PLUS LP expr COMMA expr RP */
2262 -7, /* (68) position ::= place MINUS LP expr COMMA expr RP */
@@ -2381,620 +2387,620 @@
2387 ** break;
2388 */
2389 /********** Begin reduce actions **********************************************/
2390 YYMINORTYPE yylhsminor;
2391 case 0: /* document ::= statement_list */
2392 #line 548 "pikchr.y"
2393 {pik_render(p,yymsp[0].minor.yy235);}
2394 #line 2419 "pikchr.c"
2395 break;
2396 case 1: /* statement_list ::= statement */
2397 #line 551 "pikchr.y"
2398 { yylhsminor.yy235 = pik_elist_append(p,0,yymsp[0].minor.yy162); }
2399 #line 2424 "pikchr.c"
2400 yymsp[0].minor.yy235 = yylhsminor.yy235;
2401 break;
2402 case 2: /* statement_list ::= statement_list EOL statement */
2403 #line 553 "pikchr.y"
2404 { yylhsminor.yy235 = pik_elist_append(p,yymsp[-2].minor.yy235,yymsp[0].minor.yy162); }
2405 #line 2430 "pikchr.c"
2406 yymsp[-2].minor.yy235 = yylhsminor.yy235;
2407 break;
2408 case 3: /* statement ::= */
2409 #line 556 "pikchr.y"
2410 { yymsp[1].minor.yy162 = 0; }
2411 #line 2436 "pikchr.c"
2412 break;
2413 case 4: /* statement ::= direction */
2414 #line 557 "pikchr.y"
2415 { pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy162=0; }
2416 #line 2441 "pikchr.c"
2417 yymsp[0].minor.yy162 = yylhsminor.yy162;
2418 break;
2419 case 5: /* statement ::= lvalue ASSIGN rvalue */
2420 #line 558 "pikchr.y"
2421 {pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy21,&yymsp[-1].minor.yy0); yylhsminor.yy162=0;}
2422 #line 2447 "pikchr.c"
2423 yymsp[-2].minor.yy162 = yylhsminor.yy162;
2424 break;
2425 case 6: /* statement ::= PLACENAME COLON unnamed_statement */
2426 #line 560 "pikchr.y"
2427 { yylhsminor.yy162 = yymsp[0].minor.yy162; pik_elem_setname(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0); }
2428 #line 2453 "pikchr.c"
2429 yymsp[-2].minor.yy162 = yylhsminor.yy162;
2430 break;
2431 case 7: /* statement ::= PLACENAME COLON position */
2432 #line 562 "pikchr.y"
2433 { yylhsminor.yy162 = pik_elem_new(p,0,0,0);
2434 if(yylhsminor.yy162){ yylhsminor.yy162->ptAt = yymsp[0].minor.yy63; pik_elem_setname(p,yylhsminor.yy162,&yymsp[-2].minor.yy0); }}
2435 #line 2460 "pikchr.c"
2436 yymsp[-2].minor.yy162 = yylhsminor.yy162;
2437 break;
2438 case 8: /* statement ::= unnamed_statement */
2439 #line 564 "pikchr.y"
2440 {yylhsminor.yy162 = yymsp[0].minor.yy162;}
2441 #line 2466 "pikchr.c"
2442 yymsp[0].minor.yy162 = yylhsminor.yy162;
2443 break;
2444 case 9: /* statement ::= print prlist */
2445 #line 565 "pikchr.y"
2446 {pik_append(p,"<br>\n",5); yymsp[-1].minor.yy162=0;}
2447 #line 2472 "pikchr.c"
2448 break;
2449 case 10: /* statement ::= ASSERT LP expr EQ expr RP */
2450 #line 570 "pikchr.y"
2451 {yymsp[-5].minor.yy162=pik_assert(p,yymsp[-3].minor.yy21,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy21);}
2452 #line 2477 "pikchr.c"
2453 break;
2454 case 11: /* statement ::= ASSERT LP position EQ position RP */
2455 #line 572 "pikchr.y"
2456 {yymsp[-5].minor.yy162=pik_position_assert(p,&yymsp[-3].minor.yy63,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy63);}
2457 #line 2482 "pikchr.c"
2458 break;
2459 case 12: /* statement ::= DEFINE ID CODEBLOCK */
2460 #line 573 "pikchr.y"
2461 {yymsp[-2].minor.yy162=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
2462 #line 2487 "pikchr.c"
2463 break;
2464 case 13: /* rvalue ::= PLACENAME */
2465 #line 584 "pikchr.y"
2466 {yylhsminor.yy21 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
2467 #line 2492 "pikchr.c"
2468 yymsp[0].minor.yy21 = yylhsminor.yy21;
2469 break;
2470 case 14: /* pritem ::= FILL */
2471 case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
2472 case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
2473 #line 589 "pikchr.y"
2474 {pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
2475 #line 2500 "pikchr.c"
2476 break;
2477 case 17: /* pritem ::= rvalue */
2478 #line 592 "pikchr.y"
2479 {pik_append_num(p,"",yymsp[0].minor.yy21);}
2480 #line 2505 "pikchr.c"
2481 break;
2482 case 18: /* pritem ::= STRING */
2483 #line 593 "pikchr.y"
2484 {pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
2485 #line 2510 "pikchr.c"
2486 break;
2487 case 19: /* prsep ::= COMMA */
2488 #line 594 "pikchr.y"
2489 {pik_append(p, " ", 1);}
2490 #line 2515 "pikchr.c"
2491 break;
2492 case 20: /* unnamed_statement ::= basetype attribute_list */
2493 #line 597 "pikchr.y"
2494 {yylhsminor.yy162 = yymsp[-1].minor.yy162; pik_after_adding_attributes(p,yylhsminor.yy162);}
2495 #line 2520 "pikchr.c"
2496 yymsp[-1].minor.yy162 = yylhsminor.yy162;
2497 break;
2498 case 21: /* basetype ::= CLASSNAME */
2499 #line 599 "pikchr.y"
2500 {yylhsminor.yy162 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
2501 #line 2526 "pikchr.c"
2502 yymsp[0].minor.yy162 = yylhsminor.yy162;
2503 break;
2504 case 22: /* basetype ::= STRING textposition */
2505 #line 601 "pikchr.y"
2506 {yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy188; yylhsminor.yy162 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
2507 #line 2532 "pikchr.c"
2508 yymsp[-1].minor.yy162 = yylhsminor.yy162;
2509 break;
2510 case 23: /* basetype ::= LB savelist statement_list RB */
2511 #line 603 "pikchr.y"
2512 { p->list = yymsp[-2].minor.yy235; yymsp[-3].minor.yy162 = pik_elem_new(p,0,0,yymsp[-1].minor.yy235); if(yymsp[-3].minor.yy162) yymsp[-3].minor.yy162->errTok = yymsp[0].minor.yy0; }
2513 #line 2538 "pikchr.c"
2514 break;
2515 case 24: /* savelist ::= */
2516 #line 608 "pikchr.y"
2517 {yymsp[1].minor.yy235 = p->list; p->list = 0;}
2518 #line 2543 "pikchr.c"
2519 break;
2520 case 25: /* relexpr ::= expr */
2521 #line 615 "pikchr.y"
2522 {yylhsminor.yy72.rAbs = yymsp[0].minor.yy21; yylhsminor.yy72.rRel = 0;}
2523 #line 2548 "pikchr.c"
2524 yymsp[0].minor.yy72 = yylhsminor.yy72;
2525 break;
2526 case 26: /* relexpr ::= expr PERCENT */
2527 #line 616 "pikchr.y"
2528 {yylhsminor.yy72.rAbs = 0; yylhsminor.yy72.rRel = yymsp[-1].minor.yy21/100;}
2529 #line 2554 "pikchr.c"
2530 yymsp[-1].minor.yy72 = yylhsminor.yy72;
2531 break;
2532 case 27: /* optrelexpr ::= */
2533 #line 618 "pikchr.y"
2534 {yymsp[1].minor.yy72.rAbs = 0; yymsp[1].minor.yy72.rRel = 1.0;}
2535 #line 2560 "pikchr.c"
2536 break;
2537 case 28: /* attribute_list ::= relexpr alist */
2538 #line 620 "pikchr.y"
2539 {pik_add_direction(p,0,&yymsp[-1].minor.yy72);}
2540 #line 2565 "pikchr.c"
2541 break;
2542 case 29: /* attribute ::= numproperty relexpr */
2543 #line 624 "pikchr.y"
2544 { pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy72); }
2545 #line 2570 "pikchr.c"
2546 break;
2547 case 30: /* attribute ::= dashproperty expr */
2548 #line 625 "pikchr.y"
2549 { pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy21); }
2550 #line 2575 "pikchr.c"
2551 break;
2552 case 31: /* attribute ::= dashproperty */
2553 #line 626 "pikchr.y"
2554 { pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
2555 #line 2580 "pikchr.c"
2556 break;
2557 case 32: /* attribute ::= colorproperty rvalue */
2558 #line 627 "pikchr.y"
2559 { pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy21); }
2560 #line 2585 "pikchr.c"
2561 break;
2562 case 33: /* attribute ::= go direction optrelexpr */
2563 #line 628 "pikchr.y"
2564 { pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy72);}
2565 #line 2590 "pikchr.c"
2566 break;
2567 case 34: /* attribute ::= go direction even position */
2568 #line 629 "pikchr.y"
2569 {pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy63);}
2570 #line 2595 "pikchr.c"
2571 break;
2572 case 35: /* attribute ::= CLOSE */
2573 #line 630 "pikchr.y"
2574 { pik_close_path(p,&yymsp[0].minor.yy0); }
2575 #line 2600 "pikchr.c"
2576 break;
2577 case 36: /* attribute ::= CHOP */
2578 #line 631 "pikchr.y"
2579 { p->cur->bChop = 1; }
2580 #line 2605 "pikchr.c"
2581 break;
2582 case 37: /* attribute ::= FROM position */
2583 #line 632 "pikchr.y"
2584 { pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy63); }
2585 #line 2610 "pikchr.c"
2586 break;
2587 case 38: /* attribute ::= TO position */
2588 #line 633 "pikchr.y"
2589 { pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy63); }
2590 #line 2615 "pikchr.c"
2591 break;
2592 case 39: /* attribute ::= THEN */
2593 #line 634 "pikchr.y"
2594 { pik_then(p, &yymsp[0].minor.yy0, p->cur); }
2595 #line 2620 "pikchr.c"
2596 break;
2597 case 40: /* attribute ::= THEN optrelexpr HEADING expr */
2598 case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
2599 #line 636 "pikchr.y"
2600 {pik_move_hdg(p,&yymsp[-2].minor.yy72,&yymsp[-1].minor.yy0,yymsp[0].minor.yy21,0,&yymsp[-3].minor.yy0);}
2601 #line 2626 "pikchr.c"
2602 break;
2603 case 41: /* attribute ::= THEN optrelexpr EDGEPT */
2604 case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
2605 #line 637 "pikchr.y"
2606 {pik_move_hdg(p,&yymsp[-1].minor.yy72,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
2607 #line 2632 "pikchr.c"
2608 break;
2609 case 44: /* attribute ::= AT position */
2610 #line 642 "pikchr.y"
2611 { pik_set_at(p,0,&yymsp[0].minor.yy63,&yymsp[-1].minor.yy0); }
2612 #line 2637 "pikchr.c"
2613 break;
2614 case 45: /* attribute ::= SAME */
2615 #line 644 "pikchr.y"
2616 {pik_same(p,0,&yymsp[0].minor.yy0);}
2617 #line 2642 "pikchr.c"
2618 break;
2619 case 46: /* attribute ::= SAME AS object */
2620 #line 645 "pikchr.y"
2621 {pik_same(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0);}
2622 #line 2647 "pikchr.c"
2623 break;
2624 case 47: /* attribute ::= STRING textposition */
2625 #line 646 "pikchr.y"
2626 {pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy188);}
2627 #line 2652 "pikchr.c"
2628 break;
2629 case 48: /* attribute ::= FIT */
2630 #line 647 "pikchr.y"
2631 {pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
2632 #line 2657 "pikchr.c"
2633 break;
2634 case 49: /* attribute ::= BEHIND object */
2635 #line 648 "pikchr.y"
2636 {pik_behind(p,yymsp[0].minor.yy162);}
2637 #line 2662 "pikchr.c"
2638 break;
2639 case 50: /* withclause ::= DOT_E edge AT position */
2640 case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
2641 #line 656 "pikchr.y"
2642 { pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy63,&yymsp[-1].minor.yy0); }
2643 #line 2668 "pikchr.c"
2644 break;
2645 case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
2646 #line 660 "pikchr.y"
2647 {yylhsminor.yy0 = yymsp[0].minor.yy0;}
2648 #line 2673 "pikchr.c"
2649 yymsp[0].minor.yy0 = yylhsminor.yy0;
2650 break;
2651 case 53: /* boolproperty ::= CW */
2652 #line 671 "pikchr.y"
2653 {p->cur->cw = 1;}
2654 #line 2679 "pikchr.c"
2655 break;
2656 case 54: /* boolproperty ::= CCW */
2657 #line 672 "pikchr.y"
2658 {p->cur->cw = 0;}
2659 #line 2684 "pikchr.c"
2660 break;
2661 case 55: /* boolproperty ::= LARROW */
2662 #line 673 "pikchr.y"
2663 {p->cur->larrow=1; p->cur->rarrow=0; }
2664 #line 2689 "pikchr.c"
2665 break;
2666 case 56: /* boolproperty ::= RARROW */
2667 #line 674 "pikchr.y"
2668 {p->cur->larrow=0; p->cur->rarrow=1; }
2669 #line 2694 "pikchr.c"
2670 break;
2671 case 57: /* boolproperty ::= LRARROW */
2672 #line 675 "pikchr.y"
2673 {p->cur->larrow=1; p->cur->rarrow=1; }
2674 #line 2699 "pikchr.c"
2675 break;
2676 case 58: /* boolproperty ::= INVIS */
2677 #line 676 "pikchr.y"
2678 {p->cur->sw = 0.0;}
2679 #line 2704 "pikchr.c"
2680 break;
2681 case 59: /* boolproperty ::= THICK */
2682 #line 677 "pikchr.y"
2683 {p->cur->sw *= 1.5;}
2684 #line 2709 "pikchr.c"
2685 break;
2686 case 60: /* boolproperty ::= THIN */
2687 #line 678 "pikchr.y"
2688 {p->cur->sw *= 0.67;}
2689 #line 2714 "pikchr.c"
2690 break;
2691 case 61: /* boolproperty ::= SOLID */
2692 #line 679 "pikchr.y"
2693 {p->cur->sw = pik_value(p,"thickness",9,0);
2694 p->cur->dotted = p->cur->dashed = 0.0;}
2695 #line 2720 "pikchr.c"
2696 break;
2697 case 62: /* textposition ::= */
2698 #line 682 "pikchr.y"
2699 {yymsp[1].minor.yy188 = 0;}
2700 #line 2725 "pikchr.c"
2701 break;
2702 case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|MONO|ALIGNED|BIG|SMALL */
2703 #line 685 "pikchr.y"
2704 {yylhsminor.yy188 = (short int)pik_text_position(yymsp[-1].minor.yy188,&yymsp[0].minor.yy0);}
2705 #line 2730 "pikchr.c"
2706 yymsp[-1].minor.yy188 = yylhsminor.yy188;
2707 break;
2708 case 64: /* position ::= expr COMMA expr */
2709 #line 688 "pikchr.y"
2710 {yylhsminor.yy63.x=yymsp[-2].minor.yy21; yylhsminor.yy63.y=yymsp[0].minor.yy21;}
2711 #line 2736 "pikchr.c"
2712 yymsp[-2].minor.yy63 = yylhsminor.yy63;
2713 break;
2714 case 65: /* position ::= place PLUS expr COMMA expr */
2715 #line 690 "pikchr.y"
2716 {yylhsminor.yy63.x=yymsp[-4].minor.yy63.x+yymsp[-2].minor.yy21; yylhsminor.yy63.y=yymsp[-4].minor.yy63.y+yymsp[0].minor.yy21;}
2717 #line 2742 "pikchr.c"
2718 yymsp[-4].minor.yy63 = yylhsminor.yy63;
2719 break;
2720 case 66: /* position ::= place MINUS expr COMMA expr */
2721 #line 691 "pikchr.y"
2722 {yylhsminor.yy63.x=yymsp[-4].minor.yy63.x-yymsp[-2].minor.yy21; yylhsminor.yy63.y=yymsp[-4].minor.yy63.y-yymsp[0].minor.yy21;}
2723 #line 2748 "pikchr.c"
2724 yymsp[-4].minor.yy63 = yylhsminor.yy63;
2725 break;
2726 case 67: /* position ::= place PLUS LP expr COMMA expr RP */
2727 #line 693 "pikchr.y"
2728 {yylhsminor.yy63.x=yymsp[-6].minor.yy63.x+yymsp[-3].minor.yy21; yylhsminor.yy63.y=yymsp[-6].minor.yy63.y+yymsp[-1].minor.yy21;}
2729 #line 2754 "pikchr.c"
2730 yymsp[-6].minor.yy63 = yylhsminor.yy63;
2731 break;
2732 case 68: /* position ::= place MINUS LP expr COMMA expr RP */
2733 #line 695 "pikchr.y"
2734 {yylhsminor.yy63.x=yymsp[-6].minor.yy63.x-yymsp[-3].minor.yy21; yylhsminor.yy63.y=yymsp[-6].minor.yy63.y-yymsp[-1].minor.yy21;}
2735 #line 2760 "pikchr.c"
2736 yymsp[-6].minor.yy63 = yylhsminor.yy63;
2737 break;
2738 case 69: /* position ::= LP position COMMA position RP */
2739 #line 696 "pikchr.y"
2740 {yymsp[-4].minor.yy63.x=yymsp[-3].minor.yy63.x; yymsp[-4].minor.yy63.y=yymsp[-1].minor.yy63.y;}
2741 #line 2766 "pikchr.c"
2742 break;
2743 case 70: /* position ::= LP position RP */
2744 #line 697 "pikchr.y"
2745 {yymsp[-2].minor.yy63=yymsp[-1].minor.yy63;}
2746 #line 2771 "pikchr.c"
2747 break;
2748 case 71: /* position ::= expr between position AND position */
2749 #line 699 "pikchr.y"
2750 {yylhsminor.yy63 = pik_position_between(yymsp[-4].minor.yy21,yymsp[-2].minor.yy63,yymsp[0].minor.yy63);}
2751 #line 2776 "pikchr.c"
2752 yymsp[-4].minor.yy63 = yylhsminor.yy63;
2753 break;
2754 case 72: /* position ::= expr LT position COMMA position GT */
2755 #line 701 "pikchr.y"
2756 {yylhsminor.yy63 = pik_position_between(yymsp[-5].minor.yy21,yymsp[-3].minor.yy63,yymsp[-1].minor.yy63);}
2757 #line 2782 "pikchr.c"
2758 yymsp[-5].minor.yy63 = yylhsminor.yy63;
2759 break;
2760 case 73: /* position ::= expr ABOVE position */
2761 #line 702 "pikchr.y"
2762 {yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.y += yymsp[-2].minor.yy21;}
2763 #line 2788 "pikchr.c"
2764 yymsp[-2].minor.yy63 = yylhsminor.yy63;
2765 break;
2766 case 74: /* position ::= expr BELOW position */
2767 #line 703 "pikchr.y"
2768 {yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.y -= yymsp[-2].minor.yy21;}
2769 #line 2794 "pikchr.c"
2770 yymsp[-2].minor.yy63 = yylhsminor.yy63;
2771 break;
2772 case 75: /* position ::= expr LEFT OF position */
2773 #line 704 "pikchr.y"
2774 {yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.x -= yymsp[-3].minor.yy21;}
2775 #line 2800 "pikchr.c"
2776 yymsp[-3].minor.yy63 = yylhsminor.yy63;
2777 break;
2778 case 76: /* position ::= expr RIGHT OF position */
2779 #line 705 "pikchr.y"
2780 {yylhsminor.yy63=yymsp[0].minor.yy63; yylhsminor.yy63.x += yymsp[-3].minor.yy21;}
2781 #line 2806 "pikchr.c"
2782 yymsp[-3].minor.yy63 = yylhsminor.yy63;
2783 break;
2784 case 77: /* position ::= expr ON HEADING EDGEPT OF position */
2785 #line 707 "pikchr.y"
2786 {yylhsminor.yy63 = pik_position_at_hdg(yymsp[-5].minor.yy21,&yymsp[-2].minor.yy0,yymsp[0].minor.yy63);}
2787 #line 2812 "pikchr.c"
2788 yymsp[-5].minor.yy63 = yylhsminor.yy63;
2789 break;
2790 case 78: /* position ::= expr HEADING EDGEPT OF position */
2791 #line 709 "pikchr.y"
2792 {yylhsminor.yy63 = pik_position_at_hdg(yymsp[-4].minor.yy21,&yymsp[-2].minor.yy0,yymsp[0].minor.yy63);}
2793 #line 2818 "pikchr.c"
2794 yymsp[-4].minor.yy63 = yylhsminor.yy63;
2795 break;
2796 case 79: /* position ::= expr EDGEPT OF position */
2797 #line 711 "pikchr.y"
2798 {yylhsminor.yy63 = pik_position_at_hdg(yymsp[-3].minor.yy21,&yymsp[-2].minor.yy0,yymsp[0].minor.yy63);}
2799 #line 2824 "pikchr.c"
2800 yymsp[-3].minor.yy63 = yylhsminor.yy63;
2801 break;
2802 case 80: /* position ::= expr ON HEADING expr FROM position */
2803 #line 713 "pikchr.y"
2804 {yylhsminor.yy63 = pik_position_at_angle(yymsp[-5].minor.yy21,yymsp[-2].minor.yy21,yymsp[0].minor.yy63);}
2805 #line 2830 "pikchr.c"
2806 yymsp[-5].minor.yy63 = yylhsminor.yy63;
2807 break;
2808 case 81: /* position ::= expr HEADING expr FROM position */
2809 #line 715 "pikchr.y"
2810 {yylhsminor.yy63 = pik_position_at_angle(yymsp[-4].minor.yy21,yymsp[-2].minor.yy21,yymsp[0].minor.yy63);}
2811 #line 2836 "pikchr.c"
2812 yymsp[-4].minor.yy63 = yylhsminor.yy63;
2813 break;
2814 case 82: /* place ::= edge OF object */
2815 #line 727 "pikchr.y"
2816 {yylhsminor.yy63 = pik_place_of_elem(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0);}
2817 #line 2842 "pikchr.c"
2818 yymsp[-2].minor.yy63 = yylhsminor.yy63;
2819 break;
2820 case 83: /* place2 ::= object */
2821 #line 728 "pikchr.y"
2822 {yylhsminor.yy63 = pik_place_of_elem(p,yymsp[0].minor.yy162,0);}
2823 #line 2848 "pikchr.c"
2824 yymsp[0].minor.yy63 = yylhsminor.yy63;
2825 break;
2826 case 84: /* place2 ::= object DOT_E edge */
2827 #line 729 "pikchr.y"
2828 {yylhsminor.yy63 = pik_place_of_elem(p,yymsp[-2].minor.yy162,&yymsp[0].minor.yy0);}
2829 #line 2854 "pikchr.c"
2830 yymsp[-2].minor.yy63 = yylhsminor.yy63;
2831 break;
2832 case 85: /* place2 ::= NTH VERTEX OF object */
2833 #line 730 "pikchr.y"
2834 {yylhsminor.yy63 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy162);}
2835 #line 2860 "pikchr.c"
2836 yymsp[-3].minor.yy63 = yylhsminor.yy63;
2837 break;
2838 case 86: /* object ::= nth */
2839 #line 742 "pikchr.y"
2840 {yylhsminor.yy162 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
2841 #line 2866 "pikchr.c"
2842 yymsp[0].minor.yy162 = yylhsminor.yy162;
2843 break;
2844 case 87: /* object ::= nth OF|IN object */
2845 #line 743 "pikchr.y"
2846 {yylhsminor.yy162 = pik_find_nth(p,yymsp[0].minor.yy162,&yymsp[-2].minor.yy0);}
2847 #line 2872 "pikchr.c"
2848 yymsp[-2].minor.yy162 = yylhsminor.yy162;
2849 break;
2850 case 88: /* objectname ::= THIS */
2851 #line 745 "pikchr.y"
2852 {yymsp[0].minor.yy162 = p->cur;}
2853 #line 2878 "pikchr.c"
2854 break;
2855 case 89: /* objectname ::= PLACENAME */
2856 #line 746 "pikchr.y"
2857 {yylhsminor.yy162 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
2858 #line 2883 "pikchr.c"
2859 yymsp[0].minor.yy162 = yylhsminor.yy162;
2860 break;
2861 case 90: /* objectname ::= objectname DOT_U PLACENAME */
2862 #line 748 "pikchr.y"
2863 {yylhsminor.yy162 = pik_find_byname(p,yymsp[-2].minor.yy162,&yymsp[0].minor.yy0);}
2864 #line 2889 "pikchr.c"
2865 yymsp[-2].minor.yy162 = yylhsminor.yy162;
2866 break;
2867 case 91: /* nth ::= NTH CLASSNAME */
2868 #line 750 "pikchr.y"
2869 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
2870 #line 2895 "pikchr.c"
2871 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2872 break;
2873 case 92: /* nth ::= NTH LAST CLASSNAME */
2874 #line 751 "pikchr.y"
2875 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
2876 #line 2901 "pikchr.c"
2877 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2878 break;
2879 case 93: /* nth ::= LAST CLASSNAME */
2880 #line 752 "pikchr.y"
2881 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
2882 #line 2907 "pikchr.c"
2883 break;
2884 case 94: /* nth ::= LAST */
2885 #line 753 "pikchr.y"
2886 {yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
2887 #line 2912 "pikchr.c"
2888 yymsp[0].minor.yy0 = yylhsminor.yy0;
2889 break;
2890 case 95: /* nth ::= NTH LB RB */
2891 #line 754 "pikchr.y"
2892 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
2893 #line 2918 "pikchr.c"
2894 yymsp[-2].minor.yy0 = yylhsminor.yy0;
2895 break;
2896 case 96: /* nth ::= NTH LAST LB RB */
2897 #line 755 "pikchr.y"
2898 {yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
2899 #line 2924 "pikchr.c"
2900 yymsp[-3].minor.yy0 = yylhsminor.yy0;
2901 break;
2902 case 97: /* nth ::= LAST LB RB */
2903 #line 756 "pikchr.y"
2904 {yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
2905 #line 2930 "pikchr.c"
2906 break;
2907 case 98: /* expr ::= expr PLUS expr */
2908 #line 758 "pikchr.y"
2909 {yylhsminor.yy21=yymsp[-2].minor.yy21+yymsp[0].minor.yy21;}
2910 #line 2935 "pikchr.c"
2911 yymsp[-2].minor.yy21 = yylhsminor.yy21;
2912 break;
2913 case 99: /* expr ::= expr MINUS expr */
2914 #line 759 "pikchr.y"
2915 {yylhsminor.yy21=yymsp[-2].minor.yy21-yymsp[0].minor.yy21;}
2916 #line 2941 "pikchr.c"
2917 yymsp[-2].minor.yy21 = yylhsminor.yy21;
2918 break;
2919 case 100: /* expr ::= expr STAR expr */
2920 #line 760 "pikchr.y"
2921 {yylhsminor.yy21=yymsp[-2].minor.yy21*yymsp[0].minor.yy21;}
2922 #line 2947 "pikchr.c"
2923 yymsp[-2].minor.yy21 = yylhsminor.yy21;
2924 break;
2925 case 101: /* expr ::= expr SLASH expr */
2926 #line 761 "pikchr.y"
2927 {
2928 if( yymsp[0].minor.yy21==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy21 = 0.0; }
2929 else{ yylhsminor.yy21 = yymsp[-2].minor.yy21/yymsp[0].minor.yy21; }
2930 }
2931 #line 2956 "pikchr.c"
2932 yymsp[-2].minor.yy21 = yylhsminor.yy21;
2933 break;
2934 case 102: /* expr ::= MINUS expr */
2935 #line 765 "pikchr.y"
2936 {yymsp[-1].minor.yy21=-yymsp[0].minor.yy21;}
2937 #line 2962 "pikchr.c"
2938 break;
2939 case 103: /* expr ::= PLUS expr */
2940 #line 766 "pikchr.y"
2941 {yymsp[-1].minor.yy21=yymsp[0].minor.yy21;}
2942 #line 2967 "pikchr.c"
2943 break;
2944 case 104: /* expr ::= LP expr RP */
2945 #line 767 "pikchr.y"
2946 {yymsp[-2].minor.yy21=yymsp[-1].minor.yy21;}
2947 #line 2972 "pikchr.c"
2948 break;
2949 case 105: /* expr ::= LP FILL|COLOR|THICKNESS RP */
2950 #line 768 "pikchr.y"
2951 {yymsp[-2].minor.yy21=pik_get_var(p,&yymsp[-1].minor.yy0);}
2952 #line 2977 "pikchr.c"
2953 break;
2954 case 106: /* expr ::= NUMBER */
2955 #line 769 "pikchr.y"
2956 {yylhsminor.yy21=pik_atof(&yymsp[0].minor.yy0);}
2957 #line 2982 "pikchr.c"
2958 yymsp[0].minor.yy21 = yylhsminor.yy21;
2959 break;
2960 case 107: /* expr ::= ID */
2961 #line 770 "pikchr.y"
2962 {yylhsminor.yy21=pik_get_var(p,&yymsp[0].minor.yy0);}
2963 #line 2988 "pikchr.c"
2964 yymsp[0].minor.yy21 = yylhsminor.yy21;
2965 break;
2966 case 108: /* expr ::= FUNC1 LP expr RP */
2967 #line 771 "pikchr.y"
2968 {yylhsminor.yy21 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy21,0.0);}
2969 #line 2994 "pikchr.c"
2970 yymsp[-3].minor.yy21 = yylhsminor.yy21;
2971 break;
2972 case 109: /* expr ::= FUNC2 LP expr COMMA expr RP */
2973 #line 772 "pikchr.y"
2974 {yylhsminor.yy21 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy21,yymsp[-1].minor.yy21);}
2975 #line 3000 "pikchr.c"
2976 yymsp[-5].minor.yy21 = yylhsminor.yy21;
2977 break;
2978 case 110: /* expr ::= DIST LP position COMMA position RP */
2979 #line 773 "pikchr.y"
2980 {yymsp[-5].minor.yy21 = pik_dist(&yymsp[-3].minor.yy63,&yymsp[-1].minor.yy63);}
2981 #line 3006 "pikchr.c"
2982 break;
2983 case 111: /* expr ::= place2 DOT_XY X */
2984 #line 774 "pikchr.y"
2985 {yylhsminor.yy21 = yymsp[-2].minor.yy63.x;}
2986 #line 3011 "pikchr.c"
2987 yymsp[-2].minor.yy21 = yylhsminor.yy21;
2988 break;
2989 case 112: /* expr ::= place2 DOT_XY Y */
2990 #line 775 "pikchr.y"
2991 {yylhsminor.yy21 = yymsp[-2].minor.yy63.y;}
2992 #line 3017 "pikchr.c"
2993 yymsp[-2].minor.yy21 = yylhsminor.yy21;
2994 break;
2995 case 113: /* expr ::= object DOT_L numproperty */
2996 case 114: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==114);
2997 case 115: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==115);
2998 #line 776 "pikchr.y"
2999 {yylhsminor.yy21=pik_property_of(yymsp[-2].minor.yy162,&yymsp[0].minor.yy0);}
3000 #line 3025 "pikchr.c"
3001 yymsp[-2].minor.yy21 = yylhsminor.yy21;
3002 break;
3003 default:
3004 /* (116) lvalue ::= ID */ yytestcase(yyruleno==116);
3005 /* (117) lvalue ::= FILL */ yytestcase(yyruleno==117);
3006 /* (118) lvalue ::= COLOR */ yytestcase(yyruleno==118);
@@ -3092,19 +3098,19 @@
3098 ){
3099 pik_parserARG_FETCH
3100 pik_parserCTX_FETCH
3101 #define TOKEN yyminor
3102 /************ Begin %syntax_error code ****************************************/
3103 #line 536 "pikchr.y"
3104
3105 if( TOKEN.z && TOKEN.z[0] ){
3106 pik_error(p, &TOKEN, "syntax error");
3107 }else{
3108 pik_error(p, 0, "syntax error");
3109 }
3110 UNUSED_PARAMETER(yymajor);
3111 #line 3136 "pikchr.c"
3112 /************ End %syntax_error code ******************************************/
3113 pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
3114 pik_parserCTX_STORE
3115 }
3116
@@ -3376,11 +3382,11 @@
3382 #else
3383 (void)iToken;
3384 return 0;
3385 #endif
3386 }
3387 #line 781 "pikchr.y"
3388
3389
3390
3391 /* Chart of the 148 official CSS color names with their
3392 ** corresponding RGB values thru Color Module Level 4:
@@ -4978,14 +4984,16 @@
4984 if( t->eCode & TP_RJUST ) nx += jw;
4985
4986 if( pBox!=0 ){
4987 /* If pBox is not NULL, do not draw any <text>. Instead, just expand
4988 ** pBox to include the text */
4989 PNum cw = pik_text_length(t, t->eCode & TP_MONO)*p->charWidth*xtraFontScale*0.01;
4990 PNum ch = p->charHeight*0.5*xtraFontScale;
4991 PNum x0, y0, x1, y1; /* Boundary of text relative to pObj->ptAt */
4992 if( (t->eCode & (TP_BOLD|TP_MONO))==TP_BOLD ){
4993 cw *= 1.1;
4994 }
4995 if( t->eCode & TP_RJUST ){
4996 x0 = nx;
4997 y0 = y-ch;
4998 x1 = nx-cw;
4999 y1 = y+ch;
@@ -5037,10 +5045,13 @@
5045 pik_append(p, " font-style=\"italic\"", -1);
5046 }
5047 if( t->eCode & TP_BOLD ){
5048 pik_append(p, " font-weight=\"bold\"", -1);
5049 }
5050 if( t->eCode & TP_MONO ){
5051 pik_append(p, " font-family=\"monospace\"", -1);
5052 }
5053 if( pObj->color>=0.0 ){
5054 pik_append_clr(p, " fill=\"", pObj->color, "\"",0);
5055 }
5056 xtraFontScale *= p->fontScale;
5057 if( xtraFontScale<=0.99 || xtraFontScale>=1.01 ){
@@ -6044,12 +6055,13 @@
6055 case T_LJUST: iRes = (iRes&~TP_JMASK) | TP_LJUST; break;
6056 case T_RJUST: iRes = (iRes&~TP_JMASK) | TP_RJUST; break;
6057 case T_ABOVE: iRes = (iRes&~TP_VMASK) | TP_ABOVE; break;
6058 case T_CENTER: iRes = (iRes&~TP_VMASK) | TP_CENTER; break;
6059 case T_BELOW: iRes = (iRes&~TP_VMASK) | TP_BELOW; break;
6060 case T_ITALIC: iRes |= TP_ITALIC; break;
6061 case T_BOLD: iRes |= TP_BOLD; break;
6062 case T_MONO: iRes |= TP_MONO; break;
6063 case T_ALIGNED: iRes |= TP_ALIGN; break;
6064 case T_BIG: if( iRes & TP_BIG ) iRes |= TP_XTRA;
6065 else iRes = (iRes &~TP_SZMASK)|TP_BIG; break;
6066 case T_SMALL: if( iRes & TP_SMALL ) iRes |= TP_XTRA;
6067 else iRes = (iRes &~TP_SZMASK)|TP_SMALL; break;
@@ -6180,15 +6192,17 @@
6192 **
6193 ** Omit "\" used to escape characters. And count entities like
6194 ** "&lt;" as a single character. Multi-byte UTF8 characters count
6195 ** as a single character.
6196 **
6197 ** Unless using a monospaced font, attempt to scale the answer by
6198 ** the actual characters seen. Wide characters count more than
6199 ** narrow characters. But the widths are only guesses.
6200 **
6201 */
6202 static int pik_text_length(const PToken *pToken, const int isMonospace){
6203 const int stdAvg=100, monoAvg=82;
6204 int n = pToken->n;
6205 const char *z = pToken->z;
6206 int cnt, j;
6207 for(j=1, cnt=0; j<n-1; j++){
6208 char c = z[j];
@@ -6196,22 +6210,24 @@
6210 c = z[++j];
6211 }else if( c=='&' ){
6212 int k;
6213 for(k=j+1; k<j+7 && z[k]!=0 && z[k]!=';'; k++){}
6214 if( z[k]==';' ) j = k;
6215 cnt += (isMonospace ? monoAvg : stdAvg) * 3 / 2;
6216 continue;
6217 }
6218 if( (c & 0xc0)==0xc0 ){
6219 while( j+1<n-1 && (z[j+1]&0xc0)==0x80 ){ j++; }
6220 cnt += isMonospace ? monoAvg : stdAvg;
6221 continue;
6222 }
6223 if( isMonospace ){
6224 cnt += monoAvg;
6225 }else if( c >= 0x20 && c <= 0x7e ){
6226 cnt += awChar[c-0x20];
6227 }else{
6228 cnt += stdAvg;
6229 }
6230 }
6231 return cnt;
6232 }
6233
@@ -7195,10 +7211,12 @@
7211 { "last", 4, T_LAST, 0, 0 },
7212 { "left", 4, T_LEFT, DIR_LEFT, CP_W },
7213 { "ljust", 5, T_LJUST, 0, 0 },
7214 { "max", 3, T_FUNC2, FN_MAX, 0 },
7215 { "min", 3, T_FUNC2, FN_MIN, 0 },
7216 { "mono", 4, T_MONO, 0, 0 },
7217 { "monospace", 9, T_MONO, 0, 0 },
7218 { "n", 1, T_EDGEPT, 0, CP_N },
7219 { "ne", 2, T_EDGEPT, 0, CP_NE },
7220 { "north", 5, T_EDGEPT, 0, CP_N },
7221 { "nw", 2, T_EDGEPT, 0, CP_NW },
7222 { "of", 2, T_OF, 0, 0 },
@@ -8122,6 +8140,6 @@
8140
8141
8142 #endif /* PIKCHR_TCL */
8143
8144
8145 #line 8170 "pikchr.c"
8146
+17 -15
--- extsrc/pikchr.js
+++ extsrc/pikchr.js
@@ -1,12 +1,12 @@
11
22
var initPikchrModule = (() => {
33
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
44
55
return (
6
-function(initPikchrModule) {
7
- initPikchrModule = initPikchrModule || {};
6
+function(config) {
7
+ var initPikchrModule = config || {};
88
99
var Module = typeof initPikchrModule != "undefined" ? initPikchrModule : {};
1010
1111
var readyPromiseResolve, readyPromiseReject;
1212
@@ -195,22 +195,22 @@
195195
196196
function stringToUTF8(str, outPtr, maxBytesToWrite) {
197197
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
198198
}
199199
200
-var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
201
-
202
-function updateGlobalBufferAndViews(buf) {
203
- buffer = buf;
204
- Module["HEAP8"] = HEAP8 = new Int8Array(buf);
205
- Module["HEAP16"] = HEAP16 = new Int16Array(buf);
206
- Module["HEAP32"] = HEAP32 = new Int32Array(buf);
207
- Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
208
- Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);
209
- Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
210
- Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);
211
- Module["HEAPF64"] = HEAPF64 = new Float64Array(buf);
200
+var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
201
+
202
+function updateMemoryViews() {
203
+ var b = wasmMemory.buffer;
204
+ Module["HEAP8"] = HEAP8 = new Int8Array(b);
205
+ Module["HEAP16"] = HEAP16 = new Int16Array(b);
206
+ Module["HEAP32"] = HEAP32 = new Int32Array(b);
207
+ Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
208
+ Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
209
+ Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
210
+ Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
211
+ Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
212212
}
213213
214214
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
215215
216216
var wasmTable;
@@ -363,11 +363,11 @@
363363
};
364364
function receiveInstance(instance, module) {
365365
var exports = instance.exports;
366366
Module["asm"] = exports;
367367
wasmMemory = Module["asm"]["d"];
368
- updateGlobalBufferAndViews(wasmMemory.buffer);
368
+ updateMemoryViews();
369369
wasmTable = Module["asm"]["g"];
370370
addOnInit(Module["asm"]["e"]);
371371
removeRunDependency("wasm-instantiate");
372372
}
373373
addRunDependency("wasm-instantiate");
@@ -639,10 +639,12 @@
639639
};
640640
641641
var stackAlloc = Module["stackAlloc"] = function() {
642642
return (stackAlloc = Module["stackAlloc"] = Module["asm"]["j"]).apply(null, arguments);
643643
};
644
+
645
+Module["stackAlloc"] = stackAlloc;
644646
645647
Module["stackSave"] = stackSave;
646648
647649
Module["stackRestore"] = stackRestore;
648650
649651
--- extsrc/pikchr.js
+++ extsrc/pikchr.js
@@ -1,12 +1,12 @@
1
2 var initPikchrModule = (() => {
3 var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
4
5 return (
6 function(initPikchrModule) {
7 initPikchrModule = initPikchrModule || {};
8
9 var Module = typeof initPikchrModule != "undefined" ? initPikchrModule : {};
10
11 var readyPromiseResolve, readyPromiseReject;
12
@@ -195,22 +195,22 @@
195
196 function stringToUTF8(str, outPtr, maxBytesToWrite) {
197 return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
198 }
199
200 var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
201
202 function updateGlobalBufferAndViews(buf) {
203 buffer = buf;
204 Module["HEAP8"] = HEAP8 = new Int8Array(buf);
205 Module["HEAP16"] = HEAP16 = new Int16Array(buf);
206 Module["HEAP32"] = HEAP32 = new Int32Array(buf);
207 Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
208 Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);
209 Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
210 Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);
211 Module["HEAPF64"] = HEAPF64 = new Float64Array(buf);
212 }
213
214 var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
215
216 var wasmTable;
@@ -363,11 +363,11 @@
363 };
364 function receiveInstance(instance, module) {
365 var exports = instance.exports;
366 Module["asm"] = exports;
367 wasmMemory = Module["asm"]["d"];
368 updateGlobalBufferAndViews(wasmMemory.buffer);
369 wasmTable = Module["asm"]["g"];
370 addOnInit(Module["asm"]["e"]);
371 removeRunDependency("wasm-instantiate");
372 }
373 addRunDependency("wasm-instantiate");
@@ -639,10 +639,12 @@
639 };
640
641 var stackAlloc = Module["stackAlloc"] = function() {
642 return (stackAlloc = Module["stackAlloc"] = Module["asm"]["j"]).apply(null, arguments);
643 };
 
 
644
645 Module["stackSave"] = stackSave;
646
647 Module["stackRestore"] = stackRestore;
648
649
--- extsrc/pikchr.js
+++ extsrc/pikchr.js
@@ -1,12 +1,12 @@
1
2 var initPikchrModule = (() => {
3 var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
4
5 return (
6 function(config) {
7 var initPikchrModule = config || {};
8
9 var Module = typeof initPikchrModule != "undefined" ? initPikchrModule : {};
10
11 var readyPromiseResolve, readyPromiseReject;
12
@@ -195,22 +195,22 @@
195
196 function stringToUTF8(str, outPtr, maxBytesToWrite) {
197 return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
198 }
199
200 var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
201
202 function updateMemoryViews() {
203 var b = wasmMemory.buffer;
204 Module["HEAP8"] = HEAP8 = new Int8Array(b);
205 Module["HEAP16"] = HEAP16 = new Int16Array(b);
206 Module["HEAP32"] = HEAP32 = new Int32Array(b);
207 Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
208 Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
209 Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
210 Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
211 Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
212 }
213
214 var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
215
216 var wasmTable;
@@ -363,11 +363,11 @@
363 };
364 function receiveInstance(instance, module) {
365 var exports = instance.exports;
366 Module["asm"] = exports;
367 wasmMemory = Module["asm"]["d"];
368 updateMemoryViews();
369 wasmTable = Module["asm"]["g"];
370 addOnInit(Module["asm"]["e"]);
371 removeRunDependency("wasm-instantiate");
372 }
373 addRunDependency("wasm-instantiate");
@@ -639,10 +639,12 @@
639 };
640
641 var stackAlloc = Module["stackAlloc"] = function() {
642 return (stackAlloc = Module["stackAlloc"] = Module["asm"]["j"]).apply(null, arguments);
643 };
644
645 Module["stackAlloc"] = stackAlloc;
646
647 Module["stackSave"] = stackSave;
648
649 Module["stackRestore"] = stackRestore;
650
651
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
cannot compute difference between binary files
11
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
0 annot compute difference between binary files
1
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
0 annot compute difference between binary files
1
+594 -151
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -244,10 +244,11 @@
244244
245245
#if defined(_WIN32) || defined(WIN32)
246246
#if SQLITE_OS_WINRT
247247
#include <intrin.h>
248248
#endif
249
+#define WIN32_LEAN_AND_MEAN
249250
#include <windows.h>
250251
251252
/* string conversion routines only needed on Win32 */
252253
extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
253254
extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
@@ -458,14 +459,28 @@
458459
** at an error if we are not interactive.
459460
*/
460461
static int bail_on_error = 0;
461462
462463
/*
463
-** Threat stdin as an interactive input if the following variable
464
+** Treat stdin as an interactive input if the following variable
464465
** is true. Otherwise, assume stdin is connected to a file or pipe.
465466
*/
466467
static int stdin_is_interactive = 1;
468
+
469
+#if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \
470
+ && !defined(SHELL_OMIT_WIN_UTF8)
471
+# define SHELL_WIN_UTF8_OPT 1
472
+#else
473
+# define SHELL_WIN_UTF8_OPT 0
474
+#endif
475
+
476
+#if SHELL_WIN_UTF8_OPT
477
+/*
478
+** Setup console for UTF-8 input/output when following variable true.
479
+*/
480
+static int console_utf8 = 0;
481
+#endif
467482
468483
/*
469484
** On Windows systems we have to know if standard output is a console
470485
** in order to translate UTF-8 into MBCS. The following variable is
471486
** true if translation is required.
@@ -595,20 +610,154 @@
595610
}
596611
return dynPrompt.dynamicPrompt;
597612
}
598613
#endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */
599614
615
+#if SHELL_WIN_UTF8_OPT
616
+/* Following struct is used for -utf8 operation. */
617
+static struct ConsoleState {
618
+ int stdinEof; /* EOF has been seen on console input */
619
+ int infsMode; /* Input file stream mode upon shell start */
620
+ UINT inCodePage; /* Input code page upon shell start */
621
+ UINT outCodePage; /* Output code page upon shell start */
622
+ HANDLE hConsoleIn; /* Console input handle */
623
+ DWORD consoleMode; /* Console mode upon shell start */
624
+} conState = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
625
+
626
+#ifndef _O_U16TEXT /* For build environments lacking this constant: */
627
+# define _O_U16TEXT 0x20000
628
+#endif
629
+
630
+/*
631
+** Prepare console, (if known to be a WIN32 console), for UTF-8
632
+** input (from either typing or suitable paste operations) and for
633
+** UTF-8 rendering. This may "fail" with a message to stderr, where
634
+** the preparation is not done and common "code page" issues occur.
635
+*/
636
+static void console_prepare(void){
637
+ HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE);
638
+ DWORD consoleMode = 0;
639
+ if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR
640
+ && GetConsoleMode( hCI, &consoleMode) ){
641
+ if( !IsValidCodePage(CP_UTF8) ){
642
+ fprintf(stderr, "Cannot use UTF-8 code page.\n");
643
+ console_utf8 = 0;
644
+ return;
645
+ }
646
+ conState.hConsoleIn = hCI;
647
+ conState.consoleMode = consoleMode;
648
+ conState.inCodePage = GetConsoleCP();
649
+ conState.outCodePage = GetConsoleOutputCP();
650
+ SetConsoleCP(CP_UTF8);
651
+ SetConsoleOutputCP(CP_UTF8);
652
+ consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
653
+ SetConsoleMode(conState.hConsoleIn, consoleMode);
654
+ conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT);
655
+ console_utf8 = 1;
656
+ }else{
657
+ console_utf8 = 0;
658
+ }
659
+}
660
+
661
+/*
662
+** Undo the effects of console_prepare(), if any.
663
+*/
664
+static void SQLITE_CDECL console_restore(void){
665
+ if( console_utf8 && conState.inCodePage!=0
666
+ && conState.hConsoleIn!=INVALID_HANDLE_VALUE ){
667
+ _setmode(_fileno(stdin), conState.infsMode);
668
+ SetConsoleCP(conState.inCodePage);
669
+ SetConsoleOutputCP(conState.outCodePage);
670
+ SetConsoleMode(conState.hConsoleIn, conState.consoleMode);
671
+ /* Avoid multiple calls. */
672
+ conState.hConsoleIn = INVALID_HANDLE_VALUE;
673
+ conState.consoleMode = 0;
674
+ console_utf8 = 0;
675
+ }
676
+}
677
+
678
+/*
679
+** Collect input like fgets(...) with special provisions for input
680
+** from the Windows console to get around its strange coding issues.
681
+** Defers to plain fgets() when input is not interactive or when the
682
+** startup option, -utf8, has not been provided or taken effect.
683
+*/
684
+static char* utf8_fgets(char *buf, int ncmax, FILE *fin){
685
+ if( fin==0 ) fin = stdin;
686
+ if( fin==stdin && stdin_is_interactive && console_utf8 ){
687
+# define SQLITE_IALIM 150
688
+ wchar_t wbuf[SQLITE_IALIM];
689
+ int lend = 0;
690
+ int noc = 0;
691
+ if( ncmax==0 || conState.stdinEof ) return 0;
692
+ buf[0] = 0;
693
+ while( noc<ncmax-7-1 && !lend ){
694
+ /* There is room for at least 2 more characters and a 0-terminator. */
695
+ int na = (ncmax > SQLITE_IALIM*4+1 + noc)
696
+ ? SQLITE_IALIM : (ncmax-1 - noc)/4;
697
+# undef SQLITE_IALIM
698
+ DWORD nbr = 0;
699
+ BOOL bRC = ReadConsoleW(conState.hConsoleIn, wbuf, na, &nbr, 0);
700
+ if( !bRC || (noc==0 && nbr==0) ) return 0;
701
+ if( nbr > 0 ){
702
+ int nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR,
703
+ wbuf,nbr,0,0,0,0);
704
+ if( nmb !=0 && noc+nmb <= ncmax ){
705
+ int iseg = noc;
706
+ nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR,
707
+ wbuf,nbr,buf+noc,nmb,0,0);
708
+ noc += nmb;
709
+ /* Fixup line-ends as coded by Windows for CR (or "Enter".)*/
710
+ if( noc > 0 ){
711
+ if( buf[noc-1]=='\n' ){
712
+ lend = 1;
713
+ if( noc > 1 && buf[noc-2]=='\r' ){
714
+ buf[noc-2] = '\n';
715
+ --noc;
716
+ }
717
+ }
718
+ }
719
+ /* Check for ^Z (anywhere in line) too. */
720
+ while( iseg < noc ){
721
+ if( buf[iseg]==0x1a ){
722
+ conState.stdinEof = 1;
723
+ noc = iseg; /* Chop ^Z and anything following. */
724
+ break;
725
+ }
726
+ ++iseg;
727
+ }
728
+ }else break; /* Drop apparent garbage in. (Could assert.) */
729
+ }else break;
730
+ }
731
+ /* If got nothing, (after ^Z chop), must be at end-of-file. */
732
+ if( noc == 0 ) return 0;
733
+ buf[noc] = 0;
734
+ return buf;
735
+ }else{
736
+ return fgets(buf, ncmax, fin);
737
+ }
738
+}
739
+
740
+# define fgets(b,n,f) utf8_fgets(b,n,f)
741
+#endif /* SHELL_WIN_UTF8_OPT */
742
+
600743
/*
601744
** Render output like fprintf(). Except, if the output is going to the
602
-** console and if this is running on a Windows machine, translate the
603
-** output from UTF-8 into MBCS.
745
+** console and if this is running on a Windows machine, and if the -utf8
746
+** option is unavailable or (available and inactive), translate the
747
+** output from UTF-8 into MBCS for output through 8-bit stdout stream.
748
+** (With -utf8 active, no translation is needed and must not be done.)
604749
*/
605750
#if defined(_WIN32) || defined(WIN32)
606751
void utf8_printf(FILE *out, const char *zFormat, ...){
607752
va_list ap;
608753
va_start(ap, zFormat);
609
- if( stdout_is_console && (out==stdout || out==stderr) ){
754
+ if( stdout_is_console && (out==stdout || out==stderr)
755
+# if SHELL_WIN_UTF8_OPT
756
+ && !console_utf8
757
+# endif
758
+ ){
610759
char *z1 = sqlite3_vmprintf(zFormat, ap);
611760
char *z2 = sqlite3_win32_utf8_to_mbcs_v2(z1, 0);
612761
sqlite3_free(z1);
613762
fputs(z2, out);
614763
sqlite3_free(z2);
@@ -636,11 +785,11 @@
636785
}
637786
638787
/* Check a pointer to see if it is NULL. If it is NULL, exit with an
639788
** out-of-memory error.
640789
*/
641
-static void shell_check_oom(void *p){
790
+static void shell_check_oom(const void *p){
642791
if( p==0 ) shell_out_of_memory();
643792
}
644793
645794
/*
646795
** Write I/O traces to the following stream.
@@ -815,13 +964,18 @@
815964
zLine[n] = 0;
816965
break;
817966
}
818967
}
819968
#if defined(_WIN32) || defined(WIN32)
820
- /* For interactive input on Windows systems, translate the
821
- ** multi-byte characterset characters into UTF-8. */
822
- if( stdin_is_interactive && in==stdin ){
969
+ /* For interactive input on Windows systems, without -utf8,
970
+ ** translate the multi-byte characterset characters into UTF-8.
971
+ ** This is the translation that predates the -utf8 option. */
972
+ if( stdin_is_interactive && in==stdin
973
+# if SHELL_WIN_UTF8_OPT
974
+ && !console_utf8
975
+# endif /* SHELL_WIN_UTF8_OPT */
976
+ ){
823977
char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
824978
if( zTrans ){
825979
i64 nTrans = strlen(zTrans)+1;
826980
if( nTrans>nLine ){
827981
zLine = realloc(zLine, nTrans);
@@ -858,14 +1012,25 @@
8581012
}else{
8591013
zPrompt = isContinuation ? CONTINUATION_PROMPT : mainPrompt;
8601014
#if SHELL_USE_LOCAL_GETLINE
8611015
printf("%s", zPrompt);
8621016
fflush(stdout);
863
- zResult = local_getline(zPrior, stdin);
1017
+ do{
1018
+ zResult = local_getline(zPrior, stdin);
1019
+ zPrior = 0;
1020
+ /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
1021
+ if( zResult==0 ) sqlite3_sleep(50);
1022
+ }while( zResult==0 && seenInterrupt>0 );
8641023
#else
8651024
free(zPrior);
8661025
zResult = shell_readline(zPrompt);
1026
+ while( zResult==0 ){
1027
+ /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
1028
+ sqlite3_sleep(50);
1029
+ if( seenInterrupt==0 ) break;
1030
+ zResult = shell_readline("");
1031
+ }
8671032
if( zResult && *zResult ) shell_add_history(zResult);
8681033
#endif
8691034
}
8701035
return zResult;
8711036
}
@@ -1001,10 +1166,11 @@
10011166
**
10021167
** Return '"' if quoting is required. Return 0 if no quoting is required.
10031168
*/
10041169
static char quoteChar(const char *zName){
10051170
int i;
1171
+ if( zName==0 ) return '"';
10061172
if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
10071173
for(i=0; zName[i]; i++){
10081174
if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
10091175
}
10101176
return sqlite3_keyword_check(zName, i) ? '"' : 0;
@@ -1644,11 +1810,12 @@
16441810
** May you find forgiveness for yourself and forgive others.
16451811
** May you share freely, never taking more than you give.
16461812
**
16471813
******************************************************************************
16481814
**
1649
-** This SQLite extension implements functions that compute SHA3 hashes.
1815
+** This SQLite extension implements functions that compute SHA3 hashes
1816
+** in the way described by the (U.S.) NIST FIPS 202 SHA-3 Standard.
16501817
** Two SQL functions are implemented:
16511818
**
16521819
** sha3(X,SIZE)
16531820
** sha3_query(Y,SIZE)
16541821
**
@@ -3244,22 +3411,22 @@
32443411
*pOut = 0;
32453412
return pOut;
32463413
}
32473414
32483415
/* Skip over text which is not base64 numeral(s). */
3249
-static char * skipNonB64( char *s ){
3416
+static char * skipNonB64( char *s, int nc ){
32503417
char c;
3251
- while( (c = *s) && !IS_BX_DIGIT(BX_DV_PROTO(c)) ) ++s;
3418
+ while( nc-- > 0 && (c = *s) && !IS_BX_DIGIT(BX_DV_PROTO(c)) ) ++s;
32523419
return s;
32533420
}
32543421
32553422
/* Decode base64 text into a byte buffer. */
32563423
static u8* fromBase64( char *pIn, int ncIn, u8 *pOut ){
32573424
if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
32583425
while( ncIn>0 && *pIn!=PAD_CHAR ){
32593426
static signed char nboi[] = { 0, 0, 1, 2, 3 };
3260
- char *pUse = skipNonB64(pIn);
3427
+ char *pUse = skipNonB64(pIn, ncIn);
32613428
unsigned long qv = 0L;
32623429
int nti, nbo, nac;
32633430
ncIn -= (pUse - pIn);
32643431
pIn = pUse;
32653432
nti = (ncIn>4)? 4 : ncIn;
@@ -3314,14 +3481,21 @@
33143481
nc = 4*(nv+2/3); /* quads needed */
33153482
nc += (nc+(B64_DARK_MAX-1))/B64_DARK_MAX + 1; /* LFs and a 0-terminator */
33163483
if( nvMax < nc ){
33173484
sqlite3_result_error(context, "blob expanded to base64 too big", -1);
33183485
return;
3486
+ }
3487
+ bBuf = (u8*)sqlite3_value_blob(av[0]);
3488
+ if( !bBuf ){
3489
+ if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3490
+ goto memFail;
3491
+ }
3492
+ sqlite3_result_text(context,"",-1,SQLITE_STATIC);
3493
+ break;
33193494
}
33203495
cBuf = sqlite3_malloc(nc);
33213496
if( !cBuf ) goto memFail;
3322
- bBuf = (u8*)sqlite3_value_blob(av[0]);
33233497
nc = (int)(toBase64(bBuf, nb, cBuf) - cBuf);
33243498
sqlite3_result_text(context, cBuf, nc, sqlite3_free);
33253499
break;
33263500
case SQLITE_TEXT:
33273501
nc = nv;
@@ -3329,14 +3503,21 @@
33293503
if( nvMax < nb ){
33303504
sqlite3_result_error(context, "blob from base64 may be too big", -1);
33313505
return;
33323506
}else if( nb<1 ){
33333507
nb = 1;
3508
+ }
3509
+ cBuf = (char *)sqlite3_value_text(av[0]);
3510
+ if( !cBuf ){
3511
+ if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3512
+ goto memFail;
3513
+ }
3514
+ sqlite3_result_zeroblob(context, 0);
3515
+ break;
33343516
}
33353517
bBuf = sqlite3_malloc(nb);
33363518
if( !bBuf ) goto memFail;
3337
- cBuf = (char *)sqlite3_value_text(av[0]);
33383519
nb = (int)(fromBase64(cBuf, nc, bBuf) - bBuf);
33393520
sqlite3_result_blob(context, bBuf, nb, sqlite3_free);
33403521
break;
33413522
default:
33423523
sqlite3_result_error(context, "base64 accepts only blob or text", -1);
@@ -3520,13 +3701,13 @@
35203701
35213702
/* Width of base64 lines. Should be an integer multiple of 5. */
35223703
#define B85_DARK_MAX 80
35233704
35243705
3525
-static char * skipNonB85( char *s ){
3706
+static char * skipNonB85( char *s, int nc ){
35263707
char c;
3527
- while( (c = *s) && !IS_B85(c) ) ++s;
3708
+ while( nc-- > 0 && (c = *s) && !IS_B85(c) ) ++s;
35283709
return s;
35293710
}
35303711
35313712
/* Convert small integer, known to be in 0..84 inclusive, to base85 numeral.
35323713
* Do not use the macro form with argument expression having a side-effect.*/
@@ -3592,11 +3773,11 @@
35923773
/* Decode base85 text into a byte buffer. */
35933774
static u8* fromBase85( char *pIn, int ncIn, u8 *pOut ){
35943775
if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
35953776
while( ncIn>0 ){
35963777
static signed char nboi[] = { 0, 0, 1, 2, 3, 4 };
3597
- char *pUse = skipNonB85(pIn);
3778
+ char *pUse = skipNonB85(pIn, ncIn);
35983779
unsigned long qv = 0L;
35993780
int nti, nbo;
36003781
ncIn -= (pUse - pIn);
36013782
pIn = pUse;
36023783
nti = (ncIn>5)? 5 : ncIn;
@@ -3676,14 +3857,21 @@
36763857
/* ulongs tail newlines tailenc+nul*/
36773858
nc = 5*(nv/4) + nv%4 + nv/64+1 + 2;
36783859
if( nvMax < nc ){
36793860
sqlite3_result_error(context, "blob expanded to base85 too big", -1);
36803861
return;
3862
+ }
3863
+ bBuf = (u8*)sqlite3_value_blob(av[0]);
3864
+ if( !bBuf ){
3865
+ if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3866
+ goto memFail;
3867
+ }
3868
+ sqlite3_result_text(context,"",-1,SQLITE_STATIC);
3869
+ break;
36813870
}
36823871
cBuf = sqlite3_malloc(nc);
36833872
if( !cBuf ) goto memFail;
3684
- bBuf = (u8*)sqlite3_value_blob(av[0]);
36853873
nc = (int)(toBase85(bBuf, nb, cBuf, "\n") - cBuf);
36863874
sqlite3_result_text(context, cBuf, nc, sqlite3_free);
36873875
break;
36883876
case SQLITE_TEXT:
36893877
nc = nv;
@@ -3691,14 +3879,21 @@
36913879
if( nvMax < nb ){
36923880
sqlite3_result_error(context, "blob from base85 may be too big", -1);
36933881
return;
36943882
}else if( nb<1 ){
36953883
nb = 1;
3884
+ }
3885
+ cBuf = (char *)sqlite3_value_text(av[0]);
3886
+ if( !cBuf ){
3887
+ if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3888
+ goto memFail;
3889
+ }
3890
+ sqlite3_result_zeroblob(context, 0);
3891
+ break;
36963892
}
36973893
bBuf = sqlite3_malloc(nb);
36983894
if( !bBuf ) goto memFail;
3699
- cBuf = (char *)sqlite3_value_text(av[0]);
37003895
nb = (int)(fromBase85(cBuf, nc, bBuf) - bBuf);
37013896
sqlite3_result_blob(context, bBuf, nb, sqlite3_free);
37023897
break;
37033898
default:
37043899
sqlite3_result_error(context, "base85 accepts only blob or text.", -1);
@@ -4114,11 +4309,11 @@
41144309
}
41154310
41164311
/************************* End ../ext/misc/ieee754.c ********************/
41174312
/************************* Begin ../ext/misc/series.c ******************/
41184313
/*
4119
-** 2015-08-18
4314
+** 2015-08-18, 2023-04-28
41204315
**
41214316
** The author disclaims copyright to this source code. In place of
41224317
** a legal notice, here is a blessing:
41234318
**
41244319
** May you do good and not evil.
@@ -4127,11 +4322,23 @@
41274322
**
41284323
*************************************************************************
41294324
**
41304325
** This file demonstrates how to create a table-valued-function using
41314326
** a virtual table. This demo implements the generate_series() function
4132
-** which gives similar results to the eponymous function in PostgreSQL.
4327
+** which gives the same results as the eponymous function in PostgreSQL,
4328
+** within the limitation that its arguments are signed 64-bit integers.
4329
+**
4330
+** Considering its equivalents to generate_series(start,stop,step): A
4331
+** value V[n] sequence is produced for integer n ascending from 0 where
4332
+** ( V[n] == start + n * step && sgn(V[n] - stop) * sgn(step) >= 0 )
4333
+** for each produced value (independent of production time ordering.)
4334
+**
4335
+** All parameters must be either integer or convertable to integer.
4336
+** The start parameter is required.
4337
+** The stop parameter defaults to (1<<32)-1 (aka 4294967295 or 0xffffffff)
4338
+** The step parameter defaults to 1 and 0 is treated as 1.
4339
+**
41334340
** Examples:
41344341
**
41354342
** SELECT * FROM generate_series(0,100,5);
41364343
**
41374344
** The query above returns integers from 0 through 100 counting by steps
@@ -4143,10 +4350,18 @@
41434350
**
41444351
** SELECT * FROM generate_series(20) LIMIT 10;
41454352
**
41464353
** Integers 20 through 29.
41474354
**
4355
+** SELECT * FROM generate_series(0,-100,-5);
4356
+**
4357
+** Integers 0 -5 -10 ... -100.
4358
+**
4359
+** SELECT * FROM generate_series(0,-1);
4360
+**
4361
+** Empty sequence.
4362
+**
41484363
** HOW IT WORKS
41494364
**
41504365
** The generate_series "function" is really a virtual table with the
41514366
** following schema:
41524367
**
@@ -4154,10 +4369,13 @@
41544369
** value,
41554370
** start HIDDEN,
41564371
** stop HIDDEN,
41574372
** step HIDDEN
41584373
** );
4374
+**
4375
+** The virtual table also has a rowid, logically equivalent to n+1 where
4376
+** "n" is the ascending integer in the aforesaid production definition.
41594377
**
41604378
** Function arguments in queries against this virtual table are translated
41614379
** into equality constraints against successive hidden columns. In other
41624380
** words, the following pairs of queries are equivalent to each other:
41634381
**
@@ -4187,27 +4405,139 @@
41874405
*/
41884406
/* #include "sqlite3ext.h" */
41894407
SQLITE_EXTENSION_INIT1
41904408
#include <assert.h>
41914409
#include <string.h>
4410
+#include <limits.h>
41924411
41934412
#ifndef SQLITE_OMIT_VIRTUALTABLE
4413
+/*
4414
+** Return that member of a generate_series(...) sequence whose 0-based
4415
+** index is ix. The 0th member is given by smBase. The sequence members
4416
+** progress per ix increment by smStep.
4417
+*/
4418
+static sqlite3_int64 genSeqMember(sqlite3_int64 smBase,
4419
+ sqlite3_int64 smStep,
4420
+ sqlite3_uint64 ix){
4421
+ if( ix>=(sqlite3_uint64)LLONG_MAX ){
4422
+ /* Get ix into signed i64 range. */
4423
+ ix -= (sqlite3_uint64)LLONG_MAX;
4424
+ /* With 2's complement ALU, this next can be 1 step, but is split into
4425
+ * 2 for UBSAN's satisfaction (and hypothetical 1's complement ALUs.) */
4426
+ smBase += (LLONG_MAX/2) * smStep;
4427
+ smBase += (LLONG_MAX - LLONG_MAX/2) * smStep;
4428
+ }
4429
+ /* Under UBSAN (or on 1's complement machines), must do this last term
4430
+ * in steps to avoid the dreaded (and harmless) signed multiply overlow. */
4431
+ if( ix>=2 ){
4432
+ sqlite3_int64 ix2 = (sqlite3_int64)ix/2;
4433
+ smBase += ix2*smStep;
4434
+ ix -= ix2;
4435
+ }
4436
+ return smBase + ((sqlite3_int64)ix)*smStep;
4437
+}
41944438
4439
+/* typedef unsigned char u8; */
4440
+
4441
+typedef struct SequenceSpec {
4442
+ sqlite3_int64 iBase; /* Starting value ("start") */
4443
+ sqlite3_int64 iTerm; /* Given terminal value ("stop") */
4444
+ sqlite3_int64 iStep; /* Increment ("step") */
4445
+ sqlite3_uint64 uSeqIndexMax; /* maximum sequence index (aka "n") */
4446
+ sqlite3_uint64 uSeqIndexNow; /* Current index during generation */
4447
+ sqlite3_int64 iValueNow; /* Current value during generation */
4448
+ u8 isNotEOF; /* Sequence generation not exhausted */
4449
+ u8 isReversing; /* Sequence is being reverse generated */
4450
+} SequenceSpec;
4451
+
4452
+/*
4453
+** Prepare a SequenceSpec for use in generating an integer series
4454
+** given initialized iBase, iTerm and iStep values. Sequence is
4455
+** initialized per given isReversing. Other members are computed.
4456
+*/
4457
+static void setupSequence( SequenceSpec *pss ){
4458
+ int bSameSigns;
4459
+ pss->uSeqIndexMax = 0;
4460
+ pss->isNotEOF = 0;
4461
+ bSameSigns = (pss->iBase < 0)==(pss->iTerm < 0);
4462
+ if( pss->iTerm < pss->iBase ){
4463
+ sqlite3_uint64 nuspan = 0;
4464
+ if( bSameSigns ){
4465
+ nuspan = (sqlite3_uint64)(pss->iBase - pss->iTerm);
4466
+ }else{
4467
+ /* Under UBSAN (or on 1's complement machines), must do this in steps.
4468
+ * In this clause, iBase>=0 and iTerm<0 . */
4469
+ nuspan = 1;
4470
+ nuspan += pss->iBase;
4471
+ nuspan += -(pss->iTerm+1);
4472
+ }
4473
+ if( pss->iStep<0 ){
4474
+ pss->isNotEOF = 1;
4475
+ if( nuspan==ULONG_MAX ){
4476
+ pss->uSeqIndexMax = ( pss->iStep>LLONG_MIN )? nuspan/-pss->iStep : 1;
4477
+ }else if( pss->iStep>LLONG_MIN ){
4478
+ pss->uSeqIndexMax = nuspan/-pss->iStep;
4479
+ }
4480
+ }
4481
+ }else if( pss->iTerm > pss->iBase ){
4482
+ sqlite3_uint64 puspan = 0;
4483
+ if( bSameSigns ){
4484
+ puspan = (sqlite3_uint64)(pss->iTerm - pss->iBase);
4485
+ }else{
4486
+ /* Under UBSAN (or on 1's complement machines), must do this in steps.
4487
+ * In this clause, iTerm>=0 and iBase<0 . */
4488
+ puspan = 1;
4489
+ puspan += pss->iTerm;
4490
+ puspan += -(pss->iBase+1);
4491
+ }
4492
+ if( pss->iStep>0 ){
4493
+ pss->isNotEOF = 1;
4494
+ pss->uSeqIndexMax = puspan/pss->iStep;
4495
+ }
4496
+ }else if( pss->iTerm == pss->iBase ){
4497
+ pss->isNotEOF = 1;
4498
+ pss->uSeqIndexMax = 0;
4499
+ }
4500
+ pss->uSeqIndexNow = (pss->isReversing)? pss->uSeqIndexMax : 0;
4501
+ pss->iValueNow = (pss->isReversing)
4502
+ ? genSeqMember(pss->iBase, pss->iStep, pss->uSeqIndexMax)
4503
+ : pss->iBase;
4504
+}
4505
+
4506
+/*
4507
+** Progress sequence generator to yield next value, if any.
4508
+** Leave its state to either yield next value or be at EOF.
4509
+** Return whether there is a next value, or 0 at EOF.
4510
+*/
4511
+static int progressSequence( SequenceSpec *pss ){
4512
+ if( !pss->isNotEOF ) return 0;
4513
+ if( pss->isReversing ){
4514
+ if( pss->uSeqIndexNow > 0 ){
4515
+ pss->uSeqIndexNow--;
4516
+ pss->iValueNow -= pss->iStep;
4517
+ }else{
4518
+ pss->isNotEOF = 0;
4519
+ }
4520
+ }else{
4521
+ if( pss->uSeqIndexNow < pss->uSeqIndexMax ){
4522
+ pss->uSeqIndexNow++;
4523
+ pss->iValueNow += pss->iStep;
4524
+ }else{
4525
+ pss->isNotEOF = 0;
4526
+ }
4527
+ }
4528
+ return pss->isNotEOF;
4529
+}
41954530
41964531
/* series_cursor is a subclass of sqlite3_vtab_cursor which will
41974532
** serve as the underlying representation of a cursor that scans
41984533
** over rows of the result
41994534
*/
42004535
typedef struct series_cursor series_cursor;
42014536
struct series_cursor {
42024537
sqlite3_vtab_cursor base; /* Base class - must be first */
4203
- int isDesc; /* True to count down rather than up */
4204
- sqlite3_int64 iRowid; /* The rowid */
4205
- sqlite3_int64 iValue; /* Current value ("value") */
4206
- sqlite3_int64 mnValue; /* Mimimum value ("start") */
4207
- sqlite3_int64 mxValue; /* Maximum value ("stop") */
4208
- sqlite3_int64 iStep; /* Increment ("step") */
4538
+ SequenceSpec ss; /* (this) Derived class data */
42094539
};
42104540
42114541
/*
42124542
** The seriesConnect() method is invoked to create a new
42134543
** series_vtab that describes the generate_series virtual table.
@@ -4285,16 +4615,11 @@
42854615
/*
42864616
** Advance a series_cursor to its next row of output.
42874617
*/
42884618
static int seriesNext(sqlite3_vtab_cursor *cur){
42894619
series_cursor *pCur = (series_cursor*)cur;
4290
- if( pCur->isDesc ){
4291
- pCur->iValue -= pCur->iStep;
4292
- }else{
4293
- pCur->iValue += pCur->iStep;
4294
- }
4295
- pCur->iRowid++;
4620
+ progressSequence( & pCur->ss );
42964621
return SQLITE_OK;
42974622
}
42984623
42994624
/*
43004625
** Return values of columns for the row at which the series_cursor
@@ -4306,44 +4631,40 @@
43064631
int i /* Which column to return */
43074632
){
43084633
series_cursor *pCur = (series_cursor*)cur;
43094634
sqlite3_int64 x = 0;
43104635
switch( i ){
4311
- case SERIES_COLUMN_START: x = pCur->mnValue; break;
4312
- case SERIES_COLUMN_STOP: x = pCur->mxValue; break;
4313
- case SERIES_COLUMN_STEP: x = pCur->iStep; break;
4314
- default: x = pCur->iValue; break;
4636
+ case SERIES_COLUMN_START: x = pCur->ss.iBase; break;
4637
+ case SERIES_COLUMN_STOP: x = pCur->ss.iTerm; break;
4638
+ case SERIES_COLUMN_STEP: x = pCur->ss.iStep; break;
4639
+ default: x = pCur->ss.iValueNow; break;
43154640
}
43164641
sqlite3_result_int64(ctx, x);
43174642
return SQLITE_OK;
43184643
}
43194644
43204645
/*
4321
-** Return the rowid for the current row. In this implementation, the
4322
-** first row returned is assigned rowid value 1, and each subsequent
4323
-** row a value 1 more than that of the previous.
4646
+** Return the rowid for the current row, logically equivalent to n+1 where
4647
+** "n" is the ascending integer in the aforesaid production definition.
43244648
*/
43254649
static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
43264650
series_cursor *pCur = (series_cursor*)cur;
4327
- *pRowid = pCur->iRowid;
4651
+ sqlite3_uint64 n = pCur->ss.uSeqIndexNow;
4652
+ *pRowid = (sqlite3_int64)((n<0xffffffffffffffff)? n+1 : 0);
43284653
return SQLITE_OK;
43294654
}
43304655
43314656
/*
43324657
** Return TRUE if the cursor has been moved off of the last
43334658
** row of output.
43344659
*/
43354660
static int seriesEof(sqlite3_vtab_cursor *cur){
43364661
series_cursor *pCur = (series_cursor*)cur;
4337
- if( pCur->isDesc ){
4338
- return pCur->iValue < pCur->mnValue;
4339
- }else{
4340
- return pCur->iValue > pCur->mxValue;
4341
- }
4662
+ return !pCur->ss.isNotEOF;
43424663
}
43434664
4344
-/* True to cause run-time checking of the start=, stop=, and/or step=
4665
+/* True to cause run-time checking of the start=, stop=, and/or step=
43454666
** parameters. The only reason to do this is for testing the
43464667
** constraint checking logic for virtual tables in the SQLite core.
43474668
*/
43484669
#ifndef SQLITE_SERIES_CONSTRAINT_VERIFY
43494670
# define SQLITE_SERIES_CONSTRAINT_VERIFY 0
@@ -4350,11 +4671,11 @@
43504671
#endif
43514672
43524673
/*
43534674
** This method is called to "rewind" the series_cursor object back
43544675
** to the first row of output. This method is always called at least
4355
-** once prior to any call to seriesColumn() or seriesRowid() or
4676
+** once prior to any call to seriesColumn() or seriesRowid() or
43564677
** seriesEof().
43574678
**
43584679
** The query plan selected by seriesBestIndex is passed in the idxNum
43594680
** parameter. (idxStr is not used in this implementation.) idxNum
43604681
** is a bitmask showing which constraints are available:
@@ -4370,58 +4691,53 @@
43704691
** This routine should initialize the cursor and position it so that it
43714692
** is pointing at the first row, or pointing off the end of the table
43724693
** (so that seriesEof() will return true) if the table is empty.
43734694
*/
43744695
static int seriesFilter(
4375
- sqlite3_vtab_cursor *pVtabCursor,
4696
+ sqlite3_vtab_cursor *pVtabCursor,
43764697
int idxNum, const char *idxStrUnused,
43774698
int argc, sqlite3_value **argv
43784699
){
43794700
series_cursor *pCur = (series_cursor *)pVtabCursor;
43804701
int i = 0;
43814702
(void)idxStrUnused;
43824703
if( idxNum & 1 ){
4383
- pCur->mnValue = sqlite3_value_int64(argv[i++]);
4704
+ pCur->ss.iBase = sqlite3_value_int64(argv[i++]);
43844705
}else{
4385
- pCur->mnValue = 0;
4706
+ pCur->ss.iBase = 0;
43864707
}
43874708
if( idxNum & 2 ){
4388
- pCur->mxValue = sqlite3_value_int64(argv[i++]);
4709
+ pCur->ss.iTerm = sqlite3_value_int64(argv[i++]);
43894710
}else{
4390
- pCur->mxValue = 0xffffffff;
4711
+ pCur->ss.iTerm = 0xffffffff;
43914712
}
43924713
if( idxNum & 4 ){
4393
- pCur->iStep = sqlite3_value_int64(argv[i++]);
4394
- if( pCur->iStep==0 ){
4395
- pCur->iStep = 1;
4396
- }else if( pCur->iStep<0 ){
4397
- pCur->iStep = -pCur->iStep;
4714
+ pCur->ss.iStep = sqlite3_value_int64(argv[i++]);
4715
+ if( pCur->ss.iStep==0 ){
4716
+ pCur->ss.iStep = 1;
4717
+ }else if( pCur->ss.iStep<0 ){
43984718
if( (idxNum & 16)==0 ) idxNum |= 8;
43994719
}
44004720
}else{
4401
- pCur->iStep = 1;
4721
+ pCur->ss.iStep = 1;
44024722
}
44034723
for(i=0; i<argc; i++){
44044724
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
44054725
/* If any of the constraints have a NULL value, then return no rows.
44064726
** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
4407
- pCur->mnValue = 1;
4408
- pCur->mxValue = 0;
4727
+ pCur->ss.iBase = 1;
4728
+ pCur->ss.iTerm = 0;
4729
+ pCur->ss.iStep = 1;
44094730
break;
44104731
}
44114732
}
44124733
if( idxNum & 8 ){
4413
- pCur->isDesc = 1;
4414
- pCur->iValue = pCur->mxValue;
4415
- if( pCur->iStep>0 ){
4416
- pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
4417
- }
4734
+ pCur->ss.isReversing = pCur->ss.iStep > 0;
44184735
}else{
4419
- pCur->isDesc = 0;
4420
- pCur->iValue = pCur->mnValue;
4736
+ pCur->ss.isReversing = pCur->ss.iStep < 0;
44214737
}
4422
- pCur->iRowid = 1;
4738
+ setupSequence( &pCur->ss );
44234739
return SQLITE_OK;
44244740
}
44254741
44264742
/*
44274743
** SQLite will invoke this method one or more times while planning a query
@@ -5172,11 +5488,11 @@
51725488
re_append(p, RE_OP_FORK, -sz);
51735489
}
51745490
break;
51755491
}
51765492
case '[': {
5177
- int iFirst = p->nState;
5493
+ unsigned int iFirst = p->nState;
51785494
if( rePeek(p)=='^' ){
51795495
re_append(p, RE_OP_CC_EXC, 0);
51805496
p->sIn.i++;
51815497
}else{
51825498
re_append(p, RE_OP_CC_INC, 0);
@@ -5196,11 +5512,11 @@
51965512
re_append(p, RE_OP_CC_VALUE, c);
51975513
}
51985514
if( rePeek(p)==']' ){ p->sIn.i++; break; }
51995515
}
52005516
if( c==0 ) return "unclosed '['";
5201
- p->aArg[iFirst] = p->nState - iFirst;
5517
+ if( p->nState>iFirst ) p->aArg[iFirst] = p->nState - iFirst;
52025518
break;
52035519
}
52045520
case '\\': {
52055521
int specialOp = 0;
52065522
switch( rePeek(p) ){
@@ -9213,13 +9529,23 @@
92139529
** Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
92149530
** linked list. Remove it from the list and free the object.
92159531
*/
92169532
static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
92179533
if( pOld ){
9218
- ZipfileEntry **pp;
9219
- for(pp=&pTab->pFirstEntry; (*pp)!=pOld; pp=&((*pp)->pNext));
9220
- *pp = (*pp)->pNext;
9534
+ if( pTab->pFirstEntry==pOld ){
9535
+ pTab->pFirstEntry = pOld->pNext;
9536
+ if( pTab->pLastEntry==pOld ) pTab->pLastEntry = 0;
9537
+ }else{
9538
+ ZipfileEntry *p;
9539
+ for(p=pTab->pFirstEntry; p; p=p->pNext){
9540
+ if( p->pNext==pOld ){
9541
+ p->pNext = pOld->pNext;
9542
+ if( pTab->pLastEntry==pOld ) pTab->pLastEntry = p;
9543
+ break;
9544
+ }
9545
+ }
9546
+ }
92219547
zipfileEntryFree(pOld);
92229548
}
92239549
}
92249550
92259551
/*
@@ -12510,10 +12836,11 @@
1251012836
#endif
1251112837
1251212838
#endif /* ifndef _SQLITE_RECOVER_H */
1251312839
1251412840
/************************* End ../ext/recover/sqlite3recover.h ********************/
12841
+# ifndef SQLITE_HAVE_SQLITE3R
1251512842
/************************* Begin ../ext/recover/dbdata.c ******************/
1251612843
/*
1251712844
** 2019-04-17
1251812845
**
1251912846
** The author disclaims copyright to this source code. In place of
@@ -14576,11 +14903,11 @@
1457614903
pStmt = recoverPreparePrintf(p, p->dbOut, "PRAGMA index_xinfo(%Q)", zName);
1457714904
while( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
1457814905
int iField = sqlite3_column_int(pStmt, 0);
1457914906
int iCol = sqlite3_column_int(pStmt, 1);
1458014907
14581
- assert( iField<pNew->nCol && iCol<pNew->nCol );
14908
+ assert( iCol<pNew->nCol );
1458214909
pNew->aCol[iCol].iField = iField;
1458314910
1458414911
pNew->bIntkey = 0;
1458514912
iPk = -2;
1458614913
}
@@ -16340,10 +16667,11 @@
1634016667
}
1634116668
1634216669
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
1634316670
1634416671
/************************* End ../ext/recover/sqlite3recover.c ********************/
16672
+# endif /* SQLITE_HAVE_SQLITE3R */
1634516673
#endif
1634616674
#ifdef SQLITE_SHELL_EXTSRC
1634716675
# include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
1634816676
#endif
1634916677
@@ -16521,10 +16849,11 @@
1652116849
#define SHFLG_CountChanges 0x00000020 /* .changes setting */
1652216850
#define SHFLG_Echo 0x00000040 /* .echo on/off, or --echo setting */
1652316851
#define SHFLG_HeaderSet 0x00000080 /* showHeader has been specified */
1652416852
#define SHFLG_DumpDataOnly 0x00000100 /* .dump show data only */
1652516853
#define SHFLG_DumpNoSys 0x00000200 /* .dump omits system tables */
16854
+#define SHFLG_TestingMode 0x00000400 /* allow unsafe testing features */
1652616855
1652716856
/*
1652816857
** Macros for testing and setting shellFlgs
1652916858
*/
1653016859
#define ShellHasFlag(P,X) (((P)->shellFlgs & (X))!=0)
@@ -16764,10 +17093,11 @@
1676417093
if( hasCRNL ){
1676517094
/* If the original contains \r\n then do no conversions back to \n */
1676617095
}else{
1676717096
/* If the file did not originally contain \r\n then convert any new
1676817097
** \r\n back into \n */
17098
+ p[sz] = 0;
1676917099
for(i=j=0; i<sz; i++){
1677017100
if( p[i]=='\r' && p[i+1]=='\n' ) i++;
1677117101
p[j++] = p[i];
1677217102
}
1677317103
sz = j;
@@ -16854,10 +17184,11 @@
1685417184
*/
1685517185
static void output_quoted_string(FILE *out, const char *z){
1685617186
int i;
1685717187
char c;
1685817188
setBinaryMode(out, 1);
17189
+ if( z==0 ) return;
1685917190
for(i=0; (c = z[i])!=0 && c!='\''; i++){}
1686017191
if( c==0 ){
1686117192
utf8_printf(out,"'%s'",z);
1686217193
}else{
1686317194
raw_printf(out, "'");
@@ -16983,10 +17314,11 @@
1698317314
/*
1698417315
** Output the given string as a quoted according to JSON quoting rules.
1698517316
*/
1698617317
static void output_json_string(FILE *out, const char *z, i64 n){
1698717318
unsigned int c;
17319
+ if( z==0 ) z = "";
1698817320
if( n<0 ) n = strlen(z);
1698917321
fputc('"', out);
1699017322
while( n-- ){
1699117323
c = *(z++);
1699217324
if( c=='\\' || c=='"' ){
@@ -17107,12 +17439,11 @@
1710717439
/*
1710817440
** This routine runs when the user presses Ctrl-C
1710917441
*/
1711017442
static void interrupt_handler(int NotUsed){
1711117443
UNUSED_PARAMETER(NotUsed);
17112
- seenInterrupt++;
17113
- if( seenInterrupt>2 ) exit(1);
17444
+ if( ++seenInterrupt>1 ) exit(1);
1711417445
if( globalDb ) sqlite3_interrupt(globalDb);
1711517446
}
1711617447
1711717448
#if (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE)
1711817449
/*
@@ -18559,14 +18890,18 @@
1855918890
zVar = zNum;
1856018891
}
1856118892
sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
1856218893
if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
1856318894
sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
18895
+#ifdef NAN
1856418896
}else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
1856518897
sqlite3_bind_double(pStmt, i, NAN);
18898
+#endif
18899
+#ifdef INFINITY
1856618900
}else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
1856718901
sqlite3_bind_double(pStmt, i, INFINITY);
18902
+#endif
1856818903
}else{
1856918904
sqlite3_bind_null(pStmt, i);
1857018905
}
1857118906
sqlite3_reset(pQ);
1857218907
}
@@ -18806,11 +19141,11 @@
1880619141
nAlloc = nColumn*4;
1880719142
if( nAlloc<=0 ) nAlloc = 1;
1880819143
azData = sqlite3_malloc64( nAlloc*sizeof(char*) );
1880919144
shell_check_oom(azData);
1881019145
azNextLine = sqlite3_malloc64( nColumn*sizeof(char*) );
18811
- shell_check_oom((void*)azNextLine);
19146
+ shell_check_oom(azNextLine);
1881219147
memset((void*)azNextLine, 0, nColumn*sizeof(char*) );
1881319148
if( p->cmOpts.bQuote ){
1881419149
azQuoted = sqlite3_malloc64( nColumn*sizeof(char*) );
1881519150
shell_check_oom(azQuoted);
1881619151
memset(azQuoted, 0, nColumn*sizeof(char*) );
@@ -18836,10 +19171,11 @@
1883619171
if( wx==0 ){
1883719172
wx = p->cmOpts.iWrap;
1883819173
}
1883919174
if( wx<0 ) wx = -wx;
1884019175
uz = (const unsigned char*)sqlite3_column_name(pStmt,i);
19176
+ if( uz==0 ) uz = (u8*)"";
1884119177
azData[i] = translateForDisplayAndDup(uz, &zNotUsed, wx, bw);
1884219178
}
1884319179
do{
1884419180
int useNextLine = bNextLine;
1884519181
bNextLine = 0;
@@ -19769,17 +20105,17 @@
1976920105
" from the \".mode\" output mode",
1977020106
" * If FILE begins with \"|\" then it is a command that generates the",
1977120107
" input text.",
1977220108
#endif
1977320109
#ifndef SQLITE_OMIT_TEST_CONTROL
19774
- ".imposter INDEX TABLE Create imposter table TABLE on index INDEX",
20110
+ ",imposter INDEX TABLE Create imposter table TABLE on index INDEX",
1977520111
#endif
1977620112
".indexes ?TABLE? Show names of indexes",
1977720113
" If TABLE is specified, only show indexes for",
1977820114
" tables matching TABLE using the LIKE operator.",
1977920115
#ifdef SQLITE_ENABLE_IOTRACE
19780
- ".iotrace FILE Enable I/O diagnostic logging to FILE",
20116
+ ",iotrace FILE Enable I/O diagnostic logging to FILE",
1978120117
#endif
1978220118
".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT",
1978320119
".lint OPTIONS Report potential schema issues.",
1978420120
" Options:",
1978520121
" fkey-indexes Find missing foreign key indexes",
@@ -19884,11 +20220,11 @@
1988420220
".scanstats on|off|est Turn sqlite3_stmt_scanstatus() metrics on or off",
1988520221
".schema ?PATTERN? Show the CREATE statements matching PATTERN",
1988620222
" Options:",
1988720223
" --indent Try to pretty-print the schema",
1988820224
" --nosys Omit objects whose names start with \"sqlite_\"",
19889
- ".selftest ?OPTIONS? Run tests defined in the SELFTEST table",
20225
+ ",selftest ?OPTIONS? Run tests defined in the SELFTEST table",
1989020226
" Options:",
1989120227
" --init Create a new SELFTEST table",
1989220228
" -v Verbose output",
1989320229
".separator COL ?ROW? Change the column and row separators",
1989420230
#if defined(SQLITE_ENABLE_SESSION)
@@ -19926,13 +20262,13 @@
1992620262
#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
1992720263
".system CMD ARGS... Run CMD ARGS... in a system shell",
1992820264
#endif
1992920265
".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
1993020266
#ifndef SQLITE_SHELL_FIDDLE
19931
- ".testcase NAME Begin redirecting output to 'testcase-out.txt'",
20267
+ ",testcase NAME Begin redirecting output to 'testcase-out.txt'",
1993220268
#endif
19933
- ".testctrl CMD ... Run various sqlite3_test_control() operations",
20269
+ ",testctrl CMD ... Run various sqlite3_test_control() operations",
1993420270
" Run \".testctrl\" with no arguments for details",
1993520271
".timeout MS Try opening locked tables for MS milliseconds",
1993620272
".timer on|off Turn SQL timer on or off",
1993720273
#ifndef SQLITE_OMIT_TRACE
1993820274
".trace ?OPTIONS? Output each SQL statement as it is run",
@@ -19980,20 +20316,45 @@
1998020316
|| zPattern[0]=='0'
1998120317
|| cli_strcmp(zPattern,"-a")==0
1998220318
|| cli_strcmp(zPattern,"-all")==0
1998320319
|| cli_strcmp(zPattern,"--all")==0
1998420320
){
19985
- /* Show all commands, but only one line per command */
19986
- if( zPattern==0 ) zPattern = "";
20321
+ enum HelpWanted { HW_NoCull = 0, HW_SummaryOnly = 1, HW_Undoc = 2 };
20322
+ enum HelpHave { HH_Undoc = 2, HH_Summary = 1, HH_More = 0 };
20323
+ /* Show all or most commands
20324
+ ** *zPattern==0 => summary of documented commands only
20325
+ ** *zPattern=='0' => whole help for undocumented commands
20326
+ ** Otherwise => whole help for documented commands
20327
+ */
20328
+ enum HelpWanted hw = HW_SummaryOnly;
20329
+ enum HelpHave hh = HH_More;
20330
+ if( zPattern!=0 ){
20331
+ hw = (*zPattern=='0')? HW_NoCull|HW_Undoc : HW_NoCull;
20332
+ }
1998720333
for(i=0; i<ArraySize(azHelp); i++){
19988
- if( azHelp[i][0]=='.' || zPattern[0] ){
19989
- utf8_printf(out, "%s\n", azHelp[i]);
19990
- n++;
20334
+ switch( azHelp[i][0] ){
20335
+ case ',':
20336
+ hh = HH_Summary|HH_Undoc;
20337
+ break;
20338
+ case '.':
20339
+ hh = HH_Summary;
20340
+ break;
20341
+ default:
20342
+ hh &= ~HH_Summary;
20343
+ break;
20344
+ }
20345
+ if( ((hw^hh)&HH_Undoc)==0 ){
20346
+ if( (hh&HH_Summary)!=0 ){
20347
+ utf8_printf(out, ".%s\n", azHelp[i]+1);
20348
+ ++n;
20349
+ }else if( (hw&HW_SummaryOnly)==0 ){
20350
+ utf8_printf(out, "%s\n", azHelp[i]);
20351
+ }
1999120352
}
1999220353
}
1999320354
}else{
19994
- /* Look for commands that for which zPattern is an exact prefix */
20355
+ /* Seek documented commands for which zPattern is an exact prefix */
1999520356
zPat = sqlite3_mprintf(".%s*", zPattern);
1999620357
shell_check_oom(zPat);
1999720358
for(i=0; i<ArraySize(azHelp); i++){
1999820359
if( sqlite3_strglob(zPat, azHelp[i])==0 ){
1999920360
utf8_printf(out, "%s\n", azHelp[i]);
@@ -20002,28 +20363,32 @@
2000220363
}
2000320364
}
2000420365
sqlite3_free(zPat);
2000520366
if( n ){
2000620367
if( n==1 ){
20007
- /* when zPattern is a prefix of exactly one command, then include the
20008
- ** details of that command, which should begin at offset j */
20009
- while( j<ArraySize(azHelp)-1 && azHelp[j][0]!='.' ){
20368
+ /* when zPattern is a prefix of exactly one command, then include
20369
+ ** the details of that command, which should begin at offset j */
20370
+ while( j<ArraySize(azHelp)-1 && azHelp[j][0]==' ' ){
2001020371
utf8_printf(out, "%s\n", azHelp[j]);
2001120372
j++;
2001220373
}
2001320374
}
2001420375
return n;
2001520376
}
20016
- /* Look for commands that contain zPattern anywhere. Show the complete
20017
- ** text of all commands that match. */
20377
+ /* Look for documented commands that contain zPattern anywhere.
20378
+ ** Show complete text of all documented commands that match. */
2001820379
zPat = sqlite3_mprintf("%%%s%%", zPattern);
2001920380
shell_check_oom(zPat);
2002020381
for(i=0; i<ArraySize(azHelp); i++){
20382
+ if( azHelp[i][0]==',' ){
20383
+ while( i<ArraySize(azHelp)-1 && azHelp[i+1][0]==' ' ) ++i;
20384
+ continue;
20385
+ }
2002120386
if( azHelp[i][0]=='.' ) j = i;
2002220387
if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){
2002320388
utf8_printf(out, "%s\n", azHelp[j]);
20024
- while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]!='.' ){
20389
+ while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]==' ' ){
2002520390
j++;
2002620391
utf8_printf(out, "%s\n", azHelp[j]);
2002720392
}
2002820393
i = j;
2002920394
n++;
@@ -20337,17 +20702,34 @@
2033720702
}
2033820703
globalDb = p->db;
2033920704
if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){
2034020705
utf8_printf(stderr,"Error: unable to open database \"%s\": %s\n",
2034120706
zDbFilename, sqlite3_errmsg(p->db));
20342
- if( openFlags & OPEN_DB_KEEPALIVE ){
20343
- sqlite3_open(":memory:", &p->db);
20344
- return;
20707
+ if( (openFlags & OPEN_DB_KEEPALIVE)==0 ){
20708
+ exit(1);
2034520709
}
20346
- exit(1);
20710
+ sqlite3_close(p->db);
20711
+ sqlite3_open(":memory:", &p->db);
20712
+ if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){
20713
+ utf8_printf(stderr,
20714
+ "Also: unable to open substitute in-memory database.\n"
20715
+ );
20716
+ exit(1);
20717
+ }else{
20718
+ utf8_printf(stderr,
20719
+ "Notice: using substitute in-memory database instead of \"%s\"\n",
20720
+ zDbFilename);
20721
+ }
2034720722
}
2034820723
sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
20724
+
20725
+ /* Reflect the use or absence of --unsafe-testing invocation. */
20726
+ {
20727
+ int testmode_on = ShellHasFlag(p,SHFLG_TestingMode);
20728
+ sqlite3_db_config(p->db, SQLITE_DBCONFIG_TRUSTED_SCHEMA, testmode_on,0);
20729
+ sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, !testmode_on,0);
20730
+ }
2034920731
2035020732
#ifndef SQLITE_OMIT_LOAD_EXTENSION
2035120733
sqlite3_enable_load_extension(p->db, 1);
2035220734
#endif
2035320735
sqlite3_shathree_init(p->db, 0, 0);
@@ -20356,13 +20738,10 @@
2035620738
sqlite3_base64_init(p->db, 0, 0);
2035720739
sqlite3_base85_init(p->db, 0, 0);
2035820740
sqlite3_regexp_init(p->db, 0, 0);
2035920741
sqlite3_ieee_init(p->db, 0, 0);
2036020742
sqlite3_series_init(p->db, 0, 0);
20361
-#if SQLITE_SHELL_HAVE_RECOVER
20362
- sqlite3_dbdata_init(p->db, 0, 0);
20363
-#endif
2036420743
#ifndef SQLITE_SHELL_FIDDLE
2036520744
sqlite3_fileio_init(p->db, 0, 0);
2036620745
sqlite3_completion_init(p->db, 0, 0);
2036720746
#endif
2036820747
#ifdef SQLITE_HAVE_ZLIB
@@ -20550,10 +20929,11 @@
2055020929
** \s -> space
2055120930
** \" -> "
2055220931
** \' -> '
2055320932
** \\ -> backslash
2055420933
** \NNN -> ascii character NNN in octal
20934
+** \xHH -> ascii character HH in hexadecimal
2055520935
*/
2055620936
static void resolve_backslashes(char *z){
2055720937
int i, j;
2055820938
char c;
2055920939
while( *z && *z!='\\' ) z++;
@@ -20578,10 +20958,19 @@
2057820958
c = '"';
2057920959
}else if( c=='\'' ){
2058020960
c = '\'';
2058120961
}else if( c=='\\' ){
2058220962
c = '\\';
20963
+ }else if( c=='x' ){
20964
+ int nhd = 0, hdv;
20965
+ u8 hv = 0;
20966
+ while( nhd<2 && (c=z[i+1+nhd])!=0 && (hdv=hexDigitValue(c))>=0 ){
20967
+ hv = (u8)((hv<<4)|hdv);
20968
+ ++nhd;
20969
+ }
20970
+ i += nhd;
20971
+ c = (u8)hv;
2058320972
}else if( c>='0' && c<='7' ){
2058420973
c -= '0';
2058520974
if( z[i+1]>='0' && z[i+1]<='7' ){
2058620975
i++;
2058720976
c = (c<<3) + z[i] - '0';
@@ -20677,11 +21066,11 @@
2067721066
if( p->traceOut==0 ) return 0;
2067821067
if( mType==SQLITE_TRACE_CLOSE ){
2067921068
utf8_printf(p->traceOut, "-- closing database connection\n");
2068021069
return 0;
2068121070
}
20682
- if( mType!=SQLITE_TRACE_ROW && ((const char*)pX)[0]=='-' ){
21071
+ if( mType!=SQLITE_TRACE_ROW && pX!=0 && ((const char*)pX)[0]=='-' ){
2068321072
zSql = (const char*)pX;
2068421073
}else{
2068521074
pStmt = (sqlite3_stmt*)pP;
2068621075
switch( p->eTraceType ){
2068721076
case SHELL_TRACE_EXPANDED: {
@@ -20709,11 +21098,11 @@
2070921098
case SQLITE_TRACE_STMT: {
2071021099
utf8_printf(p->traceOut, "%.*s;\n", (int)nSql, zSql);
2071121100
break;
2071221101
}
2071321102
case SQLITE_TRACE_PROFILE: {
20714
- sqlite3_int64 nNanosec = *(sqlite3_int64*)pX;
21103
+ sqlite3_int64 nNanosec = pX ? *(sqlite3_int64*)pX : 0;
2071521104
utf8_printf(p->traceOut, "%.*s; -- %lld ns\n", (int)nSql, zSql, nNanosec);
2071621105
break;
2071721106
}
2071821107
}
2071921108
return 0;
@@ -20785,12 +21174,12 @@
2078521174
** EOF on end-of-file.
2078621175
** + Report syntax errors on stderr
2078721176
*/
2078821177
static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
2078921178
int c;
20790
- int cSep = p->cColSep;
20791
- int rSep = p->cRowSep;
21179
+ int cSep = (u8)p->cColSep;
21180
+ int rSep = (u8)p->cRowSep;
2079221181
p->n = 0;
2079321182
c = fgetc(p->in);
2079421183
if( c==EOF || seenInterrupt ){
2079521184
p->cTerm = EOF;
2079621185
return 0;
@@ -20875,12 +21264,12 @@
2087521264
** EOF on end-of-file.
2087621265
** + Report syntax errors on stderr
2087721266
*/
2087821267
static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
2087921268
int c;
20880
- int cSep = p->cColSep;
20881
- int rSep = p->cRowSep;
21269
+ int cSep = (u8)p->cColSep;
21270
+ int rSep = (u8)p->cRowSep;
2088221271
p->n = 0;
2088321272
c = fgetc(p->in);
2088421273
if( c==EOF || seenInterrupt ){
2088521274
p->cTerm = EOF;
2088621275
return 0;
@@ -21070,11 +21459,11 @@
2107021459
}
2107121460
while( sqlite3_step(pQuery)==SQLITE_ROW ){
2107221461
zName = sqlite3_column_text(pQuery, 0);
2107321462
zSql = sqlite3_column_text(pQuery, 1);
2107421463
if( zName==0 || zSql==0 ) continue;
21075
- if( sqlite3_stricmp((char*)zName, "sqlite_sequence")!=0 ) continue;
21464
+ if( sqlite3_stricmp((char*)zName, "sqlite_sequence")==0 ) continue;
2107621465
printf("%s... ", zName); fflush(stdout);
2107721466
sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
2107821467
if( zErrMsg ){
2107921468
utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
2108021469
sqlite3_free(zErrMsg);
@@ -21237,11 +21626,13 @@
2123721626
}
2123821627
sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
2123921628
if( sqlite3_step(pStmt)==SQLITE_ROW
2124021629
&& sqlite3_column_bytes(pStmt,0)>100
2124121630
){
21242
- memcpy(aHdr, sqlite3_column_blob(pStmt,0), 100);
21631
+ const u8 *pb = sqlite3_column_blob(pStmt,0);
21632
+ shell_check_oom(pb);
21633
+ memcpy(aHdr, pb, 100);
2124321634
sqlite3_finalize(pStmt);
2124421635
}else{
2124521636
raw_printf(stderr, "unable to read database header\n");
2124621637
sqlite3_finalize(pStmt);
2124721638
return 1;
@@ -22054,11 +22445,14 @@
2205422445
if( arProcessSwitch(pAr, pMatch->eSwitch, zArg) ) return SQLITE_ERROR;
2205522446
}
2205622447
}
2205722448
}
2205822449
}
22059
-
22450
+ if( pAr->eCmd==0 ){
22451
+ utf8_printf(stderr, "Required argument missing. Usage:\n");
22452
+ return arUsage(stderr);
22453
+ }
2206022454
return SQLITE_OK;
2206122455
}
2206222456
2206322457
/*
2206422458
** This function assumes that all arguments within the ArCommand.azArg[]
@@ -22820,11 +23214,11 @@
2282023214
rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
2282123215
rc_err_oom_die(rc);
2282223216
sqlite3_bind_int(pStmt, 1, nDigits);
2282323217
rc = sqlite3_step(pStmt);
2282423218
sqlite3_finalize(pStmt);
22825
- assert(rc==SQLITE_DONE);
23219
+ if( rc!=SQLITE_DONE ) rc_err_oom_die(SQLITE_NOMEM);
2282623220
}
2282723221
assert(db_int(*pDb, zHasDupes)==0); /* Consider: remove this */
2282823222
rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
2282923223
rc_err_oom_die(rc);
2283023224
rc = sqlite3_step(pStmt);
@@ -23752,12 +24146,12 @@
2375224146
if( nSep>1 ){
2375324147
raw_printf(stderr, "Error: multi-character row separators not allowed"
2375424148
" for import\n");
2375524149
goto meta_command_exit;
2375624150
}
23757
- sCtx.cColSep = p->colSeparator[0];
23758
- sCtx.cRowSep = p->rowSeparator[0];
24151
+ sCtx.cColSep = (u8)p->colSeparator[0];
24152
+ sCtx.cRowSep = (u8)p->rowSeparator[0];
2375924153
}
2376024154
sCtx.zFile = zFile;
2376124155
sCtx.nLine = 1;
2376224156
if( sCtx.zFile[0]=='|' ){
2376324157
#ifdef SQLITE_OMIT_POPEN
@@ -23949,10 +24343,16 @@
2394924343
sqlite3_stmt *pStmt;
2395024344
int tnum = 0;
2395124345
int isWO = 0; /* True if making an imposter of a WITHOUT ROWID table */
2395224346
int lenPK = 0; /* Length of the PRIMARY KEY string for isWO tables */
2395324347
int i;
24348
+ if( !ShellHasFlag(p,SHFLG_TestingMode) ){
24349
+ utf8_printf(stderr, ".%s unavailable without --unsafe-testing\n",
24350
+ "imposter");
24351
+ rc = 1;
24352
+ goto meta_command_exit;
24353
+ }
2395424354
if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){
2395524355
utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n"
2395624356
" .imposter off\n");
2395724357
/* Also allowed, but not documented:
2395824358
**
@@ -24133,11 +24533,12 @@
2413324533
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
2413424534
if( c=='l' && cli_strncmp(azArg[0], "load", n)==0 ){
2413524535
const char *zFile, *zProc;
2413624536
char *zErrMsg = 0;
2413724537
failIfSafeMode(p, "cannot run .load in safe mode");
24138
- if( nArg<2 ){
24538
+ if( nArg<2 || azArg[1][0]==0 ){
24539
+ /* Must have a non-empty FILE. (Will not load self.) */
2413924540
raw_printf(stderr, "Usage: .load FILE ?ENTRYPOINT?\n");
2414024541
rc = 1;
2414124542
goto meta_command_exit;
2414224543
}
2414324544
zFile = azArg[1];
@@ -25457,32 +25858,40 @@
2545725858
"' OR ') as query, tname from tabcols group by tname)"
2545825859
, zRevText);
2545925860
shell_check_oom(zRevText);
2546025861
if( bDebug ) utf8_printf(p->out, "%s\n", zRevText);
2546125862
lrc = sqlite3_prepare_v2(p->db, zRevText, -1, &pStmt, 0);
25462
- assert(lrc==SQLITE_OK);
25463
- if( zLike ) sqlite3_bind_text(pStmt,1,zLike,-1,SQLITE_STATIC);
25464
- lrc = SQLITE_ROW==sqlite3_step(pStmt);
25465
- if( lrc ){
25466
- const char *zGenQuery = (char*)sqlite3_column_text(pStmt,0);
25467
- sqlite3_stmt *pCheckStmt;
25468
- lrc = sqlite3_prepare_v2(p->db, zGenQuery, -1, &pCheckStmt, 0);
25469
- if( bDebug ) utf8_printf(p->out, "%s\n", zGenQuery);
25470
- if( SQLITE_OK==lrc ){
25471
- if( SQLITE_ROW==sqlite3_step(pCheckStmt) ){
25472
- double countIrreversible = sqlite3_column_double(pCheckStmt, 0);
25473
- if( countIrreversible>0 ){
25474
- int sz = (int)(countIrreversible + 0.5);
25475
- utf8_printf(stderr,
25476
- "Digest includes %d invalidly encoded text field%s.\n",
25477
- sz, (sz>1)? "s": "");
25478
- }
25479
- }
25480
- sqlite3_finalize(pCheckStmt);
25481
- }
25482
- sqlite3_finalize(pStmt);
25483
- }
25863
+ if( lrc!=SQLITE_OK ){
25864
+ /* assert(lrc==SQLITE_NOMEM); // might also be SQLITE_ERROR if the
25865
+ ** user does cruel and unnatural things like ".limit expr_depth 0". */
25866
+ rc = 1;
25867
+ }else{
25868
+ if( zLike ) sqlite3_bind_text(pStmt,1,zLike,-1,SQLITE_STATIC);
25869
+ lrc = SQLITE_ROW==sqlite3_step(pStmt);
25870
+ if( lrc ){
25871
+ const char *zGenQuery = (char*)sqlite3_column_text(pStmt,0);
25872
+ sqlite3_stmt *pCheckStmt;
25873
+ lrc = sqlite3_prepare_v2(p->db, zGenQuery, -1, &pCheckStmt, 0);
25874
+ if( bDebug ) utf8_printf(p->out, "%s\n", zGenQuery);
25875
+ if( lrc!=SQLITE_OK ){
25876
+ rc = 1;
25877
+ }else{
25878
+ if( SQLITE_ROW==sqlite3_step(pCheckStmt) ){
25879
+ double countIrreversible = sqlite3_column_double(pCheckStmt, 0);
25880
+ if( countIrreversible>0 ){
25881
+ int sz = (int)(countIrreversible + 0.5);
25882
+ utf8_printf(stderr,
25883
+ "Digest includes %d invalidly encoded text field%s.\n",
25884
+ sz, (sz>1)? "s": "");
25885
+ }
25886
+ }
25887
+ sqlite3_finalize(pCheckStmt);
25888
+ }
25889
+ sqlite3_finalize(pStmt);
25890
+ }
25891
+ }
25892
+ if( rc ) utf8_printf(stderr, ".sha3sum failed.\n");
2548425893
sqlite3_free(zRevText);
2548525894
}
2548625895
#endif /* !defined(*_OMIT_SCHEMA_PRAGMAS) && !defined(*_OMIT_VIRTUALTABLE) */
2548725896
sqlite3_free(zSql);
2548825897
}else
@@ -25741,10 +26150,16 @@
2574126150
int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
2574226151
int isOk = 0;
2574326152
int i, n2;
2574426153
const char *zCmd = 0;
2574526154
26155
+ if( !ShellHasFlag(p,SHFLG_TestingMode) ){
26156
+ utf8_printf(stderr, ".%s unavailable without --unsafe-testing\n",
26157
+ "testctrl");
26158
+ rc = 1;
26159
+ goto meta_command_exit;
26160
+ }
2574626161
open_db(p, 0);
2574726162
zCmd = nArg>=2 ? azArg[1] : "help";
2574826163
2574926164
/* The argument can optionally begin with "-" or "--" */
2575026165
if( zCmd[0]=='-' && zCmd[1] ){
@@ -26740,10 +27155,14 @@
2674027155
" -sorterref SIZE sorter references threshold size\n"
2674127156
#endif
2674227157
" -stats print memory stats before each finalize\n"
2674327158
" -table set output mode to 'table'\n"
2674427159
" -tabs set output mode to 'tabs'\n"
27160
+ " -unsafe-testing allow unsafe commands and modes for testing\n"
27161
+#if SHELL_WIN_UTF8_OPT
27162
+ " -utf8 setup interactive console code page for UTF-8\n"
27163
+#endif
2674527164
" -version show SQLite version\n"
2674627165
" -vfs NAME use NAME as the default VFS\n"
2674727166
#ifdef SQLITE_ENABLE_VFSTRACE
2674827167
" -vfstrace enable tracing of all VFS calls\n"
2674927168
#endif
@@ -26831,10 +27250,14 @@
2683127250
argv[0], argv[argc-1]);
2683227251
exit(1);
2683327252
}
2683427253
return argv[i];
2683527254
}
27255
+
27256
+static void sayAbnormalExit(void){
27257
+ if( seenInterrupt ) fprintf(stderr, "Program interrupted.\n");
27258
+}
2683627259
2683727260
#ifndef SQLITE_SHELL_IS_UTF8
2683827261
# if (defined(_WIN32) || defined(WIN32)) \
2683927262
&& (defined(_MSC_VER) || (defined(UNICODE) && defined(__GNUC__)))
2684027263
# define SQLITE_SHELL_IS_UTF8 (0)
@@ -26852,11 +27275,11 @@
2685227275
#else
2685327276
int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
2685427277
char **argv;
2685527278
#endif
2685627279
#ifdef SQLITE_DEBUG
26857
- sqlite3_int64 mem_main_enter = sqlite3_memory_used();
27280
+ sqlite3_int64 mem_main_enter = 0;
2685827281
#endif
2685927282
char *zErrMsg = 0;
2686027283
#ifdef SQLITE_SHELL_FIDDLE
2686127284
# define data shellState
2686227285
#else
@@ -26873,22 +27296,27 @@
2687327296
const char *zVfs = 0; /* Value of -vfs command-line option */
2687427297
#if !SQLITE_SHELL_IS_UTF8
2687527298
char **argvToFree = 0;
2687627299
int argcToFree = 0;
2687727300
#endif
26878
-
26879
- setBinaryMode(stdin, 0);
2688027301
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
27302
+
2688127303
#ifdef SQLITE_SHELL_FIDDLE
2688227304
stdin_is_interactive = 0;
2688327305
stdout_is_console = 1;
2688427306
data.wasm.zDefaultDbName = "/fiddle.sqlite3";
2688527307
#else
2688627308
stdin_is_interactive = isatty(0);
2688727309
stdout_is_console = isatty(1);
2688827310
#endif
26889
-
27311
+#if SHELL_WIN_UTF8_OPT
27312
+ atexit(console_restore); /* Needs revision for CLI as library call */
27313
+#endif
27314
+ atexit(sayAbnormalExit);
27315
+#ifdef SQLITE_DEBUG
27316
+ mem_main_enter = sqlite3_memory_used();
27317
+#endif
2689027318
#if !defined(_WIN32_WCE)
2689127319
if( getenv("SQLITE_DEBUG_BREAK") ){
2689227320
if( isatty(0) && isatty(2) ){
2689327321
fprintf(stderr,
2689427322
"attach debugger to process %d and press any key to continue.\n",
@@ -26904,10 +27332,18 @@
2690427332
#elif defined(SIGTRAP)
2690527333
raise(SIGTRAP);
2690627334
#endif
2690727335
}
2690827336
}
27337
+#endif
27338
+ /* Register a valid signal handler early, before much else is done. */
27339
+#ifdef SIGINT
27340
+ signal(SIGINT, interrupt_handler);
27341
+#elif (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE)
27342
+ if( !SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE) ){
27343
+ fprintf(stderr, "No ^C handler.\n");
27344
+ }
2690927345
#endif
2691027346
2691127347
#if USE_SYSTEM_SQLITE+0!=1
2691227348
if( cli_strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,60)!=0 ){
2691327349
utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
@@ -26944,19 +27380,10 @@
2694427380
#endif
2694527381
2694627382
assert( argc>=1 && argv && argv[0] );
2694727383
Argv0 = argv[0];
2694827384
26949
- /* Make sure we have a valid signal handler early, before anything
26950
- ** else is done.
26951
- */
26952
-#ifdef SIGINT
26953
- signal(SIGINT, interrupt_handler);
26954
-#elif (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE)
26955
- SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE);
26956
-#endif
26957
-
2695827385
#ifdef SQLITE_SHELL_DBNAME_PROC
2695927386
{
2696027387
/* If the SQLITE_SHELL_DBNAME_PROC macro is defined, then it is the name
2696127388
** of a C-function that will provide the name of the database file. Use
2696227389
** this compile-time option to embed this shell program in larger
@@ -27109,10 +27536,12 @@
2710927536
}else if( cli_strcmp(z,"-bail")==0 ){
2711027537
bail_on_error = 1;
2711127538
}else if( cli_strcmp(z,"-nonce")==0 ){
2711227539
free(data.zNonce);
2711327540
data.zNonce = strdup(argv[++i]);
27541
+ }else if( cli_strcmp(z,"-unsafe-testing")==0 ){
27542
+ ShellSetFlag(&data,SHFLG_TestingMode);
2711427543
}else if( cli_strcmp(z,"-safe")==0 ){
2711527544
/* no-op - catch this on the second pass */
2711627545
}
2711727546
}
2711827547
#ifndef SQLITE_SHELL_FIDDLE
@@ -27271,10 +27700,14 @@
2727127700
return 0;
2727227701
}else if( cli_strcmp(z,"-interactive")==0 ){
2727327702
stdin_is_interactive = 1;
2727427703
}else if( cli_strcmp(z,"-batch")==0 ){
2727527704
stdin_is_interactive = 0;
27705
+ }else if( cli_strcmp(z,"-utf8")==0 ){
27706
+#if SHELL_WIN_UTF8_OPT
27707
+ console_utf8 = 1;
27708
+#endif /* SHELL_WIN_UTF8_OPT */
2727627709
}else if( cli_strcmp(z,"-heap")==0 ){
2727727710
i++;
2727827711
}else if( cli_strcmp(z,"-pagecache")==0 ){
2727927712
i+=2;
2728027713
}else if( cli_strcmp(z,"-lookaside")==0 ){
@@ -27341,17 +27774,27 @@
2734127774
readStdin = 0;
2734227775
break;
2734327776
#endif
2734427777
}else if( cli_strcmp(z,"-safe")==0 ){
2734527778
data.bSafeMode = data.bSafeModePersist = 1;
27779
+ }else if( cli_strcmp(z,"-unsafe-testing")==0 ){
27780
+ /* Acted upon in first pass. */
2734627781
}else{
2734727782
utf8_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
2734827783
raw_printf(stderr,"Use -help for a list of options.\n");
2734927784
return 1;
2735027785
}
2735127786
data.cMode = data.mode;
2735227787
}
27788
+#if SHELL_WIN_UTF8_OPT
27789
+ if( console_utf8 && stdin_is_interactive ){
27790
+ console_prepare();
27791
+ }else{
27792
+ setBinaryMode(stdin, 0);
27793
+ console_utf8 = 0;
27794
+ }
27795
+#endif
2735327796
2735427797
if( !readStdin ){
2735527798
/* Run all arguments that do not begin with '-' as if they were separate
2735627799
** command-line inputs, except for the argToSkip argument which contains
2735727800
** the database filename.
2735827801
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -244,10 +244,11 @@
244
245 #if defined(_WIN32) || defined(WIN32)
246 #if SQLITE_OS_WINRT
247 #include <intrin.h>
248 #endif
 
249 #include <windows.h>
250
251 /* string conversion routines only needed on Win32 */
252 extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
253 extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
@@ -458,14 +459,28 @@
458 ** at an error if we are not interactive.
459 */
460 static int bail_on_error = 0;
461
462 /*
463 ** Threat stdin as an interactive input if the following variable
464 ** is true. Otherwise, assume stdin is connected to a file or pipe.
465 */
466 static int stdin_is_interactive = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
468 /*
469 ** On Windows systems we have to know if standard output is a console
470 ** in order to translate UTF-8 into MBCS. The following variable is
471 ** true if translation is required.
@@ -595,20 +610,154 @@
595 }
596 return dynPrompt.dynamicPrompt;
597 }
598 #endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */
599
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
600 /*
601 ** Render output like fprintf(). Except, if the output is going to the
602 ** console and if this is running on a Windows machine, translate the
603 ** output from UTF-8 into MBCS.
 
 
604 */
605 #if defined(_WIN32) || defined(WIN32)
606 void utf8_printf(FILE *out, const char *zFormat, ...){
607 va_list ap;
608 va_start(ap, zFormat);
609 if( stdout_is_console && (out==stdout || out==stderr) ){
 
 
 
 
610 char *z1 = sqlite3_vmprintf(zFormat, ap);
611 char *z2 = sqlite3_win32_utf8_to_mbcs_v2(z1, 0);
612 sqlite3_free(z1);
613 fputs(z2, out);
614 sqlite3_free(z2);
@@ -636,11 +785,11 @@
636 }
637
638 /* Check a pointer to see if it is NULL. If it is NULL, exit with an
639 ** out-of-memory error.
640 */
641 static void shell_check_oom(void *p){
642 if( p==0 ) shell_out_of_memory();
643 }
644
645 /*
646 ** Write I/O traces to the following stream.
@@ -815,13 +964,18 @@
815 zLine[n] = 0;
816 break;
817 }
818 }
819 #if defined(_WIN32) || defined(WIN32)
820 /* For interactive input on Windows systems, translate the
821 ** multi-byte characterset characters into UTF-8. */
822 if( stdin_is_interactive && in==stdin ){
 
 
 
 
 
823 char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
824 if( zTrans ){
825 i64 nTrans = strlen(zTrans)+1;
826 if( nTrans>nLine ){
827 zLine = realloc(zLine, nTrans);
@@ -858,14 +1012,25 @@
858 }else{
859 zPrompt = isContinuation ? CONTINUATION_PROMPT : mainPrompt;
860 #if SHELL_USE_LOCAL_GETLINE
861 printf("%s", zPrompt);
862 fflush(stdout);
863 zResult = local_getline(zPrior, stdin);
 
 
 
 
 
864 #else
865 free(zPrior);
866 zResult = shell_readline(zPrompt);
 
 
 
 
 
 
867 if( zResult && *zResult ) shell_add_history(zResult);
868 #endif
869 }
870 return zResult;
871 }
@@ -1001,10 +1166,11 @@
1001 **
1002 ** Return '"' if quoting is required. Return 0 if no quoting is required.
1003 */
1004 static char quoteChar(const char *zName){
1005 int i;
 
1006 if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
1007 for(i=0; zName[i]; i++){
1008 if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
1009 }
1010 return sqlite3_keyword_check(zName, i) ? '"' : 0;
@@ -1644,11 +1810,12 @@
1644 ** May you find forgiveness for yourself and forgive others.
1645 ** May you share freely, never taking more than you give.
1646 **
1647 ******************************************************************************
1648 **
1649 ** This SQLite extension implements functions that compute SHA3 hashes.
 
1650 ** Two SQL functions are implemented:
1651 **
1652 ** sha3(X,SIZE)
1653 ** sha3_query(Y,SIZE)
1654 **
@@ -3244,22 +3411,22 @@
3244 *pOut = 0;
3245 return pOut;
3246 }
3247
3248 /* Skip over text which is not base64 numeral(s). */
3249 static char * skipNonB64( char *s ){
3250 char c;
3251 while( (c = *s) && !IS_BX_DIGIT(BX_DV_PROTO(c)) ) ++s;
3252 return s;
3253 }
3254
3255 /* Decode base64 text into a byte buffer. */
3256 static u8* fromBase64( char *pIn, int ncIn, u8 *pOut ){
3257 if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
3258 while( ncIn>0 && *pIn!=PAD_CHAR ){
3259 static signed char nboi[] = { 0, 0, 1, 2, 3 };
3260 char *pUse = skipNonB64(pIn);
3261 unsigned long qv = 0L;
3262 int nti, nbo, nac;
3263 ncIn -= (pUse - pIn);
3264 pIn = pUse;
3265 nti = (ncIn>4)? 4 : ncIn;
@@ -3314,14 +3481,21 @@
3314 nc = 4*(nv+2/3); /* quads needed */
3315 nc += (nc+(B64_DARK_MAX-1))/B64_DARK_MAX + 1; /* LFs and a 0-terminator */
3316 if( nvMax < nc ){
3317 sqlite3_result_error(context, "blob expanded to base64 too big", -1);
3318 return;
 
 
 
 
 
 
 
 
3319 }
3320 cBuf = sqlite3_malloc(nc);
3321 if( !cBuf ) goto memFail;
3322 bBuf = (u8*)sqlite3_value_blob(av[0]);
3323 nc = (int)(toBase64(bBuf, nb, cBuf) - cBuf);
3324 sqlite3_result_text(context, cBuf, nc, sqlite3_free);
3325 break;
3326 case SQLITE_TEXT:
3327 nc = nv;
@@ -3329,14 +3503,21 @@
3329 if( nvMax < nb ){
3330 sqlite3_result_error(context, "blob from base64 may be too big", -1);
3331 return;
3332 }else if( nb<1 ){
3333 nb = 1;
 
 
 
 
 
 
 
 
3334 }
3335 bBuf = sqlite3_malloc(nb);
3336 if( !bBuf ) goto memFail;
3337 cBuf = (char *)sqlite3_value_text(av[0]);
3338 nb = (int)(fromBase64(cBuf, nc, bBuf) - bBuf);
3339 sqlite3_result_blob(context, bBuf, nb, sqlite3_free);
3340 break;
3341 default:
3342 sqlite3_result_error(context, "base64 accepts only blob or text", -1);
@@ -3520,13 +3701,13 @@
3520
3521 /* Width of base64 lines. Should be an integer multiple of 5. */
3522 #define B85_DARK_MAX 80
3523
3524
3525 static char * skipNonB85( char *s ){
3526 char c;
3527 while( (c = *s) && !IS_B85(c) ) ++s;
3528 return s;
3529 }
3530
3531 /* Convert small integer, known to be in 0..84 inclusive, to base85 numeral.
3532 * Do not use the macro form with argument expression having a side-effect.*/
@@ -3592,11 +3773,11 @@
3592 /* Decode base85 text into a byte buffer. */
3593 static u8* fromBase85( char *pIn, int ncIn, u8 *pOut ){
3594 if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
3595 while( ncIn>0 ){
3596 static signed char nboi[] = { 0, 0, 1, 2, 3, 4 };
3597 char *pUse = skipNonB85(pIn);
3598 unsigned long qv = 0L;
3599 int nti, nbo;
3600 ncIn -= (pUse - pIn);
3601 pIn = pUse;
3602 nti = (ncIn>5)? 5 : ncIn;
@@ -3676,14 +3857,21 @@
3676 /* ulongs tail newlines tailenc+nul*/
3677 nc = 5*(nv/4) + nv%4 + nv/64+1 + 2;
3678 if( nvMax < nc ){
3679 sqlite3_result_error(context, "blob expanded to base85 too big", -1);
3680 return;
 
 
 
 
 
 
 
 
3681 }
3682 cBuf = sqlite3_malloc(nc);
3683 if( !cBuf ) goto memFail;
3684 bBuf = (u8*)sqlite3_value_blob(av[0]);
3685 nc = (int)(toBase85(bBuf, nb, cBuf, "\n") - cBuf);
3686 sqlite3_result_text(context, cBuf, nc, sqlite3_free);
3687 break;
3688 case SQLITE_TEXT:
3689 nc = nv;
@@ -3691,14 +3879,21 @@
3691 if( nvMax < nb ){
3692 sqlite3_result_error(context, "blob from base85 may be too big", -1);
3693 return;
3694 }else if( nb<1 ){
3695 nb = 1;
 
 
 
 
 
 
 
 
3696 }
3697 bBuf = sqlite3_malloc(nb);
3698 if( !bBuf ) goto memFail;
3699 cBuf = (char *)sqlite3_value_text(av[0]);
3700 nb = (int)(fromBase85(cBuf, nc, bBuf) - bBuf);
3701 sqlite3_result_blob(context, bBuf, nb, sqlite3_free);
3702 break;
3703 default:
3704 sqlite3_result_error(context, "base85 accepts only blob or text.", -1);
@@ -4114,11 +4309,11 @@
4114 }
4115
4116 /************************* End ../ext/misc/ieee754.c ********************/
4117 /************************* Begin ../ext/misc/series.c ******************/
4118 /*
4119 ** 2015-08-18
4120 **
4121 ** The author disclaims copyright to this source code. In place of
4122 ** a legal notice, here is a blessing:
4123 **
4124 ** May you do good and not evil.
@@ -4127,11 +4322,23 @@
4127 **
4128 *************************************************************************
4129 **
4130 ** This file demonstrates how to create a table-valued-function using
4131 ** a virtual table. This demo implements the generate_series() function
4132 ** which gives similar results to the eponymous function in PostgreSQL.
 
 
 
 
 
 
 
 
 
 
 
 
4133 ** Examples:
4134 **
4135 ** SELECT * FROM generate_series(0,100,5);
4136 **
4137 ** The query above returns integers from 0 through 100 counting by steps
@@ -4143,10 +4350,18 @@
4143 **
4144 ** SELECT * FROM generate_series(20) LIMIT 10;
4145 **
4146 ** Integers 20 through 29.
4147 **
 
 
 
 
 
 
 
 
4148 ** HOW IT WORKS
4149 **
4150 ** The generate_series "function" is really a virtual table with the
4151 ** following schema:
4152 **
@@ -4154,10 +4369,13 @@
4154 ** value,
4155 ** start HIDDEN,
4156 ** stop HIDDEN,
4157 ** step HIDDEN
4158 ** );
 
 
 
4159 **
4160 ** Function arguments in queries against this virtual table are translated
4161 ** into equality constraints against successive hidden columns. In other
4162 ** words, the following pairs of queries are equivalent to each other:
4163 **
@@ -4187,27 +4405,139 @@
4187 */
4188 /* #include "sqlite3ext.h" */
4189 SQLITE_EXTENSION_INIT1
4190 #include <assert.h>
4191 #include <string.h>
 
4192
4193 #ifndef SQLITE_OMIT_VIRTUALTABLE
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4195
4196 /* series_cursor is a subclass of sqlite3_vtab_cursor which will
4197 ** serve as the underlying representation of a cursor that scans
4198 ** over rows of the result
4199 */
4200 typedef struct series_cursor series_cursor;
4201 struct series_cursor {
4202 sqlite3_vtab_cursor base; /* Base class - must be first */
4203 int isDesc; /* True to count down rather than up */
4204 sqlite3_int64 iRowid; /* The rowid */
4205 sqlite3_int64 iValue; /* Current value ("value") */
4206 sqlite3_int64 mnValue; /* Mimimum value ("start") */
4207 sqlite3_int64 mxValue; /* Maximum value ("stop") */
4208 sqlite3_int64 iStep; /* Increment ("step") */
4209 };
4210
4211 /*
4212 ** The seriesConnect() method is invoked to create a new
4213 ** series_vtab that describes the generate_series virtual table.
@@ -4285,16 +4615,11 @@
4285 /*
4286 ** Advance a series_cursor to its next row of output.
4287 */
4288 static int seriesNext(sqlite3_vtab_cursor *cur){
4289 series_cursor *pCur = (series_cursor*)cur;
4290 if( pCur->isDesc ){
4291 pCur->iValue -= pCur->iStep;
4292 }else{
4293 pCur->iValue += pCur->iStep;
4294 }
4295 pCur->iRowid++;
4296 return SQLITE_OK;
4297 }
4298
4299 /*
4300 ** Return values of columns for the row at which the series_cursor
@@ -4306,44 +4631,40 @@
4306 int i /* Which column to return */
4307 ){
4308 series_cursor *pCur = (series_cursor*)cur;
4309 sqlite3_int64 x = 0;
4310 switch( i ){
4311 case SERIES_COLUMN_START: x = pCur->mnValue; break;
4312 case SERIES_COLUMN_STOP: x = pCur->mxValue; break;
4313 case SERIES_COLUMN_STEP: x = pCur->iStep; break;
4314 default: x = pCur->iValue; break;
4315 }
4316 sqlite3_result_int64(ctx, x);
4317 return SQLITE_OK;
4318 }
4319
4320 /*
4321 ** Return the rowid for the current row. In this implementation, the
4322 ** first row returned is assigned rowid value 1, and each subsequent
4323 ** row a value 1 more than that of the previous.
4324 */
4325 static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
4326 series_cursor *pCur = (series_cursor*)cur;
4327 *pRowid = pCur->iRowid;
 
4328 return SQLITE_OK;
4329 }
4330
4331 /*
4332 ** Return TRUE if the cursor has been moved off of the last
4333 ** row of output.
4334 */
4335 static int seriesEof(sqlite3_vtab_cursor *cur){
4336 series_cursor *pCur = (series_cursor*)cur;
4337 if( pCur->isDesc ){
4338 return pCur->iValue < pCur->mnValue;
4339 }else{
4340 return pCur->iValue > pCur->mxValue;
4341 }
4342 }
4343
4344 /* True to cause run-time checking of the start=, stop=, and/or step=
4345 ** parameters. The only reason to do this is for testing the
4346 ** constraint checking logic for virtual tables in the SQLite core.
4347 */
4348 #ifndef SQLITE_SERIES_CONSTRAINT_VERIFY
4349 # define SQLITE_SERIES_CONSTRAINT_VERIFY 0
@@ -4350,11 +4671,11 @@
4350 #endif
4351
4352 /*
4353 ** This method is called to "rewind" the series_cursor object back
4354 ** to the first row of output. This method is always called at least
4355 ** once prior to any call to seriesColumn() or seriesRowid() or
4356 ** seriesEof().
4357 **
4358 ** The query plan selected by seriesBestIndex is passed in the idxNum
4359 ** parameter. (idxStr is not used in this implementation.) idxNum
4360 ** is a bitmask showing which constraints are available:
@@ -4370,58 +4691,53 @@
4370 ** This routine should initialize the cursor and position it so that it
4371 ** is pointing at the first row, or pointing off the end of the table
4372 ** (so that seriesEof() will return true) if the table is empty.
4373 */
4374 static int seriesFilter(
4375 sqlite3_vtab_cursor *pVtabCursor,
4376 int idxNum, const char *idxStrUnused,
4377 int argc, sqlite3_value **argv
4378 ){
4379 series_cursor *pCur = (series_cursor *)pVtabCursor;
4380 int i = 0;
4381 (void)idxStrUnused;
4382 if( idxNum & 1 ){
4383 pCur->mnValue = sqlite3_value_int64(argv[i++]);
4384 }else{
4385 pCur->mnValue = 0;
4386 }
4387 if( idxNum & 2 ){
4388 pCur->mxValue = sqlite3_value_int64(argv[i++]);
4389 }else{
4390 pCur->mxValue = 0xffffffff;
4391 }
4392 if( idxNum & 4 ){
4393 pCur->iStep = sqlite3_value_int64(argv[i++]);
4394 if( pCur->iStep==0 ){
4395 pCur->iStep = 1;
4396 }else if( pCur->iStep<0 ){
4397 pCur->iStep = -pCur->iStep;
4398 if( (idxNum & 16)==0 ) idxNum |= 8;
4399 }
4400 }else{
4401 pCur->iStep = 1;
4402 }
4403 for(i=0; i<argc; i++){
4404 if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
4405 /* If any of the constraints have a NULL value, then return no rows.
4406 ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
4407 pCur->mnValue = 1;
4408 pCur->mxValue = 0;
 
4409 break;
4410 }
4411 }
4412 if( idxNum & 8 ){
4413 pCur->isDesc = 1;
4414 pCur->iValue = pCur->mxValue;
4415 if( pCur->iStep>0 ){
4416 pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
4417 }
4418 }else{
4419 pCur->isDesc = 0;
4420 pCur->iValue = pCur->mnValue;
4421 }
4422 pCur->iRowid = 1;
4423 return SQLITE_OK;
4424 }
4425
4426 /*
4427 ** SQLite will invoke this method one or more times while planning a query
@@ -5172,11 +5488,11 @@
5172 re_append(p, RE_OP_FORK, -sz);
5173 }
5174 break;
5175 }
5176 case '[': {
5177 int iFirst = p->nState;
5178 if( rePeek(p)=='^' ){
5179 re_append(p, RE_OP_CC_EXC, 0);
5180 p->sIn.i++;
5181 }else{
5182 re_append(p, RE_OP_CC_INC, 0);
@@ -5196,11 +5512,11 @@
5196 re_append(p, RE_OP_CC_VALUE, c);
5197 }
5198 if( rePeek(p)==']' ){ p->sIn.i++; break; }
5199 }
5200 if( c==0 ) return "unclosed '['";
5201 p->aArg[iFirst] = p->nState - iFirst;
5202 break;
5203 }
5204 case '\\': {
5205 int specialOp = 0;
5206 switch( rePeek(p) ){
@@ -9213,13 +9529,23 @@
9213 ** Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
9214 ** linked list. Remove it from the list and free the object.
9215 */
9216 static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
9217 if( pOld ){
9218 ZipfileEntry **pp;
9219 for(pp=&pTab->pFirstEntry; (*pp)!=pOld; pp=&((*pp)->pNext));
9220 *pp = (*pp)->pNext;
 
 
 
 
 
 
 
 
 
 
9221 zipfileEntryFree(pOld);
9222 }
9223 }
9224
9225 /*
@@ -12510,10 +12836,11 @@
12510 #endif
12511
12512 #endif /* ifndef _SQLITE_RECOVER_H */
12513
12514 /************************* End ../ext/recover/sqlite3recover.h ********************/
 
12515 /************************* Begin ../ext/recover/dbdata.c ******************/
12516 /*
12517 ** 2019-04-17
12518 **
12519 ** The author disclaims copyright to this source code. In place of
@@ -14576,11 +14903,11 @@
14576 pStmt = recoverPreparePrintf(p, p->dbOut, "PRAGMA index_xinfo(%Q)", zName);
14577 while( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
14578 int iField = sqlite3_column_int(pStmt, 0);
14579 int iCol = sqlite3_column_int(pStmt, 1);
14580
14581 assert( iField<pNew->nCol && iCol<pNew->nCol );
14582 pNew->aCol[iCol].iField = iField;
14583
14584 pNew->bIntkey = 0;
14585 iPk = -2;
14586 }
@@ -16340,10 +16667,11 @@
16340 }
16341
16342 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
16343
16344 /************************* End ../ext/recover/sqlite3recover.c ********************/
 
16345 #endif
16346 #ifdef SQLITE_SHELL_EXTSRC
16347 # include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
16348 #endif
16349
@@ -16521,10 +16849,11 @@
16521 #define SHFLG_CountChanges 0x00000020 /* .changes setting */
16522 #define SHFLG_Echo 0x00000040 /* .echo on/off, or --echo setting */
16523 #define SHFLG_HeaderSet 0x00000080 /* showHeader has been specified */
16524 #define SHFLG_DumpDataOnly 0x00000100 /* .dump show data only */
16525 #define SHFLG_DumpNoSys 0x00000200 /* .dump omits system tables */
 
16526
16527 /*
16528 ** Macros for testing and setting shellFlgs
16529 */
16530 #define ShellHasFlag(P,X) (((P)->shellFlgs & (X))!=0)
@@ -16764,10 +17093,11 @@
16764 if( hasCRNL ){
16765 /* If the original contains \r\n then do no conversions back to \n */
16766 }else{
16767 /* If the file did not originally contain \r\n then convert any new
16768 ** \r\n back into \n */
 
16769 for(i=j=0; i<sz; i++){
16770 if( p[i]=='\r' && p[i+1]=='\n' ) i++;
16771 p[j++] = p[i];
16772 }
16773 sz = j;
@@ -16854,10 +17184,11 @@
16854 */
16855 static void output_quoted_string(FILE *out, const char *z){
16856 int i;
16857 char c;
16858 setBinaryMode(out, 1);
 
16859 for(i=0; (c = z[i])!=0 && c!='\''; i++){}
16860 if( c==0 ){
16861 utf8_printf(out,"'%s'",z);
16862 }else{
16863 raw_printf(out, "'");
@@ -16983,10 +17314,11 @@
16983 /*
16984 ** Output the given string as a quoted according to JSON quoting rules.
16985 */
16986 static void output_json_string(FILE *out, const char *z, i64 n){
16987 unsigned int c;
 
16988 if( n<0 ) n = strlen(z);
16989 fputc('"', out);
16990 while( n-- ){
16991 c = *(z++);
16992 if( c=='\\' || c=='"' ){
@@ -17107,12 +17439,11 @@
17107 /*
17108 ** This routine runs when the user presses Ctrl-C
17109 */
17110 static void interrupt_handler(int NotUsed){
17111 UNUSED_PARAMETER(NotUsed);
17112 seenInterrupt++;
17113 if( seenInterrupt>2 ) exit(1);
17114 if( globalDb ) sqlite3_interrupt(globalDb);
17115 }
17116
17117 #if (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE)
17118 /*
@@ -18559,14 +18890,18 @@
18559 zVar = zNum;
18560 }
18561 sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18562 if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
18563 sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
 
18564 }else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
18565 sqlite3_bind_double(pStmt, i, NAN);
 
 
18566 }else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
18567 sqlite3_bind_double(pStmt, i, INFINITY);
 
18568 }else{
18569 sqlite3_bind_null(pStmt, i);
18570 }
18571 sqlite3_reset(pQ);
18572 }
@@ -18806,11 +19141,11 @@
18806 nAlloc = nColumn*4;
18807 if( nAlloc<=0 ) nAlloc = 1;
18808 azData = sqlite3_malloc64( nAlloc*sizeof(char*) );
18809 shell_check_oom(azData);
18810 azNextLine = sqlite3_malloc64( nColumn*sizeof(char*) );
18811 shell_check_oom((void*)azNextLine);
18812 memset((void*)azNextLine, 0, nColumn*sizeof(char*) );
18813 if( p->cmOpts.bQuote ){
18814 azQuoted = sqlite3_malloc64( nColumn*sizeof(char*) );
18815 shell_check_oom(azQuoted);
18816 memset(azQuoted, 0, nColumn*sizeof(char*) );
@@ -18836,10 +19171,11 @@
18836 if( wx==0 ){
18837 wx = p->cmOpts.iWrap;
18838 }
18839 if( wx<0 ) wx = -wx;
18840 uz = (const unsigned char*)sqlite3_column_name(pStmt,i);
 
18841 azData[i] = translateForDisplayAndDup(uz, &zNotUsed, wx, bw);
18842 }
18843 do{
18844 int useNextLine = bNextLine;
18845 bNextLine = 0;
@@ -19769,17 +20105,17 @@
19769 " from the \".mode\" output mode",
19770 " * If FILE begins with \"|\" then it is a command that generates the",
19771 " input text.",
19772 #endif
19773 #ifndef SQLITE_OMIT_TEST_CONTROL
19774 ".imposter INDEX TABLE Create imposter table TABLE on index INDEX",
19775 #endif
19776 ".indexes ?TABLE? Show names of indexes",
19777 " If TABLE is specified, only show indexes for",
19778 " tables matching TABLE using the LIKE operator.",
19779 #ifdef SQLITE_ENABLE_IOTRACE
19780 ".iotrace FILE Enable I/O diagnostic logging to FILE",
19781 #endif
19782 ".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT",
19783 ".lint OPTIONS Report potential schema issues.",
19784 " Options:",
19785 " fkey-indexes Find missing foreign key indexes",
@@ -19884,11 +20220,11 @@
19884 ".scanstats on|off|est Turn sqlite3_stmt_scanstatus() metrics on or off",
19885 ".schema ?PATTERN? Show the CREATE statements matching PATTERN",
19886 " Options:",
19887 " --indent Try to pretty-print the schema",
19888 " --nosys Omit objects whose names start with \"sqlite_\"",
19889 ".selftest ?OPTIONS? Run tests defined in the SELFTEST table",
19890 " Options:",
19891 " --init Create a new SELFTEST table",
19892 " -v Verbose output",
19893 ".separator COL ?ROW? Change the column and row separators",
19894 #if defined(SQLITE_ENABLE_SESSION)
@@ -19926,13 +20262,13 @@
19926 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
19927 ".system CMD ARGS... Run CMD ARGS... in a system shell",
19928 #endif
19929 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
19930 #ifndef SQLITE_SHELL_FIDDLE
19931 ".testcase NAME Begin redirecting output to 'testcase-out.txt'",
19932 #endif
19933 ".testctrl CMD ... Run various sqlite3_test_control() operations",
19934 " Run \".testctrl\" with no arguments for details",
19935 ".timeout MS Try opening locked tables for MS milliseconds",
19936 ".timer on|off Turn SQL timer on or off",
19937 #ifndef SQLITE_OMIT_TRACE
19938 ".trace ?OPTIONS? Output each SQL statement as it is run",
@@ -19980,20 +20316,45 @@
19980 || zPattern[0]=='0'
19981 || cli_strcmp(zPattern,"-a")==0
19982 || cli_strcmp(zPattern,"-all")==0
19983 || cli_strcmp(zPattern,"--all")==0
19984 ){
19985 /* Show all commands, but only one line per command */
19986 if( zPattern==0 ) zPattern = "";
 
 
 
 
 
 
 
 
 
 
19987 for(i=0; i<ArraySize(azHelp); i++){
19988 if( azHelp[i][0]=='.' || zPattern[0] ){
19989 utf8_printf(out, "%s\n", azHelp[i]);
19990 n++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19991 }
19992 }
19993 }else{
19994 /* Look for commands that for which zPattern is an exact prefix */
19995 zPat = sqlite3_mprintf(".%s*", zPattern);
19996 shell_check_oom(zPat);
19997 for(i=0; i<ArraySize(azHelp); i++){
19998 if( sqlite3_strglob(zPat, azHelp[i])==0 ){
19999 utf8_printf(out, "%s\n", azHelp[i]);
@@ -20002,28 +20363,32 @@
20002 }
20003 }
20004 sqlite3_free(zPat);
20005 if( n ){
20006 if( n==1 ){
20007 /* when zPattern is a prefix of exactly one command, then include the
20008 ** details of that command, which should begin at offset j */
20009 while( j<ArraySize(azHelp)-1 && azHelp[j][0]!='.' ){
20010 utf8_printf(out, "%s\n", azHelp[j]);
20011 j++;
20012 }
20013 }
20014 return n;
20015 }
20016 /* Look for commands that contain zPattern anywhere. Show the complete
20017 ** text of all commands that match. */
20018 zPat = sqlite3_mprintf("%%%s%%", zPattern);
20019 shell_check_oom(zPat);
20020 for(i=0; i<ArraySize(azHelp); i++){
 
 
 
 
20021 if( azHelp[i][0]=='.' ) j = i;
20022 if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){
20023 utf8_printf(out, "%s\n", azHelp[j]);
20024 while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]!='.' ){
20025 j++;
20026 utf8_printf(out, "%s\n", azHelp[j]);
20027 }
20028 i = j;
20029 n++;
@@ -20337,17 +20702,34 @@
20337 }
20338 globalDb = p->db;
20339 if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){
20340 utf8_printf(stderr,"Error: unable to open database \"%s\": %s\n",
20341 zDbFilename, sqlite3_errmsg(p->db));
20342 if( openFlags & OPEN_DB_KEEPALIVE ){
20343 sqlite3_open(":memory:", &p->db);
20344 return;
20345 }
20346 exit(1);
 
 
 
 
 
 
 
 
 
 
 
20347 }
20348 sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
 
 
 
 
 
 
 
20349
20350 #ifndef SQLITE_OMIT_LOAD_EXTENSION
20351 sqlite3_enable_load_extension(p->db, 1);
20352 #endif
20353 sqlite3_shathree_init(p->db, 0, 0);
@@ -20356,13 +20738,10 @@
20356 sqlite3_base64_init(p->db, 0, 0);
20357 sqlite3_base85_init(p->db, 0, 0);
20358 sqlite3_regexp_init(p->db, 0, 0);
20359 sqlite3_ieee_init(p->db, 0, 0);
20360 sqlite3_series_init(p->db, 0, 0);
20361 #if SQLITE_SHELL_HAVE_RECOVER
20362 sqlite3_dbdata_init(p->db, 0, 0);
20363 #endif
20364 #ifndef SQLITE_SHELL_FIDDLE
20365 sqlite3_fileio_init(p->db, 0, 0);
20366 sqlite3_completion_init(p->db, 0, 0);
20367 #endif
20368 #ifdef SQLITE_HAVE_ZLIB
@@ -20550,10 +20929,11 @@
20550 ** \s -> space
20551 ** \" -> "
20552 ** \' -> '
20553 ** \\ -> backslash
20554 ** \NNN -> ascii character NNN in octal
 
20555 */
20556 static void resolve_backslashes(char *z){
20557 int i, j;
20558 char c;
20559 while( *z && *z!='\\' ) z++;
@@ -20578,10 +20958,19 @@
20578 c = '"';
20579 }else if( c=='\'' ){
20580 c = '\'';
20581 }else if( c=='\\' ){
20582 c = '\\';
 
 
 
 
 
 
 
 
 
20583 }else if( c>='0' && c<='7' ){
20584 c -= '0';
20585 if( z[i+1]>='0' && z[i+1]<='7' ){
20586 i++;
20587 c = (c<<3) + z[i] - '0';
@@ -20677,11 +21066,11 @@
20677 if( p->traceOut==0 ) return 0;
20678 if( mType==SQLITE_TRACE_CLOSE ){
20679 utf8_printf(p->traceOut, "-- closing database connection\n");
20680 return 0;
20681 }
20682 if( mType!=SQLITE_TRACE_ROW && ((const char*)pX)[0]=='-' ){
20683 zSql = (const char*)pX;
20684 }else{
20685 pStmt = (sqlite3_stmt*)pP;
20686 switch( p->eTraceType ){
20687 case SHELL_TRACE_EXPANDED: {
@@ -20709,11 +21098,11 @@
20709 case SQLITE_TRACE_STMT: {
20710 utf8_printf(p->traceOut, "%.*s;\n", (int)nSql, zSql);
20711 break;
20712 }
20713 case SQLITE_TRACE_PROFILE: {
20714 sqlite3_int64 nNanosec = *(sqlite3_int64*)pX;
20715 utf8_printf(p->traceOut, "%.*s; -- %lld ns\n", (int)nSql, zSql, nNanosec);
20716 break;
20717 }
20718 }
20719 return 0;
@@ -20785,12 +21174,12 @@
20785 ** EOF on end-of-file.
20786 ** + Report syntax errors on stderr
20787 */
20788 static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
20789 int c;
20790 int cSep = p->cColSep;
20791 int rSep = p->cRowSep;
20792 p->n = 0;
20793 c = fgetc(p->in);
20794 if( c==EOF || seenInterrupt ){
20795 p->cTerm = EOF;
20796 return 0;
@@ -20875,12 +21264,12 @@
20875 ** EOF on end-of-file.
20876 ** + Report syntax errors on stderr
20877 */
20878 static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
20879 int c;
20880 int cSep = p->cColSep;
20881 int rSep = p->cRowSep;
20882 p->n = 0;
20883 c = fgetc(p->in);
20884 if( c==EOF || seenInterrupt ){
20885 p->cTerm = EOF;
20886 return 0;
@@ -21070,11 +21459,11 @@
21070 }
21071 while( sqlite3_step(pQuery)==SQLITE_ROW ){
21072 zName = sqlite3_column_text(pQuery, 0);
21073 zSql = sqlite3_column_text(pQuery, 1);
21074 if( zName==0 || zSql==0 ) continue;
21075 if( sqlite3_stricmp((char*)zName, "sqlite_sequence")!=0 ) continue;
21076 printf("%s... ", zName); fflush(stdout);
21077 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
21078 if( zErrMsg ){
21079 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
21080 sqlite3_free(zErrMsg);
@@ -21237,11 +21626,13 @@
21237 }
21238 sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
21239 if( sqlite3_step(pStmt)==SQLITE_ROW
21240 && sqlite3_column_bytes(pStmt,0)>100
21241 ){
21242 memcpy(aHdr, sqlite3_column_blob(pStmt,0), 100);
 
 
21243 sqlite3_finalize(pStmt);
21244 }else{
21245 raw_printf(stderr, "unable to read database header\n");
21246 sqlite3_finalize(pStmt);
21247 return 1;
@@ -22054,11 +22445,14 @@
22054 if( arProcessSwitch(pAr, pMatch->eSwitch, zArg) ) return SQLITE_ERROR;
22055 }
22056 }
22057 }
22058 }
22059
 
 
 
22060 return SQLITE_OK;
22061 }
22062
22063 /*
22064 ** This function assumes that all arguments within the ArCommand.azArg[]
@@ -22820,11 +23214,11 @@
22820 rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
22821 rc_err_oom_die(rc);
22822 sqlite3_bind_int(pStmt, 1, nDigits);
22823 rc = sqlite3_step(pStmt);
22824 sqlite3_finalize(pStmt);
22825 assert(rc==SQLITE_DONE);
22826 }
22827 assert(db_int(*pDb, zHasDupes)==0); /* Consider: remove this */
22828 rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
22829 rc_err_oom_die(rc);
22830 rc = sqlite3_step(pStmt);
@@ -23752,12 +24146,12 @@
23752 if( nSep>1 ){
23753 raw_printf(stderr, "Error: multi-character row separators not allowed"
23754 " for import\n");
23755 goto meta_command_exit;
23756 }
23757 sCtx.cColSep = p->colSeparator[0];
23758 sCtx.cRowSep = p->rowSeparator[0];
23759 }
23760 sCtx.zFile = zFile;
23761 sCtx.nLine = 1;
23762 if( sCtx.zFile[0]=='|' ){
23763 #ifdef SQLITE_OMIT_POPEN
@@ -23949,10 +24343,16 @@
23949 sqlite3_stmt *pStmt;
23950 int tnum = 0;
23951 int isWO = 0; /* True if making an imposter of a WITHOUT ROWID table */
23952 int lenPK = 0; /* Length of the PRIMARY KEY string for isWO tables */
23953 int i;
 
 
 
 
 
 
23954 if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){
23955 utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n"
23956 " .imposter off\n");
23957 /* Also allowed, but not documented:
23958 **
@@ -24133,11 +24533,12 @@
24133 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
24134 if( c=='l' && cli_strncmp(azArg[0], "load", n)==0 ){
24135 const char *zFile, *zProc;
24136 char *zErrMsg = 0;
24137 failIfSafeMode(p, "cannot run .load in safe mode");
24138 if( nArg<2 ){
 
24139 raw_printf(stderr, "Usage: .load FILE ?ENTRYPOINT?\n");
24140 rc = 1;
24141 goto meta_command_exit;
24142 }
24143 zFile = azArg[1];
@@ -25457,32 +25858,40 @@
25457 "' OR ') as query, tname from tabcols group by tname)"
25458 , zRevText);
25459 shell_check_oom(zRevText);
25460 if( bDebug ) utf8_printf(p->out, "%s\n", zRevText);
25461 lrc = sqlite3_prepare_v2(p->db, zRevText, -1, &pStmt, 0);
25462 assert(lrc==SQLITE_OK);
25463 if( zLike ) sqlite3_bind_text(pStmt,1,zLike,-1,SQLITE_STATIC);
25464 lrc = SQLITE_ROW==sqlite3_step(pStmt);
25465 if( lrc ){
25466 const char *zGenQuery = (char*)sqlite3_column_text(pStmt,0);
25467 sqlite3_stmt *pCheckStmt;
25468 lrc = sqlite3_prepare_v2(p->db, zGenQuery, -1, &pCheckStmt, 0);
25469 if( bDebug ) utf8_printf(p->out, "%s\n", zGenQuery);
25470 if( SQLITE_OK==lrc ){
25471 if( SQLITE_ROW==sqlite3_step(pCheckStmt) ){
25472 double countIrreversible = sqlite3_column_double(pCheckStmt, 0);
25473 if( countIrreversible>0 ){
25474 int sz = (int)(countIrreversible + 0.5);
25475 utf8_printf(stderr,
25476 "Digest includes %d invalidly encoded text field%s.\n",
25477 sz, (sz>1)? "s": "");
25478 }
25479 }
25480 sqlite3_finalize(pCheckStmt);
25481 }
25482 sqlite3_finalize(pStmt);
25483 }
 
 
 
 
 
 
 
 
25484 sqlite3_free(zRevText);
25485 }
25486 #endif /* !defined(*_OMIT_SCHEMA_PRAGMAS) && !defined(*_OMIT_VIRTUALTABLE) */
25487 sqlite3_free(zSql);
25488 }else
@@ -25741,10 +26150,16 @@
25741 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
25742 int isOk = 0;
25743 int i, n2;
25744 const char *zCmd = 0;
25745
 
 
 
 
 
 
25746 open_db(p, 0);
25747 zCmd = nArg>=2 ? azArg[1] : "help";
25748
25749 /* The argument can optionally begin with "-" or "--" */
25750 if( zCmd[0]=='-' && zCmd[1] ){
@@ -26740,10 +27155,14 @@
26740 " -sorterref SIZE sorter references threshold size\n"
26741 #endif
26742 " -stats print memory stats before each finalize\n"
26743 " -table set output mode to 'table'\n"
26744 " -tabs set output mode to 'tabs'\n"
 
 
 
 
26745 " -version show SQLite version\n"
26746 " -vfs NAME use NAME as the default VFS\n"
26747 #ifdef SQLITE_ENABLE_VFSTRACE
26748 " -vfstrace enable tracing of all VFS calls\n"
26749 #endif
@@ -26831,10 +27250,14 @@
26831 argv[0], argv[argc-1]);
26832 exit(1);
26833 }
26834 return argv[i];
26835 }
 
 
 
 
26836
26837 #ifndef SQLITE_SHELL_IS_UTF8
26838 # if (defined(_WIN32) || defined(WIN32)) \
26839 && (defined(_MSC_VER) || (defined(UNICODE) && defined(__GNUC__)))
26840 # define SQLITE_SHELL_IS_UTF8 (0)
@@ -26852,11 +27275,11 @@
26852 #else
26853 int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
26854 char **argv;
26855 #endif
26856 #ifdef SQLITE_DEBUG
26857 sqlite3_int64 mem_main_enter = sqlite3_memory_used();
26858 #endif
26859 char *zErrMsg = 0;
26860 #ifdef SQLITE_SHELL_FIDDLE
26861 # define data shellState
26862 #else
@@ -26873,22 +27296,27 @@
26873 const char *zVfs = 0; /* Value of -vfs command-line option */
26874 #if !SQLITE_SHELL_IS_UTF8
26875 char **argvToFree = 0;
26876 int argcToFree = 0;
26877 #endif
26878
26879 setBinaryMode(stdin, 0);
26880 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
 
26881 #ifdef SQLITE_SHELL_FIDDLE
26882 stdin_is_interactive = 0;
26883 stdout_is_console = 1;
26884 data.wasm.zDefaultDbName = "/fiddle.sqlite3";
26885 #else
26886 stdin_is_interactive = isatty(0);
26887 stdout_is_console = isatty(1);
26888 #endif
26889
 
 
 
 
 
 
26890 #if !defined(_WIN32_WCE)
26891 if( getenv("SQLITE_DEBUG_BREAK") ){
26892 if( isatty(0) && isatty(2) ){
26893 fprintf(stderr,
26894 "attach debugger to process %d and press any key to continue.\n",
@@ -26904,10 +27332,18 @@
26904 #elif defined(SIGTRAP)
26905 raise(SIGTRAP);
26906 #endif
26907 }
26908 }
 
 
 
 
 
 
 
 
26909 #endif
26910
26911 #if USE_SYSTEM_SQLITE+0!=1
26912 if( cli_strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,60)!=0 ){
26913 utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
@@ -26944,19 +27380,10 @@
26944 #endif
26945
26946 assert( argc>=1 && argv && argv[0] );
26947 Argv0 = argv[0];
26948
26949 /* Make sure we have a valid signal handler early, before anything
26950 ** else is done.
26951 */
26952 #ifdef SIGINT
26953 signal(SIGINT, interrupt_handler);
26954 #elif (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE)
26955 SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE);
26956 #endif
26957
26958 #ifdef SQLITE_SHELL_DBNAME_PROC
26959 {
26960 /* If the SQLITE_SHELL_DBNAME_PROC macro is defined, then it is the name
26961 ** of a C-function that will provide the name of the database file. Use
26962 ** this compile-time option to embed this shell program in larger
@@ -27109,10 +27536,12 @@
27109 }else if( cli_strcmp(z,"-bail")==0 ){
27110 bail_on_error = 1;
27111 }else if( cli_strcmp(z,"-nonce")==0 ){
27112 free(data.zNonce);
27113 data.zNonce = strdup(argv[++i]);
 
 
27114 }else if( cli_strcmp(z,"-safe")==0 ){
27115 /* no-op - catch this on the second pass */
27116 }
27117 }
27118 #ifndef SQLITE_SHELL_FIDDLE
@@ -27271,10 +27700,14 @@
27271 return 0;
27272 }else if( cli_strcmp(z,"-interactive")==0 ){
27273 stdin_is_interactive = 1;
27274 }else if( cli_strcmp(z,"-batch")==0 ){
27275 stdin_is_interactive = 0;
 
 
 
 
27276 }else if( cli_strcmp(z,"-heap")==0 ){
27277 i++;
27278 }else if( cli_strcmp(z,"-pagecache")==0 ){
27279 i+=2;
27280 }else if( cli_strcmp(z,"-lookaside")==0 ){
@@ -27341,17 +27774,27 @@
27341 readStdin = 0;
27342 break;
27343 #endif
27344 }else if( cli_strcmp(z,"-safe")==0 ){
27345 data.bSafeMode = data.bSafeModePersist = 1;
 
 
27346 }else{
27347 utf8_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
27348 raw_printf(stderr,"Use -help for a list of options.\n");
27349 return 1;
27350 }
27351 data.cMode = data.mode;
27352 }
 
 
 
 
 
 
 
 
27353
27354 if( !readStdin ){
27355 /* Run all arguments that do not begin with '-' as if they were separate
27356 ** command-line inputs, except for the argToSkip argument which contains
27357 ** the database filename.
27358
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -244,10 +244,11 @@
244
245 #if defined(_WIN32) || defined(WIN32)
246 #if SQLITE_OS_WINRT
247 #include <intrin.h>
248 #endif
249 #define WIN32_LEAN_AND_MEAN
250 #include <windows.h>
251
252 /* string conversion routines only needed on Win32 */
253 extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
254 extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
@@ -458,14 +459,28 @@
459 ** at an error if we are not interactive.
460 */
461 static int bail_on_error = 0;
462
463 /*
464 ** Treat stdin as an interactive input if the following variable
465 ** is true. Otherwise, assume stdin is connected to a file or pipe.
466 */
467 static int stdin_is_interactive = 1;
468
469 #if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \
470 && !defined(SHELL_OMIT_WIN_UTF8)
471 # define SHELL_WIN_UTF8_OPT 1
472 #else
473 # define SHELL_WIN_UTF8_OPT 0
474 #endif
475
476 #if SHELL_WIN_UTF8_OPT
477 /*
478 ** Setup console for UTF-8 input/output when following variable true.
479 */
480 static int console_utf8 = 0;
481 #endif
482
483 /*
484 ** On Windows systems we have to know if standard output is a console
485 ** in order to translate UTF-8 into MBCS. The following variable is
486 ** true if translation is required.
@@ -595,20 +610,154 @@
610 }
611 return dynPrompt.dynamicPrompt;
612 }
613 #endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */
614
615 #if SHELL_WIN_UTF8_OPT
616 /* Following struct is used for -utf8 operation. */
617 static struct ConsoleState {
618 int stdinEof; /* EOF has been seen on console input */
619 int infsMode; /* Input file stream mode upon shell start */
620 UINT inCodePage; /* Input code page upon shell start */
621 UINT outCodePage; /* Output code page upon shell start */
622 HANDLE hConsoleIn; /* Console input handle */
623 DWORD consoleMode; /* Console mode upon shell start */
624 } conState = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 };
625
626 #ifndef _O_U16TEXT /* For build environments lacking this constant: */
627 # define _O_U16TEXT 0x20000
628 #endif
629
630 /*
631 ** Prepare console, (if known to be a WIN32 console), for UTF-8
632 ** input (from either typing or suitable paste operations) and for
633 ** UTF-8 rendering. This may "fail" with a message to stderr, where
634 ** the preparation is not done and common "code page" issues occur.
635 */
636 static void console_prepare(void){
637 HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE);
638 DWORD consoleMode = 0;
639 if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR
640 && GetConsoleMode( hCI, &consoleMode) ){
641 if( !IsValidCodePage(CP_UTF8) ){
642 fprintf(stderr, "Cannot use UTF-8 code page.\n");
643 console_utf8 = 0;
644 return;
645 }
646 conState.hConsoleIn = hCI;
647 conState.consoleMode = consoleMode;
648 conState.inCodePage = GetConsoleCP();
649 conState.outCodePage = GetConsoleOutputCP();
650 SetConsoleCP(CP_UTF8);
651 SetConsoleOutputCP(CP_UTF8);
652 consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
653 SetConsoleMode(conState.hConsoleIn, consoleMode);
654 conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT);
655 console_utf8 = 1;
656 }else{
657 console_utf8 = 0;
658 }
659 }
660
661 /*
662 ** Undo the effects of console_prepare(), if any.
663 */
664 static void SQLITE_CDECL console_restore(void){
665 if( console_utf8 && conState.inCodePage!=0
666 && conState.hConsoleIn!=INVALID_HANDLE_VALUE ){
667 _setmode(_fileno(stdin), conState.infsMode);
668 SetConsoleCP(conState.inCodePage);
669 SetConsoleOutputCP(conState.outCodePage);
670 SetConsoleMode(conState.hConsoleIn, conState.consoleMode);
671 /* Avoid multiple calls. */
672 conState.hConsoleIn = INVALID_HANDLE_VALUE;
673 conState.consoleMode = 0;
674 console_utf8 = 0;
675 }
676 }
677
678 /*
679 ** Collect input like fgets(...) with special provisions for input
680 ** from the Windows console to get around its strange coding issues.
681 ** Defers to plain fgets() when input is not interactive or when the
682 ** startup option, -utf8, has not been provided or taken effect.
683 */
684 static char* utf8_fgets(char *buf, int ncmax, FILE *fin){
685 if( fin==0 ) fin = stdin;
686 if( fin==stdin && stdin_is_interactive && console_utf8 ){
687 # define SQLITE_IALIM 150
688 wchar_t wbuf[SQLITE_IALIM];
689 int lend = 0;
690 int noc = 0;
691 if( ncmax==0 || conState.stdinEof ) return 0;
692 buf[0] = 0;
693 while( noc<ncmax-7-1 && !lend ){
694 /* There is room for at least 2 more characters and a 0-terminator. */
695 int na = (ncmax > SQLITE_IALIM*4+1 + noc)
696 ? SQLITE_IALIM : (ncmax-1 - noc)/4;
697 # undef SQLITE_IALIM
698 DWORD nbr = 0;
699 BOOL bRC = ReadConsoleW(conState.hConsoleIn, wbuf, na, &nbr, 0);
700 if( !bRC || (noc==0 && nbr==0) ) return 0;
701 if( nbr > 0 ){
702 int nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR,
703 wbuf,nbr,0,0,0,0);
704 if( nmb !=0 && noc+nmb <= ncmax ){
705 int iseg = noc;
706 nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR,
707 wbuf,nbr,buf+noc,nmb,0,0);
708 noc += nmb;
709 /* Fixup line-ends as coded by Windows for CR (or "Enter".)*/
710 if( noc > 0 ){
711 if( buf[noc-1]=='\n' ){
712 lend = 1;
713 if( noc > 1 && buf[noc-2]=='\r' ){
714 buf[noc-2] = '\n';
715 --noc;
716 }
717 }
718 }
719 /* Check for ^Z (anywhere in line) too. */
720 while( iseg < noc ){
721 if( buf[iseg]==0x1a ){
722 conState.stdinEof = 1;
723 noc = iseg; /* Chop ^Z and anything following. */
724 break;
725 }
726 ++iseg;
727 }
728 }else break; /* Drop apparent garbage in. (Could assert.) */
729 }else break;
730 }
731 /* If got nothing, (after ^Z chop), must be at end-of-file. */
732 if( noc == 0 ) return 0;
733 buf[noc] = 0;
734 return buf;
735 }else{
736 return fgets(buf, ncmax, fin);
737 }
738 }
739
740 # define fgets(b,n,f) utf8_fgets(b,n,f)
741 #endif /* SHELL_WIN_UTF8_OPT */
742
743 /*
744 ** Render output like fprintf(). Except, if the output is going to the
745 ** console and if this is running on a Windows machine, and if the -utf8
746 ** option is unavailable or (available and inactive), translate the
747 ** output from UTF-8 into MBCS for output through 8-bit stdout stream.
748 ** (With -utf8 active, no translation is needed and must not be done.)
749 */
750 #if defined(_WIN32) || defined(WIN32)
751 void utf8_printf(FILE *out, const char *zFormat, ...){
752 va_list ap;
753 va_start(ap, zFormat);
754 if( stdout_is_console && (out==stdout || out==stderr)
755 # if SHELL_WIN_UTF8_OPT
756 && !console_utf8
757 # endif
758 ){
759 char *z1 = sqlite3_vmprintf(zFormat, ap);
760 char *z2 = sqlite3_win32_utf8_to_mbcs_v2(z1, 0);
761 sqlite3_free(z1);
762 fputs(z2, out);
763 sqlite3_free(z2);
@@ -636,11 +785,11 @@
785 }
786
787 /* Check a pointer to see if it is NULL. If it is NULL, exit with an
788 ** out-of-memory error.
789 */
790 static void shell_check_oom(const void *p){
791 if( p==0 ) shell_out_of_memory();
792 }
793
794 /*
795 ** Write I/O traces to the following stream.
@@ -815,13 +964,18 @@
964 zLine[n] = 0;
965 break;
966 }
967 }
968 #if defined(_WIN32) || defined(WIN32)
969 /* For interactive input on Windows systems, without -utf8,
970 ** translate the multi-byte characterset characters into UTF-8.
971 ** This is the translation that predates the -utf8 option. */
972 if( stdin_is_interactive && in==stdin
973 # if SHELL_WIN_UTF8_OPT
974 && !console_utf8
975 # endif /* SHELL_WIN_UTF8_OPT */
976 ){
977 char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
978 if( zTrans ){
979 i64 nTrans = strlen(zTrans)+1;
980 if( nTrans>nLine ){
981 zLine = realloc(zLine, nTrans);
@@ -858,14 +1012,25 @@
1012 }else{
1013 zPrompt = isContinuation ? CONTINUATION_PROMPT : mainPrompt;
1014 #if SHELL_USE_LOCAL_GETLINE
1015 printf("%s", zPrompt);
1016 fflush(stdout);
1017 do{
1018 zResult = local_getline(zPrior, stdin);
1019 zPrior = 0;
1020 /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
1021 if( zResult==0 ) sqlite3_sleep(50);
1022 }while( zResult==0 && seenInterrupt>0 );
1023 #else
1024 free(zPrior);
1025 zResult = shell_readline(zPrompt);
1026 while( zResult==0 ){
1027 /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */
1028 sqlite3_sleep(50);
1029 if( seenInterrupt==0 ) break;
1030 zResult = shell_readline("");
1031 }
1032 if( zResult && *zResult ) shell_add_history(zResult);
1033 #endif
1034 }
1035 return zResult;
1036 }
@@ -1001,10 +1166,11 @@
1166 **
1167 ** Return '"' if quoting is required. Return 0 if no quoting is required.
1168 */
1169 static char quoteChar(const char *zName){
1170 int i;
1171 if( zName==0 ) return '"';
1172 if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"';
1173 for(i=0; zName[i]; i++){
1174 if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"';
1175 }
1176 return sqlite3_keyword_check(zName, i) ? '"' : 0;
@@ -1644,11 +1810,12 @@
1810 ** May you find forgiveness for yourself and forgive others.
1811 ** May you share freely, never taking more than you give.
1812 **
1813 ******************************************************************************
1814 **
1815 ** This SQLite extension implements functions that compute SHA3 hashes
1816 ** in the way described by the (U.S.) NIST FIPS 202 SHA-3 Standard.
1817 ** Two SQL functions are implemented:
1818 **
1819 ** sha3(X,SIZE)
1820 ** sha3_query(Y,SIZE)
1821 **
@@ -3244,22 +3411,22 @@
3411 *pOut = 0;
3412 return pOut;
3413 }
3414
3415 /* Skip over text which is not base64 numeral(s). */
3416 static char * skipNonB64( char *s, int nc ){
3417 char c;
3418 while( nc-- > 0 && (c = *s) && !IS_BX_DIGIT(BX_DV_PROTO(c)) ) ++s;
3419 return s;
3420 }
3421
3422 /* Decode base64 text into a byte buffer. */
3423 static u8* fromBase64( char *pIn, int ncIn, u8 *pOut ){
3424 if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
3425 while( ncIn>0 && *pIn!=PAD_CHAR ){
3426 static signed char nboi[] = { 0, 0, 1, 2, 3 };
3427 char *pUse = skipNonB64(pIn, ncIn);
3428 unsigned long qv = 0L;
3429 int nti, nbo, nac;
3430 ncIn -= (pUse - pIn);
3431 pIn = pUse;
3432 nti = (ncIn>4)? 4 : ncIn;
@@ -3314,14 +3481,21 @@
3481 nc = 4*(nv+2/3); /* quads needed */
3482 nc += (nc+(B64_DARK_MAX-1))/B64_DARK_MAX + 1; /* LFs and a 0-terminator */
3483 if( nvMax < nc ){
3484 sqlite3_result_error(context, "blob expanded to base64 too big", -1);
3485 return;
3486 }
3487 bBuf = (u8*)sqlite3_value_blob(av[0]);
3488 if( !bBuf ){
3489 if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3490 goto memFail;
3491 }
3492 sqlite3_result_text(context,"",-1,SQLITE_STATIC);
3493 break;
3494 }
3495 cBuf = sqlite3_malloc(nc);
3496 if( !cBuf ) goto memFail;
 
3497 nc = (int)(toBase64(bBuf, nb, cBuf) - cBuf);
3498 sqlite3_result_text(context, cBuf, nc, sqlite3_free);
3499 break;
3500 case SQLITE_TEXT:
3501 nc = nv;
@@ -3329,14 +3503,21 @@
3503 if( nvMax < nb ){
3504 sqlite3_result_error(context, "blob from base64 may be too big", -1);
3505 return;
3506 }else if( nb<1 ){
3507 nb = 1;
3508 }
3509 cBuf = (char *)sqlite3_value_text(av[0]);
3510 if( !cBuf ){
3511 if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3512 goto memFail;
3513 }
3514 sqlite3_result_zeroblob(context, 0);
3515 break;
3516 }
3517 bBuf = sqlite3_malloc(nb);
3518 if( !bBuf ) goto memFail;
 
3519 nb = (int)(fromBase64(cBuf, nc, bBuf) - bBuf);
3520 sqlite3_result_blob(context, bBuf, nb, sqlite3_free);
3521 break;
3522 default:
3523 sqlite3_result_error(context, "base64 accepts only blob or text", -1);
@@ -3520,13 +3701,13 @@
3701
3702 /* Width of base64 lines. Should be an integer multiple of 5. */
3703 #define B85_DARK_MAX 80
3704
3705
3706 static char * skipNonB85( char *s, int nc ){
3707 char c;
3708 while( nc-- > 0 && (c = *s) && !IS_B85(c) ) ++s;
3709 return s;
3710 }
3711
3712 /* Convert small integer, known to be in 0..84 inclusive, to base85 numeral.
3713 * Do not use the macro form with argument expression having a side-effect.*/
@@ -3592,11 +3773,11 @@
3773 /* Decode base85 text into a byte buffer. */
3774 static u8* fromBase85( char *pIn, int ncIn, u8 *pOut ){
3775 if( ncIn>0 && pIn[ncIn-1]=='\n' ) --ncIn;
3776 while( ncIn>0 ){
3777 static signed char nboi[] = { 0, 0, 1, 2, 3, 4 };
3778 char *pUse = skipNonB85(pIn, ncIn);
3779 unsigned long qv = 0L;
3780 int nti, nbo;
3781 ncIn -= (pUse - pIn);
3782 pIn = pUse;
3783 nti = (ncIn>5)? 5 : ncIn;
@@ -3676,14 +3857,21 @@
3857 /* ulongs tail newlines tailenc+nul*/
3858 nc = 5*(nv/4) + nv%4 + nv/64+1 + 2;
3859 if( nvMax < nc ){
3860 sqlite3_result_error(context, "blob expanded to base85 too big", -1);
3861 return;
3862 }
3863 bBuf = (u8*)sqlite3_value_blob(av[0]);
3864 if( !bBuf ){
3865 if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3866 goto memFail;
3867 }
3868 sqlite3_result_text(context,"",-1,SQLITE_STATIC);
3869 break;
3870 }
3871 cBuf = sqlite3_malloc(nc);
3872 if( !cBuf ) goto memFail;
 
3873 nc = (int)(toBase85(bBuf, nb, cBuf, "\n") - cBuf);
3874 sqlite3_result_text(context, cBuf, nc, sqlite3_free);
3875 break;
3876 case SQLITE_TEXT:
3877 nc = nv;
@@ -3691,14 +3879,21 @@
3879 if( nvMax < nb ){
3880 sqlite3_result_error(context, "blob from base85 may be too big", -1);
3881 return;
3882 }else if( nb<1 ){
3883 nb = 1;
3884 }
3885 cBuf = (char *)sqlite3_value_text(av[0]);
3886 if( !cBuf ){
3887 if( SQLITE_NOMEM==sqlite3_errcode(sqlite3_context_db_handle(context)) ){
3888 goto memFail;
3889 }
3890 sqlite3_result_zeroblob(context, 0);
3891 break;
3892 }
3893 bBuf = sqlite3_malloc(nb);
3894 if( !bBuf ) goto memFail;
 
3895 nb = (int)(fromBase85(cBuf, nc, bBuf) - bBuf);
3896 sqlite3_result_blob(context, bBuf, nb, sqlite3_free);
3897 break;
3898 default:
3899 sqlite3_result_error(context, "base85 accepts only blob or text.", -1);
@@ -4114,11 +4309,11 @@
4309 }
4310
4311 /************************* End ../ext/misc/ieee754.c ********************/
4312 /************************* Begin ../ext/misc/series.c ******************/
4313 /*
4314 ** 2015-08-18, 2023-04-28
4315 **
4316 ** The author disclaims copyright to this source code. In place of
4317 ** a legal notice, here is a blessing:
4318 **
4319 ** May you do good and not evil.
@@ -4127,11 +4322,23 @@
4322 **
4323 *************************************************************************
4324 **
4325 ** This file demonstrates how to create a table-valued-function using
4326 ** a virtual table. This demo implements the generate_series() function
4327 ** which gives the same results as the eponymous function in PostgreSQL,
4328 ** within the limitation that its arguments are signed 64-bit integers.
4329 **
4330 ** Considering its equivalents to generate_series(start,stop,step): A
4331 ** value V[n] sequence is produced for integer n ascending from 0 where
4332 ** ( V[n] == start + n * step && sgn(V[n] - stop) * sgn(step) >= 0 )
4333 ** for each produced value (independent of production time ordering.)
4334 **
4335 ** All parameters must be either integer or convertable to integer.
4336 ** The start parameter is required.
4337 ** The stop parameter defaults to (1<<32)-1 (aka 4294967295 or 0xffffffff)
4338 ** The step parameter defaults to 1 and 0 is treated as 1.
4339 **
4340 ** Examples:
4341 **
4342 ** SELECT * FROM generate_series(0,100,5);
4343 **
4344 ** The query above returns integers from 0 through 100 counting by steps
@@ -4143,10 +4350,18 @@
4350 **
4351 ** SELECT * FROM generate_series(20) LIMIT 10;
4352 **
4353 ** Integers 20 through 29.
4354 **
4355 ** SELECT * FROM generate_series(0,-100,-5);
4356 **
4357 ** Integers 0 -5 -10 ... -100.
4358 **
4359 ** SELECT * FROM generate_series(0,-1);
4360 **
4361 ** Empty sequence.
4362 **
4363 ** HOW IT WORKS
4364 **
4365 ** The generate_series "function" is really a virtual table with the
4366 ** following schema:
4367 **
@@ -4154,10 +4369,13 @@
4369 ** value,
4370 ** start HIDDEN,
4371 ** stop HIDDEN,
4372 ** step HIDDEN
4373 ** );
4374 **
4375 ** The virtual table also has a rowid, logically equivalent to n+1 where
4376 ** "n" is the ascending integer in the aforesaid production definition.
4377 **
4378 ** Function arguments in queries against this virtual table are translated
4379 ** into equality constraints against successive hidden columns. In other
4380 ** words, the following pairs of queries are equivalent to each other:
4381 **
@@ -4187,27 +4405,139 @@
4405 */
4406 /* #include "sqlite3ext.h" */
4407 SQLITE_EXTENSION_INIT1
4408 #include <assert.h>
4409 #include <string.h>
4410 #include <limits.h>
4411
4412 #ifndef SQLITE_OMIT_VIRTUALTABLE
4413 /*
4414 ** Return that member of a generate_series(...) sequence whose 0-based
4415 ** index is ix. The 0th member is given by smBase. The sequence members
4416 ** progress per ix increment by smStep.
4417 */
4418 static sqlite3_int64 genSeqMember(sqlite3_int64 smBase,
4419 sqlite3_int64 smStep,
4420 sqlite3_uint64 ix){
4421 if( ix>=(sqlite3_uint64)LLONG_MAX ){
4422 /* Get ix into signed i64 range. */
4423 ix -= (sqlite3_uint64)LLONG_MAX;
4424 /* With 2's complement ALU, this next can be 1 step, but is split into
4425 * 2 for UBSAN's satisfaction (and hypothetical 1's complement ALUs.) */
4426 smBase += (LLONG_MAX/2) * smStep;
4427 smBase += (LLONG_MAX - LLONG_MAX/2) * smStep;
4428 }
4429 /* Under UBSAN (or on 1's complement machines), must do this last term
4430 * in steps to avoid the dreaded (and harmless) signed multiply overlow. */
4431 if( ix>=2 ){
4432 sqlite3_int64 ix2 = (sqlite3_int64)ix/2;
4433 smBase += ix2*smStep;
4434 ix -= ix2;
4435 }
4436 return smBase + ((sqlite3_int64)ix)*smStep;
4437 }
4438
4439 /* typedef unsigned char u8; */
4440
4441 typedef struct SequenceSpec {
4442 sqlite3_int64 iBase; /* Starting value ("start") */
4443 sqlite3_int64 iTerm; /* Given terminal value ("stop") */
4444 sqlite3_int64 iStep; /* Increment ("step") */
4445 sqlite3_uint64 uSeqIndexMax; /* maximum sequence index (aka "n") */
4446 sqlite3_uint64 uSeqIndexNow; /* Current index during generation */
4447 sqlite3_int64 iValueNow; /* Current value during generation */
4448 u8 isNotEOF; /* Sequence generation not exhausted */
4449 u8 isReversing; /* Sequence is being reverse generated */
4450 } SequenceSpec;
4451
4452 /*
4453 ** Prepare a SequenceSpec for use in generating an integer series
4454 ** given initialized iBase, iTerm and iStep values. Sequence is
4455 ** initialized per given isReversing. Other members are computed.
4456 */
4457 static void setupSequence( SequenceSpec *pss ){
4458 int bSameSigns;
4459 pss->uSeqIndexMax = 0;
4460 pss->isNotEOF = 0;
4461 bSameSigns = (pss->iBase < 0)==(pss->iTerm < 0);
4462 if( pss->iTerm < pss->iBase ){
4463 sqlite3_uint64 nuspan = 0;
4464 if( bSameSigns ){
4465 nuspan = (sqlite3_uint64)(pss->iBase - pss->iTerm);
4466 }else{
4467 /* Under UBSAN (or on 1's complement machines), must do this in steps.
4468 * In this clause, iBase>=0 and iTerm<0 . */
4469 nuspan = 1;
4470 nuspan += pss->iBase;
4471 nuspan += -(pss->iTerm+1);
4472 }
4473 if( pss->iStep<0 ){
4474 pss->isNotEOF = 1;
4475 if( nuspan==ULONG_MAX ){
4476 pss->uSeqIndexMax = ( pss->iStep>LLONG_MIN )? nuspan/-pss->iStep : 1;
4477 }else if( pss->iStep>LLONG_MIN ){
4478 pss->uSeqIndexMax = nuspan/-pss->iStep;
4479 }
4480 }
4481 }else if( pss->iTerm > pss->iBase ){
4482 sqlite3_uint64 puspan = 0;
4483 if( bSameSigns ){
4484 puspan = (sqlite3_uint64)(pss->iTerm - pss->iBase);
4485 }else{
4486 /* Under UBSAN (or on 1's complement machines), must do this in steps.
4487 * In this clause, iTerm>=0 and iBase<0 . */
4488 puspan = 1;
4489 puspan += pss->iTerm;
4490 puspan += -(pss->iBase+1);
4491 }
4492 if( pss->iStep>0 ){
4493 pss->isNotEOF = 1;
4494 pss->uSeqIndexMax = puspan/pss->iStep;
4495 }
4496 }else if( pss->iTerm == pss->iBase ){
4497 pss->isNotEOF = 1;
4498 pss->uSeqIndexMax = 0;
4499 }
4500 pss->uSeqIndexNow = (pss->isReversing)? pss->uSeqIndexMax : 0;
4501 pss->iValueNow = (pss->isReversing)
4502 ? genSeqMember(pss->iBase, pss->iStep, pss->uSeqIndexMax)
4503 : pss->iBase;
4504 }
4505
4506 /*
4507 ** Progress sequence generator to yield next value, if any.
4508 ** Leave its state to either yield next value or be at EOF.
4509 ** Return whether there is a next value, or 0 at EOF.
4510 */
4511 static int progressSequence( SequenceSpec *pss ){
4512 if( !pss->isNotEOF ) return 0;
4513 if( pss->isReversing ){
4514 if( pss->uSeqIndexNow > 0 ){
4515 pss->uSeqIndexNow--;
4516 pss->iValueNow -= pss->iStep;
4517 }else{
4518 pss->isNotEOF = 0;
4519 }
4520 }else{
4521 if( pss->uSeqIndexNow < pss->uSeqIndexMax ){
4522 pss->uSeqIndexNow++;
4523 pss->iValueNow += pss->iStep;
4524 }else{
4525 pss->isNotEOF = 0;
4526 }
4527 }
4528 return pss->isNotEOF;
4529 }
4530
4531 /* series_cursor is a subclass of sqlite3_vtab_cursor which will
4532 ** serve as the underlying representation of a cursor that scans
4533 ** over rows of the result
4534 */
4535 typedef struct series_cursor series_cursor;
4536 struct series_cursor {
4537 sqlite3_vtab_cursor base; /* Base class - must be first */
4538 SequenceSpec ss; /* (this) Derived class data */
 
 
 
 
 
4539 };
4540
4541 /*
4542 ** The seriesConnect() method is invoked to create a new
4543 ** series_vtab that describes the generate_series virtual table.
@@ -4285,16 +4615,11 @@
4615 /*
4616 ** Advance a series_cursor to its next row of output.
4617 */
4618 static int seriesNext(sqlite3_vtab_cursor *cur){
4619 series_cursor *pCur = (series_cursor*)cur;
4620 progressSequence( & pCur->ss );
 
 
 
 
 
4621 return SQLITE_OK;
4622 }
4623
4624 /*
4625 ** Return values of columns for the row at which the series_cursor
@@ -4306,44 +4631,40 @@
4631 int i /* Which column to return */
4632 ){
4633 series_cursor *pCur = (series_cursor*)cur;
4634 sqlite3_int64 x = 0;
4635 switch( i ){
4636 case SERIES_COLUMN_START: x = pCur->ss.iBase; break;
4637 case SERIES_COLUMN_STOP: x = pCur->ss.iTerm; break;
4638 case SERIES_COLUMN_STEP: x = pCur->ss.iStep; break;
4639 default: x = pCur->ss.iValueNow; break;
4640 }
4641 sqlite3_result_int64(ctx, x);
4642 return SQLITE_OK;
4643 }
4644
4645 /*
4646 ** Return the rowid for the current row, logically equivalent to n+1 where
4647 ** "n" is the ascending integer in the aforesaid production definition.
 
4648 */
4649 static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
4650 series_cursor *pCur = (series_cursor*)cur;
4651 sqlite3_uint64 n = pCur->ss.uSeqIndexNow;
4652 *pRowid = (sqlite3_int64)((n<0xffffffffffffffff)? n+1 : 0);
4653 return SQLITE_OK;
4654 }
4655
4656 /*
4657 ** Return TRUE if the cursor has been moved off of the last
4658 ** row of output.
4659 */
4660 static int seriesEof(sqlite3_vtab_cursor *cur){
4661 series_cursor *pCur = (series_cursor*)cur;
4662 return !pCur->ss.isNotEOF;
 
 
 
 
4663 }
4664
4665 /* True to cause run-time checking of the start=, stop=, and/or step=
4666 ** parameters. The only reason to do this is for testing the
4667 ** constraint checking logic for virtual tables in the SQLite core.
4668 */
4669 #ifndef SQLITE_SERIES_CONSTRAINT_VERIFY
4670 # define SQLITE_SERIES_CONSTRAINT_VERIFY 0
@@ -4350,11 +4671,11 @@
4671 #endif
4672
4673 /*
4674 ** This method is called to "rewind" the series_cursor object back
4675 ** to the first row of output. This method is always called at least
4676 ** once prior to any call to seriesColumn() or seriesRowid() or
4677 ** seriesEof().
4678 **
4679 ** The query plan selected by seriesBestIndex is passed in the idxNum
4680 ** parameter. (idxStr is not used in this implementation.) idxNum
4681 ** is a bitmask showing which constraints are available:
@@ -4370,58 +4691,53 @@
4691 ** This routine should initialize the cursor and position it so that it
4692 ** is pointing at the first row, or pointing off the end of the table
4693 ** (so that seriesEof() will return true) if the table is empty.
4694 */
4695 static int seriesFilter(
4696 sqlite3_vtab_cursor *pVtabCursor,
4697 int idxNum, const char *idxStrUnused,
4698 int argc, sqlite3_value **argv
4699 ){
4700 series_cursor *pCur = (series_cursor *)pVtabCursor;
4701 int i = 0;
4702 (void)idxStrUnused;
4703 if( idxNum & 1 ){
4704 pCur->ss.iBase = sqlite3_value_int64(argv[i++]);
4705 }else{
4706 pCur->ss.iBase = 0;
4707 }
4708 if( idxNum & 2 ){
4709 pCur->ss.iTerm = sqlite3_value_int64(argv[i++]);
4710 }else{
4711 pCur->ss.iTerm = 0xffffffff;
4712 }
4713 if( idxNum & 4 ){
4714 pCur->ss.iStep = sqlite3_value_int64(argv[i++]);
4715 if( pCur->ss.iStep==0 ){
4716 pCur->ss.iStep = 1;
4717 }else if( pCur->ss.iStep<0 ){
 
4718 if( (idxNum & 16)==0 ) idxNum |= 8;
4719 }
4720 }else{
4721 pCur->ss.iStep = 1;
4722 }
4723 for(i=0; i<argc; i++){
4724 if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
4725 /* If any of the constraints have a NULL value, then return no rows.
4726 ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
4727 pCur->ss.iBase = 1;
4728 pCur->ss.iTerm = 0;
4729 pCur->ss.iStep = 1;
4730 break;
4731 }
4732 }
4733 if( idxNum & 8 ){
4734 pCur->ss.isReversing = pCur->ss.iStep > 0;
 
 
 
 
4735 }else{
4736 pCur->ss.isReversing = pCur->ss.iStep < 0;
 
4737 }
4738 setupSequence( &pCur->ss );
4739 return SQLITE_OK;
4740 }
4741
4742 /*
4743 ** SQLite will invoke this method one or more times while planning a query
@@ -5172,11 +5488,11 @@
5488 re_append(p, RE_OP_FORK, -sz);
5489 }
5490 break;
5491 }
5492 case '[': {
5493 unsigned int iFirst = p->nState;
5494 if( rePeek(p)=='^' ){
5495 re_append(p, RE_OP_CC_EXC, 0);
5496 p->sIn.i++;
5497 }else{
5498 re_append(p, RE_OP_CC_INC, 0);
@@ -5196,11 +5512,11 @@
5512 re_append(p, RE_OP_CC_VALUE, c);
5513 }
5514 if( rePeek(p)==']' ){ p->sIn.i++; break; }
5515 }
5516 if( c==0 ) return "unclosed '['";
5517 if( p->nState>iFirst ) p->aArg[iFirst] = p->nState - iFirst;
5518 break;
5519 }
5520 case '\\': {
5521 int specialOp = 0;
5522 switch( rePeek(p) ){
@@ -9213,13 +9529,23 @@
9529 ** Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
9530 ** linked list. Remove it from the list and free the object.
9531 */
9532 static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
9533 if( pOld ){
9534 if( pTab->pFirstEntry==pOld ){
9535 pTab->pFirstEntry = pOld->pNext;
9536 if( pTab->pLastEntry==pOld ) pTab->pLastEntry = 0;
9537 }else{
9538 ZipfileEntry *p;
9539 for(p=pTab->pFirstEntry; p; p=p->pNext){
9540 if( p->pNext==pOld ){
9541 p->pNext = pOld->pNext;
9542 if( pTab->pLastEntry==pOld ) pTab->pLastEntry = p;
9543 break;
9544 }
9545 }
9546 }
9547 zipfileEntryFree(pOld);
9548 }
9549 }
9550
9551 /*
@@ -12510,10 +12836,11 @@
12836 #endif
12837
12838 #endif /* ifndef _SQLITE_RECOVER_H */
12839
12840 /************************* End ../ext/recover/sqlite3recover.h ********************/
12841 # ifndef SQLITE_HAVE_SQLITE3R
12842 /************************* Begin ../ext/recover/dbdata.c ******************/
12843 /*
12844 ** 2019-04-17
12845 **
12846 ** The author disclaims copyright to this source code. In place of
@@ -14576,11 +14903,11 @@
14903 pStmt = recoverPreparePrintf(p, p->dbOut, "PRAGMA index_xinfo(%Q)", zName);
14904 while( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
14905 int iField = sqlite3_column_int(pStmt, 0);
14906 int iCol = sqlite3_column_int(pStmt, 1);
14907
14908 assert( iCol<pNew->nCol );
14909 pNew->aCol[iCol].iField = iField;
14910
14911 pNew->bIntkey = 0;
14912 iPk = -2;
14913 }
@@ -16340,10 +16667,11 @@
16667 }
16668
16669 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
16670
16671 /************************* End ../ext/recover/sqlite3recover.c ********************/
16672 # endif /* SQLITE_HAVE_SQLITE3R */
16673 #endif
16674 #ifdef SQLITE_SHELL_EXTSRC
16675 # include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
16676 #endif
16677
@@ -16521,10 +16849,11 @@
16849 #define SHFLG_CountChanges 0x00000020 /* .changes setting */
16850 #define SHFLG_Echo 0x00000040 /* .echo on/off, or --echo setting */
16851 #define SHFLG_HeaderSet 0x00000080 /* showHeader has been specified */
16852 #define SHFLG_DumpDataOnly 0x00000100 /* .dump show data only */
16853 #define SHFLG_DumpNoSys 0x00000200 /* .dump omits system tables */
16854 #define SHFLG_TestingMode 0x00000400 /* allow unsafe testing features */
16855
16856 /*
16857 ** Macros for testing and setting shellFlgs
16858 */
16859 #define ShellHasFlag(P,X) (((P)->shellFlgs & (X))!=0)
@@ -16764,10 +17093,11 @@
17093 if( hasCRNL ){
17094 /* If the original contains \r\n then do no conversions back to \n */
17095 }else{
17096 /* If the file did not originally contain \r\n then convert any new
17097 ** \r\n back into \n */
17098 p[sz] = 0;
17099 for(i=j=0; i<sz; i++){
17100 if( p[i]=='\r' && p[i+1]=='\n' ) i++;
17101 p[j++] = p[i];
17102 }
17103 sz = j;
@@ -16854,10 +17184,11 @@
17184 */
17185 static void output_quoted_string(FILE *out, const char *z){
17186 int i;
17187 char c;
17188 setBinaryMode(out, 1);
17189 if( z==0 ) return;
17190 for(i=0; (c = z[i])!=0 && c!='\''; i++){}
17191 if( c==0 ){
17192 utf8_printf(out,"'%s'",z);
17193 }else{
17194 raw_printf(out, "'");
@@ -16983,10 +17314,11 @@
17314 /*
17315 ** Output the given string as a quoted according to JSON quoting rules.
17316 */
17317 static void output_json_string(FILE *out, const char *z, i64 n){
17318 unsigned int c;
17319 if( z==0 ) z = "";
17320 if( n<0 ) n = strlen(z);
17321 fputc('"', out);
17322 while( n-- ){
17323 c = *(z++);
17324 if( c=='\\' || c=='"' ){
@@ -17107,12 +17439,11 @@
17439 /*
17440 ** This routine runs when the user presses Ctrl-C
17441 */
17442 static void interrupt_handler(int NotUsed){
17443 UNUSED_PARAMETER(NotUsed);
17444 if( ++seenInterrupt>1 ) exit(1);
 
17445 if( globalDb ) sqlite3_interrupt(globalDb);
17446 }
17447
17448 #if (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE)
17449 /*
@@ -18559,14 +18890,18 @@
18890 zVar = zNum;
18891 }
18892 sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18893 if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
18894 sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
18895 #ifdef NAN
18896 }else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
18897 sqlite3_bind_double(pStmt, i, NAN);
18898 #endif
18899 #ifdef INFINITY
18900 }else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
18901 sqlite3_bind_double(pStmt, i, INFINITY);
18902 #endif
18903 }else{
18904 sqlite3_bind_null(pStmt, i);
18905 }
18906 sqlite3_reset(pQ);
18907 }
@@ -18806,11 +19141,11 @@
19141 nAlloc = nColumn*4;
19142 if( nAlloc<=0 ) nAlloc = 1;
19143 azData = sqlite3_malloc64( nAlloc*sizeof(char*) );
19144 shell_check_oom(azData);
19145 azNextLine = sqlite3_malloc64( nColumn*sizeof(char*) );
19146 shell_check_oom(azNextLine);
19147 memset((void*)azNextLine, 0, nColumn*sizeof(char*) );
19148 if( p->cmOpts.bQuote ){
19149 azQuoted = sqlite3_malloc64( nColumn*sizeof(char*) );
19150 shell_check_oom(azQuoted);
19151 memset(azQuoted, 0, nColumn*sizeof(char*) );
@@ -18836,10 +19171,11 @@
19171 if( wx==0 ){
19172 wx = p->cmOpts.iWrap;
19173 }
19174 if( wx<0 ) wx = -wx;
19175 uz = (const unsigned char*)sqlite3_column_name(pStmt,i);
19176 if( uz==0 ) uz = (u8*)"";
19177 azData[i] = translateForDisplayAndDup(uz, &zNotUsed, wx, bw);
19178 }
19179 do{
19180 int useNextLine = bNextLine;
19181 bNextLine = 0;
@@ -19769,17 +20105,17 @@
20105 " from the \".mode\" output mode",
20106 " * If FILE begins with \"|\" then it is a command that generates the",
20107 " input text.",
20108 #endif
20109 #ifndef SQLITE_OMIT_TEST_CONTROL
20110 ",imposter INDEX TABLE Create imposter table TABLE on index INDEX",
20111 #endif
20112 ".indexes ?TABLE? Show names of indexes",
20113 " If TABLE is specified, only show indexes for",
20114 " tables matching TABLE using the LIKE operator.",
20115 #ifdef SQLITE_ENABLE_IOTRACE
20116 ",iotrace FILE Enable I/O diagnostic logging to FILE",
20117 #endif
20118 ".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT",
20119 ".lint OPTIONS Report potential schema issues.",
20120 " Options:",
20121 " fkey-indexes Find missing foreign key indexes",
@@ -19884,11 +20220,11 @@
20220 ".scanstats on|off|est Turn sqlite3_stmt_scanstatus() metrics on or off",
20221 ".schema ?PATTERN? Show the CREATE statements matching PATTERN",
20222 " Options:",
20223 " --indent Try to pretty-print the schema",
20224 " --nosys Omit objects whose names start with \"sqlite_\"",
20225 ",selftest ?OPTIONS? Run tests defined in the SELFTEST table",
20226 " Options:",
20227 " --init Create a new SELFTEST table",
20228 " -v Verbose output",
20229 ".separator COL ?ROW? Change the column and row separators",
20230 #if defined(SQLITE_ENABLE_SESSION)
@@ -19926,13 +20262,13 @@
20262 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
20263 ".system CMD ARGS... Run CMD ARGS... in a system shell",
20264 #endif
20265 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
20266 #ifndef SQLITE_SHELL_FIDDLE
20267 ",testcase NAME Begin redirecting output to 'testcase-out.txt'",
20268 #endif
20269 ",testctrl CMD ... Run various sqlite3_test_control() operations",
20270 " Run \".testctrl\" with no arguments for details",
20271 ".timeout MS Try opening locked tables for MS milliseconds",
20272 ".timer on|off Turn SQL timer on or off",
20273 #ifndef SQLITE_OMIT_TRACE
20274 ".trace ?OPTIONS? Output each SQL statement as it is run",
@@ -19980,20 +20316,45 @@
20316 || zPattern[0]=='0'
20317 || cli_strcmp(zPattern,"-a")==0
20318 || cli_strcmp(zPattern,"-all")==0
20319 || cli_strcmp(zPattern,"--all")==0
20320 ){
20321 enum HelpWanted { HW_NoCull = 0, HW_SummaryOnly = 1, HW_Undoc = 2 };
20322 enum HelpHave { HH_Undoc = 2, HH_Summary = 1, HH_More = 0 };
20323 /* Show all or most commands
20324 ** *zPattern==0 => summary of documented commands only
20325 ** *zPattern=='0' => whole help for undocumented commands
20326 ** Otherwise => whole help for documented commands
20327 */
20328 enum HelpWanted hw = HW_SummaryOnly;
20329 enum HelpHave hh = HH_More;
20330 if( zPattern!=0 ){
20331 hw = (*zPattern=='0')? HW_NoCull|HW_Undoc : HW_NoCull;
20332 }
20333 for(i=0; i<ArraySize(azHelp); i++){
20334 switch( azHelp[i][0] ){
20335 case ',':
20336 hh = HH_Summary|HH_Undoc;
20337 break;
20338 case '.':
20339 hh = HH_Summary;
20340 break;
20341 default:
20342 hh &= ~HH_Summary;
20343 break;
20344 }
20345 if( ((hw^hh)&HH_Undoc)==0 ){
20346 if( (hh&HH_Summary)!=0 ){
20347 utf8_printf(out, ".%s\n", azHelp[i]+1);
20348 ++n;
20349 }else if( (hw&HW_SummaryOnly)==0 ){
20350 utf8_printf(out, "%s\n", azHelp[i]);
20351 }
20352 }
20353 }
20354 }else{
20355 /* Seek documented commands for which zPattern is an exact prefix */
20356 zPat = sqlite3_mprintf(".%s*", zPattern);
20357 shell_check_oom(zPat);
20358 for(i=0; i<ArraySize(azHelp); i++){
20359 if( sqlite3_strglob(zPat, azHelp[i])==0 ){
20360 utf8_printf(out, "%s\n", azHelp[i]);
@@ -20002,28 +20363,32 @@
20363 }
20364 }
20365 sqlite3_free(zPat);
20366 if( n ){
20367 if( n==1 ){
20368 /* when zPattern is a prefix of exactly one command, then include
20369 ** the details of that command, which should begin at offset j */
20370 while( j<ArraySize(azHelp)-1 && azHelp[j][0]==' ' ){
20371 utf8_printf(out, "%s\n", azHelp[j]);
20372 j++;
20373 }
20374 }
20375 return n;
20376 }
20377 /* Look for documented commands that contain zPattern anywhere.
20378 ** Show complete text of all documented commands that match. */
20379 zPat = sqlite3_mprintf("%%%s%%", zPattern);
20380 shell_check_oom(zPat);
20381 for(i=0; i<ArraySize(azHelp); i++){
20382 if( azHelp[i][0]==',' ){
20383 while( i<ArraySize(azHelp)-1 && azHelp[i+1][0]==' ' ) ++i;
20384 continue;
20385 }
20386 if( azHelp[i][0]=='.' ) j = i;
20387 if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){
20388 utf8_printf(out, "%s\n", azHelp[j]);
20389 while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]==' ' ){
20390 j++;
20391 utf8_printf(out, "%s\n", azHelp[j]);
20392 }
20393 i = j;
20394 n++;
@@ -20337,17 +20702,34 @@
20702 }
20703 globalDb = p->db;
20704 if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){
20705 utf8_printf(stderr,"Error: unable to open database \"%s\": %s\n",
20706 zDbFilename, sqlite3_errmsg(p->db));
20707 if( (openFlags & OPEN_DB_KEEPALIVE)==0 ){
20708 exit(1);
 
20709 }
20710 sqlite3_close(p->db);
20711 sqlite3_open(":memory:", &p->db);
20712 if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){
20713 utf8_printf(stderr,
20714 "Also: unable to open substitute in-memory database.\n"
20715 );
20716 exit(1);
20717 }else{
20718 utf8_printf(stderr,
20719 "Notice: using substitute in-memory database instead of \"%s\"\n",
20720 zDbFilename);
20721 }
20722 }
20723 sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
20724
20725 /* Reflect the use or absence of --unsafe-testing invocation. */
20726 {
20727 int testmode_on = ShellHasFlag(p,SHFLG_TestingMode);
20728 sqlite3_db_config(p->db, SQLITE_DBCONFIG_TRUSTED_SCHEMA, testmode_on,0);
20729 sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, !testmode_on,0);
20730 }
20731
20732 #ifndef SQLITE_OMIT_LOAD_EXTENSION
20733 sqlite3_enable_load_extension(p->db, 1);
20734 #endif
20735 sqlite3_shathree_init(p->db, 0, 0);
@@ -20356,13 +20738,10 @@
20738 sqlite3_base64_init(p->db, 0, 0);
20739 sqlite3_base85_init(p->db, 0, 0);
20740 sqlite3_regexp_init(p->db, 0, 0);
20741 sqlite3_ieee_init(p->db, 0, 0);
20742 sqlite3_series_init(p->db, 0, 0);
 
 
 
20743 #ifndef SQLITE_SHELL_FIDDLE
20744 sqlite3_fileio_init(p->db, 0, 0);
20745 sqlite3_completion_init(p->db, 0, 0);
20746 #endif
20747 #ifdef SQLITE_HAVE_ZLIB
@@ -20550,10 +20929,11 @@
20929 ** \s -> space
20930 ** \" -> "
20931 ** \' -> '
20932 ** \\ -> backslash
20933 ** \NNN -> ascii character NNN in octal
20934 ** \xHH -> ascii character HH in hexadecimal
20935 */
20936 static void resolve_backslashes(char *z){
20937 int i, j;
20938 char c;
20939 while( *z && *z!='\\' ) z++;
@@ -20578,10 +20958,19 @@
20958 c = '"';
20959 }else if( c=='\'' ){
20960 c = '\'';
20961 }else if( c=='\\' ){
20962 c = '\\';
20963 }else if( c=='x' ){
20964 int nhd = 0, hdv;
20965 u8 hv = 0;
20966 while( nhd<2 && (c=z[i+1+nhd])!=0 && (hdv=hexDigitValue(c))>=0 ){
20967 hv = (u8)((hv<<4)|hdv);
20968 ++nhd;
20969 }
20970 i += nhd;
20971 c = (u8)hv;
20972 }else if( c>='0' && c<='7' ){
20973 c -= '0';
20974 if( z[i+1]>='0' && z[i+1]<='7' ){
20975 i++;
20976 c = (c<<3) + z[i] - '0';
@@ -20677,11 +21066,11 @@
21066 if( p->traceOut==0 ) return 0;
21067 if( mType==SQLITE_TRACE_CLOSE ){
21068 utf8_printf(p->traceOut, "-- closing database connection\n");
21069 return 0;
21070 }
21071 if( mType!=SQLITE_TRACE_ROW && pX!=0 && ((const char*)pX)[0]=='-' ){
21072 zSql = (const char*)pX;
21073 }else{
21074 pStmt = (sqlite3_stmt*)pP;
21075 switch( p->eTraceType ){
21076 case SHELL_TRACE_EXPANDED: {
@@ -20709,11 +21098,11 @@
21098 case SQLITE_TRACE_STMT: {
21099 utf8_printf(p->traceOut, "%.*s;\n", (int)nSql, zSql);
21100 break;
21101 }
21102 case SQLITE_TRACE_PROFILE: {
21103 sqlite3_int64 nNanosec = pX ? *(sqlite3_int64*)pX : 0;
21104 utf8_printf(p->traceOut, "%.*s; -- %lld ns\n", (int)nSql, zSql, nNanosec);
21105 break;
21106 }
21107 }
21108 return 0;
@@ -20785,12 +21174,12 @@
21174 ** EOF on end-of-file.
21175 ** + Report syntax errors on stderr
21176 */
21177 static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
21178 int c;
21179 int cSep = (u8)p->cColSep;
21180 int rSep = (u8)p->cRowSep;
21181 p->n = 0;
21182 c = fgetc(p->in);
21183 if( c==EOF || seenInterrupt ){
21184 p->cTerm = EOF;
21185 return 0;
@@ -20875,12 +21264,12 @@
21264 ** EOF on end-of-file.
21265 ** + Report syntax errors on stderr
21266 */
21267 static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
21268 int c;
21269 int cSep = (u8)p->cColSep;
21270 int rSep = (u8)p->cRowSep;
21271 p->n = 0;
21272 c = fgetc(p->in);
21273 if( c==EOF || seenInterrupt ){
21274 p->cTerm = EOF;
21275 return 0;
@@ -21070,11 +21459,11 @@
21459 }
21460 while( sqlite3_step(pQuery)==SQLITE_ROW ){
21461 zName = sqlite3_column_text(pQuery, 0);
21462 zSql = sqlite3_column_text(pQuery, 1);
21463 if( zName==0 || zSql==0 ) continue;
21464 if( sqlite3_stricmp((char*)zName, "sqlite_sequence")==0 ) continue;
21465 printf("%s... ", zName); fflush(stdout);
21466 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
21467 if( zErrMsg ){
21468 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
21469 sqlite3_free(zErrMsg);
@@ -21237,11 +21626,13 @@
21626 }
21627 sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
21628 if( sqlite3_step(pStmt)==SQLITE_ROW
21629 && sqlite3_column_bytes(pStmt,0)>100
21630 ){
21631 const u8 *pb = sqlite3_column_blob(pStmt,0);
21632 shell_check_oom(pb);
21633 memcpy(aHdr, pb, 100);
21634 sqlite3_finalize(pStmt);
21635 }else{
21636 raw_printf(stderr, "unable to read database header\n");
21637 sqlite3_finalize(pStmt);
21638 return 1;
@@ -22054,11 +22445,14 @@
22445 if( arProcessSwitch(pAr, pMatch->eSwitch, zArg) ) return SQLITE_ERROR;
22446 }
22447 }
22448 }
22449 }
22450 if( pAr->eCmd==0 ){
22451 utf8_printf(stderr, "Required argument missing. Usage:\n");
22452 return arUsage(stderr);
22453 }
22454 return SQLITE_OK;
22455 }
22456
22457 /*
22458 ** This function assumes that all arguments within the ArCommand.azArg[]
@@ -22820,11 +23214,11 @@
23214 rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
23215 rc_err_oom_die(rc);
23216 sqlite3_bind_int(pStmt, 1, nDigits);
23217 rc = sqlite3_step(pStmt);
23218 sqlite3_finalize(pStmt);
23219 if( rc!=SQLITE_DONE ) rc_err_oom_die(SQLITE_NOMEM);
23220 }
23221 assert(db_int(*pDb, zHasDupes)==0); /* Consider: remove this */
23222 rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
23223 rc_err_oom_die(rc);
23224 rc = sqlite3_step(pStmt);
@@ -23752,12 +24146,12 @@
24146 if( nSep>1 ){
24147 raw_printf(stderr, "Error: multi-character row separators not allowed"
24148 " for import\n");
24149 goto meta_command_exit;
24150 }
24151 sCtx.cColSep = (u8)p->colSeparator[0];
24152 sCtx.cRowSep = (u8)p->rowSeparator[0];
24153 }
24154 sCtx.zFile = zFile;
24155 sCtx.nLine = 1;
24156 if( sCtx.zFile[0]=='|' ){
24157 #ifdef SQLITE_OMIT_POPEN
@@ -23949,10 +24343,16 @@
24343 sqlite3_stmt *pStmt;
24344 int tnum = 0;
24345 int isWO = 0; /* True if making an imposter of a WITHOUT ROWID table */
24346 int lenPK = 0; /* Length of the PRIMARY KEY string for isWO tables */
24347 int i;
24348 if( !ShellHasFlag(p,SHFLG_TestingMode) ){
24349 utf8_printf(stderr, ".%s unavailable without --unsafe-testing\n",
24350 "imposter");
24351 rc = 1;
24352 goto meta_command_exit;
24353 }
24354 if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){
24355 utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n"
24356 " .imposter off\n");
24357 /* Also allowed, but not documented:
24358 **
@@ -24133,11 +24533,12 @@
24533 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
24534 if( c=='l' && cli_strncmp(azArg[0], "load", n)==0 ){
24535 const char *zFile, *zProc;
24536 char *zErrMsg = 0;
24537 failIfSafeMode(p, "cannot run .load in safe mode");
24538 if( nArg<2 || azArg[1][0]==0 ){
24539 /* Must have a non-empty FILE. (Will not load self.) */
24540 raw_printf(stderr, "Usage: .load FILE ?ENTRYPOINT?\n");
24541 rc = 1;
24542 goto meta_command_exit;
24543 }
24544 zFile = azArg[1];
@@ -25457,32 +25858,40 @@
25858 "' OR ') as query, tname from tabcols group by tname)"
25859 , zRevText);
25860 shell_check_oom(zRevText);
25861 if( bDebug ) utf8_printf(p->out, "%s\n", zRevText);
25862 lrc = sqlite3_prepare_v2(p->db, zRevText, -1, &pStmt, 0);
25863 if( lrc!=SQLITE_OK ){
25864 /* assert(lrc==SQLITE_NOMEM); // might also be SQLITE_ERROR if the
25865 ** user does cruel and unnatural things like ".limit expr_depth 0". */
25866 rc = 1;
25867 }else{
25868 if( zLike ) sqlite3_bind_text(pStmt,1,zLike,-1,SQLITE_STATIC);
25869 lrc = SQLITE_ROW==sqlite3_step(pStmt);
25870 if( lrc ){
25871 const char *zGenQuery = (char*)sqlite3_column_text(pStmt,0);
25872 sqlite3_stmt *pCheckStmt;
25873 lrc = sqlite3_prepare_v2(p->db, zGenQuery, -1, &pCheckStmt, 0);
25874 if( bDebug ) utf8_printf(p->out, "%s\n", zGenQuery);
25875 if( lrc!=SQLITE_OK ){
25876 rc = 1;
25877 }else{
25878 if( SQLITE_ROW==sqlite3_step(pCheckStmt) ){
25879 double countIrreversible = sqlite3_column_double(pCheckStmt, 0);
25880 if( countIrreversible>0 ){
25881 int sz = (int)(countIrreversible + 0.5);
25882 utf8_printf(stderr,
25883 "Digest includes %d invalidly encoded text field%s.\n",
25884 sz, (sz>1)? "s": "");
25885 }
25886 }
25887 sqlite3_finalize(pCheckStmt);
25888 }
25889 sqlite3_finalize(pStmt);
25890 }
25891 }
25892 if( rc ) utf8_printf(stderr, ".sha3sum failed.\n");
25893 sqlite3_free(zRevText);
25894 }
25895 #endif /* !defined(*_OMIT_SCHEMA_PRAGMAS) && !defined(*_OMIT_VIRTUALTABLE) */
25896 sqlite3_free(zSql);
25897 }else
@@ -25741,10 +26150,16 @@
26150 int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */
26151 int isOk = 0;
26152 int i, n2;
26153 const char *zCmd = 0;
26154
26155 if( !ShellHasFlag(p,SHFLG_TestingMode) ){
26156 utf8_printf(stderr, ".%s unavailable without --unsafe-testing\n",
26157 "testctrl");
26158 rc = 1;
26159 goto meta_command_exit;
26160 }
26161 open_db(p, 0);
26162 zCmd = nArg>=2 ? azArg[1] : "help";
26163
26164 /* The argument can optionally begin with "-" or "--" */
26165 if( zCmd[0]=='-' && zCmd[1] ){
@@ -26740,10 +27155,14 @@
27155 " -sorterref SIZE sorter references threshold size\n"
27156 #endif
27157 " -stats print memory stats before each finalize\n"
27158 " -table set output mode to 'table'\n"
27159 " -tabs set output mode to 'tabs'\n"
27160 " -unsafe-testing allow unsafe commands and modes for testing\n"
27161 #if SHELL_WIN_UTF8_OPT
27162 " -utf8 setup interactive console code page for UTF-8\n"
27163 #endif
27164 " -version show SQLite version\n"
27165 " -vfs NAME use NAME as the default VFS\n"
27166 #ifdef SQLITE_ENABLE_VFSTRACE
27167 " -vfstrace enable tracing of all VFS calls\n"
27168 #endif
@@ -26831,10 +27250,14 @@
27250 argv[0], argv[argc-1]);
27251 exit(1);
27252 }
27253 return argv[i];
27254 }
27255
27256 static void sayAbnormalExit(void){
27257 if( seenInterrupt ) fprintf(stderr, "Program interrupted.\n");
27258 }
27259
27260 #ifndef SQLITE_SHELL_IS_UTF8
27261 # if (defined(_WIN32) || defined(WIN32)) \
27262 && (defined(_MSC_VER) || (defined(UNICODE) && defined(__GNUC__)))
27263 # define SQLITE_SHELL_IS_UTF8 (0)
@@ -26852,11 +27275,11 @@
27275 #else
27276 int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
27277 char **argv;
27278 #endif
27279 #ifdef SQLITE_DEBUG
27280 sqlite3_int64 mem_main_enter = 0;
27281 #endif
27282 char *zErrMsg = 0;
27283 #ifdef SQLITE_SHELL_FIDDLE
27284 # define data shellState
27285 #else
@@ -26873,22 +27296,27 @@
27296 const char *zVfs = 0; /* Value of -vfs command-line option */
27297 #if !SQLITE_SHELL_IS_UTF8
27298 char **argvToFree = 0;
27299 int argcToFree = 0;
27300 #endif
 
 
27301 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
27302
27303 #ifdef SQLITE_SHELL_FIDDLE
27304 stdin_is_interactive = 0;
27305 stdout_is_console = 1;
27306 data.wasm.zDefaultDbName = "/fiddle.sqlite3";
27307 #else
27308 stdin_is_interactive = isatty(0);
27309 stdout_is_console = isatty(1);
27310 #endif
27311 #if SHELL_WIN_UTF8_OPT
27312 atexit(console_restore); /* Needs revision for CLI as library call */
27313 #endif
27314 atexit(sayAbnormalExit);
27315 #ifdef SQLITE_DEBUG
27316 mem_main_enter = sqlite3_memory_used();
27317 #endif
27318 #if !defined(_WIN32_WCE)
27319 if( getenv("SQLITE_DEBUG_BREAK") ){
27320 if( isatty(0) && isatty(2) ){
27321 fprintf(stderr,
27322 "attach debugger to process %d and press any key to continue.\n",
@@ -26904,10 +27332,18 @@
27332 #elif defined(SIGTRAP)
27333 raise(SIGTRAP);
27334 #endif
27335 }
27336 }
27337 #endif
27338 /* Register a valid signal handler early, before much else is done. */
27339 #ifdef SIGINT
27340 signal(SIGINT, interrupt_handler);
27341 #elif (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE)
27342 if( !SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE) ){
27343 fprintf(stderr, "No ^C handler.\n");
27344 }
27345 #endif
27346
27347 #if USE_SYSTEM_SQLITE+0!=1
27348 if( cli_strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,60)!=0 ){
27349 utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
@@ -26944,19 +27380,10 @@
27380 #endif
27381
27382 assert( argc>=1 && argv && argv[0] );
27383 Argv0 = argv[0];
27384
 
 
 
 
 
 
 
 
 
27385 #ifdef SQLITE_SHELL_DBNAME_PROC
27386 {
27387 /* If the SQLITE_SHELL_DBNAME_PROC macro is defined, then it is the name
27388 ** of a C-function that will provide the name of the database file. Use
27389 ** this compile-time option to embed this shell program in larger
@@ -27109,10 +27536,12 @@
27536 }else if( cli_strcmp(z,"-bail")==0 ){
27537 bail_on_error = 1;
27538 }else if( cli_strcmp(z,"-nonce")==0 ){
27539 free(data.zNonce);
27540 data.zNonce = strdup(argv[++i]);
27541 }else if( cli_strcmp(z,"-unsafe-testing")==0 ){
27542 ShellSetFlag(&data,SHFLG_TestingMode);
27543 }else if( cli_strcmp(z,"-safe")==0 ){
27544 /* no-op - catch this on the second pass */
27545 }
27546 }
27547 #ifndef SQLITE_SHELL_FIDDLE
@@ -27271,10 +27700,14 @@
27700 return 0;
27701 }else if( cli_strcmp(z,"-interactive")==0 ){
27702 stdin_is_interactive = 1;
27703 }else if( cli_strcmp(z,"-batch")==0 ){
27704 stdin_is_interactive = 0;
27705 }else if( cli_strcmp(z,"-utf8")==0 ){
27706 #if SHELL_WIN_UTF8_OPT
27707 console_utf8 = 1;
27708 #endif /* SHELL_WIN_UTF8_OPT */
27709 }else if( cli_strcmp(z,"-heap")==0 ){
27710 i++;
27711 }else if( cli_strcmp(z,"-pagecache")==0 ){
27712 i+=2;
27713 }else if( cli_strcmp(z,"-lookaside")==0 ){
@@ -27341,17 +27774,27 @@
27774 readStdin = 0;
27775 break;
27776 #endif
27777 }else if( cli_strcmp(z,"-safe")==0 ){
27778 data.bSafeMode = data.bSafeModePersist = 1;
27779 }else if( cli_strcmp(z,"-unsafe-testing")==0 ){
27780 /* Acted upon in first pass. */
27781 }else{
27782 utf8_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
27783 raw_printf(stderr,"Use -help for a list of options.\n");
27784 return 1;
27785 }
27786 data.cMode = data.mode;
27787 }
27788 #if SHELL_WIN_UTF8_OPT
27789 if( console_utf8 && stdin_is_interactive ){
27790 console_prepare();
27791 }else{
27792 setBinaryMode(stdin, 0);
27793 console_utf8 = 0;
27794 }
27795 #endif
27796
27797 if( !readStdin ){
27798 /* Run all arguments that do not begin with '-' as if they were separate
27799 ** command-line inputs, except for the argToSkip argument which contains
27800 ** the database filename.
27801
+2977 -1365
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -121,10 +121,14 @@
121121
#if defined(_MSC_VER) && !defined(_WIN64)
122122
#undef SQLITE_4_BYTE_ALIGNED_MALLOC
123123
#define SQLITE_4_BYTE_ALIGNED_MALLOC
124124
#endif /* defined(_MSC_VER) && !defined(_WIN64) */
125125
126
+#if !defined(HAVE_LOG2) && defined(_MSC_VER) && _MSC_VER<1800
127
+#define HAVE_LOG2 0
128
+#endif /* !defined(HAVE_LOG2) && defined(_MSC_VER) && _MSC_VER<1800 */
129
+
126130
#endif /* SQLITE_MSVC_H */
127131
128132
/************** End of msvc.h ************************************************/
129133
/************** Continuing where we left off in sqliteInt.h ******************/
130134
@@ -452,11 +456,11 @@
452456
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453457
** [sqlite_version()] and [sqlite_source_id()].
454458
*/
455459
#define SQLITE_VERSION "3.42.0"
456460
#define SQLITE_VERSION_NUMBER 3042000
457
-#define SQLITE_SOURCE_ID "2023-04-10 18:44:00 4c5a3c5fb351cc1c2ce16c33314ce19c53531f09263f87456283d9d756002f9d"
461
+#define SQLITE_SOURCE_ID "2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0"
458462
459463
/*
460464
** CAPI3REF: Run-Time Library Version Numbers
461465
** KEYWORDS: sqlite3_version sqlite3_sourceid
462466
**
@@ -2446,32 +2450,32 @@
24462450
** configuration setting is never used, then the default maximum is determined
24472451
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
24482452
** compile-time option is not set, then the default maximum is 1073741824.
24492453
** </dl>
24502454
*/
2451
-#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2452
-#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2453
-#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2454
-#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2455
-#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2456
-#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2457
-#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2458
-#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2459
-#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2460
-#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2461
-#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2462
-/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2463
-#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2464
-#define SQLITE_CONFIG_PCACHE 14 /* no-op */
2465
-#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2466
-#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2467
-#define SQLITE_CONFIG_URI 17 /* int */
2468
-#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2469
-#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2455
+#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2456
+#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2457
+#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2458
+#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2459
+#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2460
+#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2461
+#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2462
+#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2463
+#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2464
+#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2465
+#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2466
+/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2467
+#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2468
+#define SQLITE_CONFIG_PCACHE 14 /* no-op */
2469
+#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2470
+#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2471
+#define SQLITE_CONFIG_URI 17 /* int */
2472
+#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2473
+#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
24702474
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2471
-#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2472
-#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2475
+#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2476
+#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
24732477
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
24742478
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
24752479
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
24762480
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
24772481
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
@@ -2702,29 +2706,29 @@
27022706
** additional information. This feature can also be turned on and off
27032707
** using the [PRAGMA legacy_alter_table] statement.
27042708
** </dd>
27052709
**
27062710
** [[SQLITE_DBCONFIG_DQS_DML]]
2707
-** <dt>SQLITE_DBCONFIG_DQS_DML</td>
2711
+** <dt>SQLITE_DBCONFIG_DQS_DML</dt>
27082712
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
27092713
** the legacy [double-quoted string literal] misfeature for DML statements
27102714
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
27112715
** default value of this setting is determined by the [-DSQLITE_DQS]
27122716
** compile-time option.
27132717
** </dd>
27142718
**
27152719
** [[SQLITE_DBCONFIG_DQS_DDL]]
2716
-** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
2720
+** <dt>SQLITE_DBCONFIG_DQS_DDL</dt>
27172721
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
27182722
** the legacy [double-quoted string literal] misfeature for DDL statements,
27192723
** such as CREATE TABLE and CREATE INDEX. The
27202724
** default value of this setting is determined by the [-DSQLITE_DQS]
27212725
** compile-time option.
27222726
** </dd>
27232727
**
27242728
** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
2725
-** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</td>
2729
+** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</dt>
27262730
** <dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to
27272731
** assume that database schemas are untainted by malicious content.
27282732
** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
27292733
** takes additional defensive steps to protect the application from harm
27302734
** including:
@@ -2740,20 +2744,20 @@
27402744
** all applications are advised to turn it off if possible. This setting
27412745
** can also be controlled using the [PRAGMA trusted_schema] statement.
27422746
** </dd>
27432747
**
27442748
** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
2745
-** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td>
2749
+** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt>
27462750
** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
27472751
** the legacy file format flag. When activated, this flag causes all newly
27482752
** created database file to have a schema format version number (the 4-byte
27492753
** integer found at offset 44 into the database header) of 1. This in turn
27502754
** means that the resulting database file will be readable and writable by
27512755
** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
27522756
** newly created databases are generally not understandable by SQLite versions
27532757
** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there
2754
-** is now scarcely any need to generated database files that are compatible
2758
+** is now scarcely any need to generate database files that are compatible
27552759
** all the way back to version 3.0.0, and so this setting is of little
27562760
** practical use, but is provided so that SQLite can continue to claim the
27572761
** ability to generate new database files that are compatible with version
27582762
** 3.0.0.
27592763
** <p>Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on,
@@ -2762,27 +2766,39 @@
27622766
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
27632767
** either generated columns or decending indexes.
27642768
** </dd>
27652769
**
27662770
** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2767
-** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2771
+** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt>
27682772
** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
27692773
** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
27702774
** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
27712775
** statistics. For statistics to be collected, the flag must be set on
27722776
** the database handle both when the SQL statement is prepared and when it
27732777
** is stepped. The flag is set (collection of statistics is enabled)
2774
-** by default.</dd>
2778
+** by default. This option takes two arguments: an integer and a pointer to
2779
+** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
2780
+** leave unchanged the statement scanstatus option. If the second argument
2781
+** is not NULL, then the value of the statement scanstatus setting after
2782
+** processing the first argument is written into the integer that the second
2783
+** argument points to.
2784
+** </dd>
27752785
**
27762786
** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2777
-** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2778
-** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2787
+** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</dt>
2788
+** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order
27792789
** in which tables and indexes are scanned so that the scans start at the end
27802790
** and work toward the beginning rather than starting at the beginning and
2781
-** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2782
-** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2783
-** is useful for application testing.</dd>
2791
+** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2792
+** same as setting [PRAGMA reverse_unordered_selects]. This option takes
2793
+** two arguments which are an integer and a pointer to an integer. The first
2794
+** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
2795
+** reverse scan order flag, respectively. If the second argument is not NULL,
2796
+** then 0 or 1 is written into the integer that the second argument points to
2797
+** depending on if the reverse scan order flag is set after processing the
2798
+** first argument.
2799
+** </dd>
27842800
**
27852801
** </dl>
27862802
*/
27872803
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
27882804
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
@@ -2800,11 +2816,11 @@
28002816
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
28012817
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
28022818
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
28032819
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
28042820
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2805
-#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
2821
+#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
28062822
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
28072823
#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
28082824
28092825
/*
28102826
** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -6547,10 +6563,17 @@
65476563
** ^SQLite implements this interface by calling the xSleep()
65486564
** method of the default [sqlite3_vfs] object. If the xSleep() method
65496565
** of the default VFS is not implemented correctly, or not implemented at
65506566
** all, then the behavior of sqlite3_sleep() may deviate from the description
65516567
** in the previous paragraphs.
6568
+**
6569
+** If a negative argument is passed to sqlite3_sleep() the results vary by
6570
+** VFS and operating system. Some system treat a negative argument as an
6571
+** instruction to sleep forever. Others understand it to mean do not sleep
6572
+** at all. ^In SQLite version 3.42.0 and later, a negative
6573
+** argument passed into sqlite3_sleep() is changed to zero before it is relayed
6574
+** down into the xSleep method of the VFS.
65526575
*/
65536576
SQLITE_API int sqlite3_sleep(int);
65546577
65556578
/*
65566579
** CAPI3REF: Name Of The Folder Holding Temporary Files
@@ -8174,13 +8197,13 @@
81748197
** ^The sqlite3_mutex_leave() routine exits a mutex that was
81758198
** previously entered by the same thread. The behavior
81768199
** is undefined if the mutex is not currently entered by the
81778200
** calling thread or is not currently allocated.
81788201
**
8179
-** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
8180
-** sqlite3_mutex_leave() is a NULL pointer, then all three routines
8181
-** behave as no-ops.
8202
+** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
8203
+** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
8204
+** then any of the four routines behaves as a no-op.
81828205
**
81838206
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
81848207
*/
81858208
SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
81868209
SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
@@ -11106,20 +11129,24 @@
1110611129
** [sqlite3session_create()] for details.
1110711130
*/
1110811131
SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
1110911132
1111011133
/*
11111
-** CAPIREF: Conigure a Session Object
11134
+** CAPI3REF: Configure a Session Object
1111211135
** METHOD: sqlite3_session
1111311136
**
1111411137
** This method is used to configure a session object after it has been
11115
-** created. At present the only valid value for the second parameter is
11116
-** [SQLITE_SESSION_OBJCONFIG_SIZE].
11138
+** created. At present the only valid values for the second parameter are
11139
+** [SQLITE_SESSION_OBJCONFIG_SIZE] and [SQLITE_SESSION_OBJCONFIG_ROWID].
1111711140
**
11118
-** Arguments for sqlite3session_object_config()
11141
+*/
11142
+SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
11143
+
11144
+/*
11145
+** CAPI3REF: Options for sqlite3session_object_config
1111911146
**
11120
-** The following values may passed as the the 4th parameter to
11147
+** The following values may passed as the the 2nd parameter to
1112111148
** sqlite3session_object_config().
1112211149
**
1112311150
** <dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd>
1112411151
** This option is used to set, clear or query the flag that enables
1112511152
** the [sqlite3session_changeset_size()] API. Because it imposes some
@@ -11131,16 +11158,25 @@
1113111158
** variable is set to 1 if the sqlite3session_changeset_size() API is
1113211159
** enabled following the current call, or 0 otherwise.
1113311160
**
1113411161
** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
1113511162
** the first table has been attached to the session object.
11163
+**
11164
+** <dt>SQLITE_SESSION_OBJCONFIG_ROWID <dd>
11165
+** This option is used to set, clear or query the flag that enables
11166
+** collection of data for tables with no explicit PRIMARY KEY.
11167
+**
11168
+** Normally, tables with no explicit PRIMARY KEY are simply ignored
11169
+** by the sessions module. However, if this flag is set, it behaves
11170
+** as if such tables have a column "_rowid_ INTEGER PRIMARY KEY" inserted
11171
+** as their leftmost columns.
11172
+**
11173
+** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
11174
+** the first table has been attached to the session object.
1113611175
*/
11137
-SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
11138
-
11139
-/*
11140
-*/
11141
-#define SQLITE_SESSION_OBJCONFIG_SIZE 1
11176
+#define SQLITE_SESSION_OBJCONFIG_SIZE 1
11177
+#define SQLITE_SESSION_OBJCONFIG_ROWID 2
1114211178
1114311179
/*
1114411180
** CAPI3REF: Enable Or Disable A Session Object
1114511181
** METHOD: sqlite3_session
1114611182
**
@@ -13652,11 +13688,11 @@
1365213688
# define SQLITE_INLINE __forceinline
1365313689
#else
1365413690
# define SQLITE_NOINLINE
1365513691
# define SQLITE_INLINE
1365613692
#endif
13657
-#if defined(SQLITE_COVERAGE_TEST)
13693
+#if defined(SQLITE_COVERAGE_TEST) || defined(__STRICT_ANSI__)
1365813694
# undef SQLITE_INLINE
1365913695
# define SQLITE_INLINE
1366013696
#endif
1366113697
1366213698
/*
@@ -18264,10 +18300,11 @@
1826418300
unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
1826518301
unsigned bHasExpr:1; /* Index contains an expression, either a literal
1826618302
** expression, or a reference to a VIRTUAL column */
1826718303
#ifdef SQLITE_ENABLE_STAT4
1826818304
int nSample; /* Number of elements in aSample[] */
18305
+ int mxSample; /* Number of slots allocated to aSample[] */
1826918306
int nSampleCol; /* Size of IndexSample.anEq[] and so on */
1827018307
tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */
1827118308
IndexSample *aSample; /* Samples of the left-most key */
1827218309
tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */
1827318310
tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */
@@ -20020,19 +20057,23 @@
2002020057
# define sqlite3Isalpha(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x02)
2002120058
# define sqlite3Isdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x04)
2002220059
# define sqlite3Isxdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x08)
2002320060
# define sqlite3Tolower(x) (sqlite3UpperToLower[(unsigned char)(x)])
2002420061
# define sqlite3Isquote(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x80)
20062
+# define sqlite3JsonId1(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x42)
20063
+# define sqlite3JsonId2(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x46)
2002520064
#else
2002620065
# define sqlite3Toupper(x) toupper((unsigned char)(x))
2002720066
# define sqlite3Isspace(x) isspace((unsigned char)(x))
2002820067
# define sqlite3Isalnum(x) isalnum((unsigned char)(x))
2002920068
# define sqlite3Isalpha(x) isalpha((unsigned char)(x))
2003020069
# define sqlite3Isdigit(x) isdigit((unsigned char)(x))
2003120070
# define sqlite3Isxdigit(x) isxdigit((unsigned char)(x))
2003220071
# define sqlite3Tolower(x) tolower((unsigned char)(x))
2003320072
# define sqlite3Isquote(x) ((x)=='"'||(x)=='\''||(x)=='['||(x)=='`')
20073
+# define sqlite3JsonId1(x) (sqlite3IsIdChar(x)&&(x)<'0')
20074
+# define sqlite3JsonId2(x) sqlite3IsIdChar(x)
2003420075
#endif
2003520076
SQLITE_PRIVATE int sqlite3IsIdChar(u8);
2003620077
2003720078
/*
2003820079
** Internal function prototypes
@@ -20465,11 +20506,11 @@
2046520506
SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
2046620507
SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
2046720508
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
2046820509
SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
2046920510
SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
20470
-SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr*,const SrcItem*);
20511
+SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int);
2047120512
#ifdef SQLITE_ENABLE_CURSOR_HINTS
2047220513
SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
2047320514
#endif
2047420515
SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*);
2047520516
SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
@@ -22161,11 +22202,11 @@
2216122202
** isalpha() 0x02
2216222203
** isdigit() 0x04
2216322204
** isalnum() 0x06
2216422205
** isxdigit() 0x08
2216522206
** toupper() 0x20
22166
-** SQLite identifier character 0x40
22207
+** SQLite identifier character 0x40 $, _, or non-ascii
2216722208
** Quote character 0x80
2216822209
**
2216922210
** Bit 0x20 is set if the mapped character requires translation to upper
2217022211
** case. i.e. if the character is a lower-case ASCII character.
2217122212
** If x is a lower-case ASCII character, then its upper-case equivalent
@@ -23654,10 +23695,11 @@
2365423695
char validYMD; /* True (1) if Y,M,D are valid */
2365523696
char validHMS; /* True (1) if h,m,s are valid */
2365623697
char validTZ; /* True (1) if tz is valid */
2365723698
char tzSet; /* Timezone was set explicitly */
2365823699
char isError; /* An overflow has occurred */
23700
+ char useSubsec; /* Display subsecond precision */
2365923701
};
2366023702
2366123703
2366223704
/*
2366323705
** Convert zDate into one or more integers according to the conversion
@@ -23968,10 +24010,15 @@
2396824010
}else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
2396924011
return setDateTimeToCurrent(context, p);
2397024012
}else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){
2397124013
setRawDateNumber(p, r);
2397224014
return 0;
24015
+ }else if( (sqlite3StrICmp(zDate,"subsec")==0
24016
+ || sqlite3StrICmp(zDate,"subsecond")==0)
24017
+ && sqlite3NotPureFunc(context) ){
24018
+ p->useSubsec = 1;
24019
+ return setDateTimeToCurrent(context, p);
2397324020
}
2397424021
return 1;
2397524022
}
2397624023
2397724024
/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
@@ -24382,12 +24429,26 @@
2438224429
/*
2438324430
** start of TTTTT
2438424431
**
2438524432
** Move the date backwards to the beginning of the current day,
2438624433
** or month or year.
24434
+ **
24435
+ ** subsecond
24436
+ ** subsec
24437
+ **
24438
+ ** Show subsecond precision in the output of datetime() and
24439
+ ** unixepoch() and strftime('%s').
2438724440
*/
24388
- if( sqlite3_strnicmp(z, "start of ", 9)!=0 ) break;
24441
+ if( sqlite3_strnicmp(z, "start of ", 9)!=0 ){
24442
+ if( sqlite3_stricmp(z, "subsec")==0
24443
+ || sqlite3_stricmp(z, "subsecond")==0
24444
+ ){
24445
+ p->useSubsec = 1;
24446
+ rc = 0;
24447
+ }
24448
+ break;
24449
+ }
2438924450
if( !p->validJD && !p->validYMD && !p->validHMS ) break;
2439024451
z += 9;
2439124452
computeYMD(p);
2439224453
p->validHMS = 1;
2439324454
p->h = p->m = 0;
@@ -24581,11 +24642,15 @@
2458124642
sqlite3_value **argv
2458224643
){
2458324644
DateTime x;
2458424645
if( isDate(context, argc, argv, &x)==0 ){
2458524646
computeJD(&x);
24586
- sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
24647
+ if( x.useSubsec ){
24648
+ sqlite3_result_double(context, (x.iJD - 21086676*(i64)10000000)/1000.0);
24649
+ }else{
24650
+ sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
24651
+ }
2458724652
}
2458824653
}
2458924654
2459024655
/*
2459124656
** datetime( TIMESTRING, MOD, MOD, ...)
@@ -24597,12 +24662,12 @@
2459724662
int argc,
2459824663
sqlite3_value **argv
2459924664
){
2460024665
DateTime x;
2460124666
if( isDate(context, argc, argv, &x)==0 ){
24602
- int Y, s;
24603
- char zBuf[24];
24667
+ int Y, s, n;
24668
+ char zBuf[32];
2460424669
computeYMD_HMS(&x);
2460524670
Y = x.Y;
2460624671
if( Y<0 ) Y = -Y;
2460724672
zBuf[1] = '0' + (Y/1000)%10;
2460824673
zBuf[2] = '0' + (Y/100)%10;
@@ -24619,19 +24684,32 @@
2461924684
zBuf[13] = '0' + (x.h)%10;
2462024685
zBuf[14] = ':';
2462124686
zBuf[15] = '0' + (x.m/10)%10;
2462224687
zBuf[16] = '0' + (x.m)%10;
2462324688
zBuf[17] = ':';
24624
- s = (int)x.s;
24625
- zBuf[18] = '0' + (s/10)%10;
24626
- zBuf[19] = '0' + (s)%10;
24627
- zBuf[20] = 0;
24689
+ if( x.useSubsec ){
24690
+ s = (int)1000.0*x.s;
24691
+ zBuf[18] = '0' + (s/10000)%10;
24692
+ zBuf[19] = '0' + (s/1000)%10;
24693
+ zBuf[20] = '.';
24694
+ zBuf[21] = '0' + (s/100)%10;
24695
+ zBuf[22] = '0' + (s/10)%10;
24696
+ zBuf[23] = '0' + (s)%10;
24697
+ zBuf[24] = 0;
24698
+ n = 24;
24699
+ }else{
24700
+ s = (int)x.s;
24701
+ zBuf[18] = '0' + (s/10)%10;
24702
+ zBuf[19] = '0' + (s)%10;
24703
+ zBuf[20] = 0;
24704
+ n = 20;
24705
+ }
2462824706
if( x.Y<0 ){
2462924707
zBuf[0] = '-';
24630
- sqlite3_result_text(context, zBuf, 20, SQLITE_TRANSIENT);
24708
+ sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
2463124709
}else{
24632
- sqlite3_result_text(context, &zBuf[1], 19, SQLITE_TRANSIENT);
24710
+ sqlite3_result_text(context, &zBuf[1], n-1, SQLITE_TRANSIENT);
2463324711
}
2463424712
}
2463524713
}
2463624714
2463724715
/*
@@ -24644,24 +24722,37 @@
2464424722
int argc,
2464524723
sqlite3_value **argv
2464624724
){
2464724725
DateTime x;
2464824726
if( isDate(context, argc, argv, &x)==0 ){
24649
- int s;
24727
+ int s, n;
2465024728
char zBuf[16];
2465124729
computeHMS(&x);
2465224730
zBuf[0] = '0' + (x.h/10)%10;
2465324731
zBuf[1] = '0' + (x.h)%10;
2465424732
zBuf[2] = ':';
2465524733
zBuf[3] = '0' + (x.m/10)%10;
2465624734
zBuf[4] = '0' + (x.m)%10;
2465724735
zBuf[5] = ':';
24658
- s = (int)x.s;
24659
- zBuf[6] = '0' + (s/10)%10;
24660
- zBuf[7] = '0' + (s)%10;
24661
- zBuf[8] = 0;
24662
- sqlite3_result_text(context, zBuf, 8, SQLITE_TRANSIENT);
24736
+ if( x.useSubsec ){
24737
+ s = (int)1000.0*x.s;
24738
+ zBuf[6] = '0' + (s/10000)%10;
24739
+ zBuf[7] = '0' + (s/1000)%10;
24740
+ zBuf[8] = '.';
24741
+ zBuf[9] = '0' + (s/100)%10;
24742
+ zBuf[10] = '0' + (s/10)%10;
24743
+ zBuf[11] = '0' + (s)%10;
24744
+ zBuf[12] = 0;
24745
+ n = 12;
24746
+ }else{
24747
+ s = (int)x.s;
24748
+ zBuf[6] = '0' + (s/10)%10;
24749
+ zBuf[7] = '0' + (s)%10;
24750
+ zBuf[8] = 0;
24751
+ n = 8;
24752
+ }
24753
+ sqlite3_result_text(context, zBuf, n, SQLITE_TRANSIENT);
2466324754
}
2466424755
}
2466524756
2466624757
/*
2466724758
** date( TIMESTRING, MOD, MOD, ...)
@@ -24788,12 +24879,17 @@
2478824879
case 'M': {
2478924880
sqlite3_str_appendf(&sRes,"%02d",x.m);
2479024881
break;
2479124882
}
2479224883
case 's': {
24793
- i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
24794
- sqlite3_str_appendf(&sRes,"%lld",iS);
24884
+ if( x.useSubsec ){
24885
+ sqlite3_str_appendf(&sRes,"%.3f",
24886
+ (x.iJD - 21086676*(i64)10000000)/1000.0);
24887
+ }else{
24888
+ i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000);
24889
+ sqlite3_str_appendf(&sRes,"%lld",iS);
24890
+ }
2479524891
break;
2479624892
}
2479724893
case 'S': {
2479824894
sqlite3_str_appendf(&sRes,"%02d",(int)x.s);
2479924895
break;
@@ -30667,10 +30763,11 @@
3066730763
nsd = 16 + flag_altform2*10;
3066830764
bufpt = buf;
3066930765
{
3067030766
i64 szBufNeeded; /* Size of a temporary buffer needed */
3067130767
szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30768
+ if( cThousand && e2>0 ) szBufNeeded += (e2+2)/3;
3067230769
if( szBufNeeded > etBUFSIZE ){
3067330770
bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
3067430771
if( bufpt==0 ) return;
3067530772
}
3067630773
}
@@ -30684,14 +30781,16 @@
3068430781
if( e2<0 ){
3068530782
*(bufpt++) = '0';
3068630783
}else if( msd>0 ){
3068730784
for(; e2>=0; e2--){
3068830785
*(bufpt++) = et_getdigit_int(&longvalue,&msd);
30786
+ if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ',';
3068930787
}
3069030788
}else{
3069130789
for(; e2>=0; e2--){
3069230790
*(bufpt++) = et_getdigit(&realvalue,&nsd);
30791
+ if( cThousand && (e2%3)==0 && e2>1 ) *(bufpt++) = ',';
3069330792
}
3069430793
}
3069530794
/* The decimal point */
3069630795
if( flag_dp ){
3069730796
*(bufpt++) = '.';
@@ -34434,17 +34533,19 @@
3443434533
}else{
3443534534
x = v;
3443634535
}
3443734536
i = sizeof(zTemp)-2;
3443834537
zTemp[sizeof(zTemp)-1] = 0;
34439
- do{
34440
- zTemp[i--] = (x%10) + '0';
34538
+ while( 1 /*exit-by-break*/ ){
34539
+ zTemp[i] = (x%10) + '0';
3444134540
x = x/10;
34442
- }while( x );
34443
- if( v<0 ) zTemp[i--] = '-';
34444
- memcpy(zOut, &zTemp[i+1], sizeof(zTemp)-1-i);
34445
- return sizeof(zTemp)-2-i;
34541
+ if( x==0 ) break;
34542
+ i--;
34543
+ };
34544
+ if( v<0 ) zTemp[--i] = '-';
34545
+ memcpy(zOut, &zTemp[i], sizeof(zTemp)-i);
34546
+ return sizeof(zTemp)-1-i;
3444634547
}
3444734548
3444834549
/*
3444934550
** Compare the 19-character string zNum against the text representation
3445034551
** value 2^63: 9223372036854775808. Return negative, zero, or positive
@@ -34605,11 +34706,13 @@
3460534706
for(i=2; z[i]=='0'; i++){}
3460634707
for(k=i; sqlite3Isxdigit(z[k]); k++){
3460734708
u = u*16 + sqlite3HexToInt(z[k]);
3460834709
}
3460934710
memcpy(pOut, &u, 8);
34610
- return (z[k]==0 && k-i<=16) ? 0 : 2;
34711
+ if( k-i>16 ) return 2;
34712
+ if( z[k]!=0 ) return 1;
34713
+ return 0;
3461134714
}else
3461234715
#endif /* SQLITE_OMIT_HEX_INTEGER */
3461334716
{
3461434717
return sqlite3Atoi64(z, pOut, sqlite3Strlen30(z), SQLITE_UTF8);
3461534718
}
@@ -34641,11 +34744,11 @@
3464134744
&& sqlite3Isxdigit(zNum[2])
3464234745
){
3464334746
u32 u = 0;
3464434747
zNum += 2;
3464534748
while( zNum[0]=='0' ) zNum++;
34646
- for(i=0; sqlite3Isxdigit(zNum[i]) && i<8; i++){
34749
+ for(i=0; i<8 && sqlite3Isxdigit(zNum[i]); i++){
3464734750
u = u*16 + sqlite3HexToInt(zNum[i]);
3464834751
}
3464934752
if( (u&0x80000000)==0 && sqlite3Isxdigit(zNum[i])==0 ){
3465034753
memcpy(pValue, &u, 4);
3465134754
return 1;
@@ -37137,11 +37240,11 @@
3713737240
# define SQLITE_ENABLE_LOCKING_STYLE 0
3713837241
# endif
3713937242
#endif
3714037243
3714137244
/* Use pread() and pwrite() if they are available */
37142
-#if defined(__APPLE__)
37245
+#if defined(__APPLE__) || defined(__linux__)
3714337246
# define HAVE_PREAD 1
3714437247
# define HAVE_PWRITE 1
3714537248
#endif
3714637249
#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64)
3714737250
# undef USE_PREAD
@@ -40387,16 +40490,10 @@
4038740490
4038840491
/*
4038940492
** Seek to the offset passed as the second argument, then read cnt
4039040493
** bytes into pBuf. Return the number of bytes actually read.
4039140494
**
40392
-** NB: If you define USE_PREAD or USE_PREAD64, then it might also
40393
-** be necessary to define _XOPEN_SOURCE to be 500. This varies from
40394
-** one system to another. Since SQLite does not define USE_PREAD
40395
-** in any form by default, we will not attempt to define _XOPEN_SOURCE.
40396
-** See tickets #2741 and #2681.
40397
-**
4039840495
** To avoid stomping the errno value on a failed read the lastErrno value
4039940496
** is set before returning.
4040040497
*/
4040140498
static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
4040240499
int got;
@@ -50419,11 +50516,11 @@
5041950516
&extendedParameters);
5042050517
if( h!=INVALID_HANDLE_VALUE ) break;
5042150518
if( isReadWrite ){
5042250519
int rc2, isRO = 0;
5042350520
sqlite3BeginBenignMalloc();
50424
- rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO);
50521
+ rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ, &isRO);
5042550522
sqlite3EndBenignMalloc();
5042650523
if( rc2==SQLITE_OK && isRO ) break;
5042750524
}
5042850525
}while( winRetryIoerr(&cnt, &lastErrno) );
5042950526
#else
@@ -50436,11 +50533,11 @@
5043650533
NULL);
5043750534
if( h!=INVALID_HANDLE_VALUE ) break;
5043850535
if( isReadWrite ){
5043950536
int rc2, isRO = 0;
5044050537
sqlite3BeginBenignMalloc();
50441
- rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO);
50538
+ rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ, &isRO);
5044250539
sqlite3EndBenignMalloc();
5044350540
if( rc2==SQLITE_OK && isRO ) break;
5044450541
}
5044550542
}while( winRetryIoerr(&cnt, &lastErrno) );
5044650543
#endif
@@ -50456,11 +50553,11 @@
5045650553
NULL);
5045750554
if( h!=INVALID_HANDLE_VALUE ) break;
5045850555
if( isReadWrite ){
5045950556
int rc2, isRO = 0;
5046050557
sqlite3BeginBenignMalloc();
50461
- rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO);
50558
+ rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ, &isRO);
5046250559
sqlite3EndBenignMalloc();
5046350560
if( rc2==SQLITE_OK && isRO ) break;
5046450561
}
5046550562
}while( winRetryIoerr(&cnt, &lastErrno) );
5046650563
}
@@ -50678,10 +50775,17 @@
5067850775
UNUSED_PARAMETER(pVfs);
5067950776
5068050777
SimulateIOError( return SQLITE_IOERR_ACCESS; );
5068150778
OSTRACE(("ACCESS name=%s, flags=%x, pResOut=%p\n",
5068250779
zFilename, flags, pResOut));
50780
+
50781
+ if( zFilename==0 ){
50782
+ *pResOut = 0;
50783
+ OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n",
50784
+ zFilename, pResOut, *pResOut));
50785
+ return SQLITE_OK;
50786
+ }
5068350787
5068450788
zConverted = winConvertFromUtf8Filename(zFilename);
5068550789
if( zConverted==0 ){
5068650790
OSTRACE(("ACCESS name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename));
5068750791
return SQLITE_IOERR_NOMEM_BKPT;
@@ -52835,15 +52939,19 @@
5283552939
# define pcacheTrace(X) if(sqlite3PcacheTrace){sqlite3DebugPrintf X;}
5283652940
static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
5283752941
PgHdr *pPg;
5283852942
unsigned char *a;
5283952943
int j;
52840
- pPg = (PgHdr*)pLower->pExtra;
52841
- printf("%3lld: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52842
- a = (unsigned char *)pLower->pBuf;
52843
- for(j=0; j<12; j++) printf("%02x", a[j]);
52844
- printf(" ptr %p\n", pPg);
52944
+ if( pLower==0 ){
52945
+ printf("%3d: NULL\n", i);
52946
+ }else{
52947
+ pPg = (PgHdr*)pLower->pExtra;
52948
+ printf("%3d: nRef %2lld flgs %02x data ", i, pPg->nRef, pPg->flags);
52949
+ a = (unsigned char *)pLower->pBuf;
52950
+ for(j=0; j<12; j++) printf("%02x", a[j]);
52951
+ printf(" ptr %p\n", pPg);
52952
+ }
5284552953
}
5284652954
static void pcacheDump(PCache *pCache){
5284752955
int N;
5284852956
int i;
5284952957
sqlite3_pcache_page *pLower;
@@ -52852,13 +52960,12 @@
5285252960
if( pCache->pCache==0 ) return;
5285352961
N = sqlite3PcachePagecount(pCache);
5285452962
if( N>sqlite3PcacheMxDump ) N = sqlite3PcacheMxDump;
5285552963
for(i=1; i<=N; i++){
5285652964
pLower = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, i, 0);
52857
- if( pLower==0 ) continue;
5285852965
pcachePageTrace(i, pLower);
52859
- if( ((PgHdr*)pLower)->pPage==0 ){
52966
+ if( pLower && ((PgHdr*)pLower)->pPage==0 ){
5286052967
sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, pLower, 0);
5286152968
}
5286252969
}
5286352970
}
5286452971
#else
@@ -58242,10 +58349,12 @@
5824258349
*/
5824358350
static int pager_truncate(Pager *pPager, Pgno nPage){
5824458351
int rc = SQLITE_OK;
5824558352
assert( pPager->eState!=PAGER_ERROR );
5824658353
assert( pPager->eState!=PAGER_READER );
58354
+ PAGERTRACE(("Truncate %d npage %u\n", PAGERID(pPager), nPage));
58355
+
5824758356
5824858357
if( isOpen(pPager->fd)
5824958358
&& (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
5825058359
){
5825158360
i64 currentSize, newSize;
@@ -61159,10 +61268,14 @@
6115961268
6116061269
assert( !isOpen(pPager->fd) || !MEMDB );
6116161270
if( !isOpen(pPager->fd) || pPager->dbSize<pgno || noContent ){
6116261271
if( pgno>pPager->mxPgno ){
6116361272
rc = SQLITE_FULL;
61273
+ if( pgno<=pPager->dbSize ){
61274
+ sqlite3PcacheRelease(pPg);
61275
+ pPg = 0;
61276
+ }
6116461277
goto pager_acquire_err;
6116561278
}
6116661279
if( noContent ){
6116761280
/* Failure to set the bits in the InJournal bit-vectors is benign.
6116861281
** It merely means that we might do some extra work to journal a
@@ -61323,14 +61436,16 @@
61323