Fossil

Check-in Differences
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From trunk To js-hamburger-menu

2023-12-08
10:20
In the HTML diff output, honour the user's light/dark mode browser setting. ... (Leaf check-in: a2e6b31a user: danield tags: trunk)
2023-12-07
20:06
Add the --dark option to "fossil diff --tk" ... (check-in: 5a8516df user: drh tags: trunk)
2019-01-02
15:31
Enhancements to the hamburger menu mechanism. ... (check-in: 724a9b8f user: drh tags: trunk)
07:24
Oops, fallen for testing built-in versus customized skin, fix the previous check-in. ... (Closed-Leaf check-in: dac9293b user: florian tags: js-hamburger-menu)
07:03
Less rigid string-to-number conversion for the custom "data-anim-ms" attribute. ... (check-in: e4a18b67 user: florian tags: js-hamburger-menu)

Added .dockerignore.



























1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
_FOSSIL_
.fslckout
ajax
art
autosetup
bld
compat
debian
fossil
fossil.exe
setup
src
test
tools
win
wbld
win
www
*.a
*.lib
*.log
*.manifest
*.o
*.obj
*.pdb
*.res

Deleted .editorconfig.

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
# EditorConfig (https://editorconfig.com) Configuration for Fossil
#
# Following https://fossil-scm.org/fossil/doc/trunk/www/style.wiki
#

# Defaults for all files
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2

[{Makefile,Makefile.*,*.mk}]
indent_style = tab

Changes to .fossil-settings/binary-glob.

1
2
3
4
5
6
7
8
9
10
11
12
13
1
2
3
4
5
6
7

8
9
10
11








-




-
*.gif
*.ico
*.jpg
*.odp
*.dia
*.pdf
*.png
*.wav
compat/zlib/contrib/blast/test.pk
compat/zlib/contrib/dotzlib/DotZLib.chm
compat/zlib/contrib/puff/zeros.raw
compat/zlib/zlib.3.pdf
extsrc/pikchr.wasm

Changes to .fossil-settings/clean-glob.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18











-







*.a
*.lib
*.manifest
*.o
*.obj
*.pdb
*.res
Makefile
autosetup/jimsh0
autosetup/jimsh0.exe
bld/*
msvcbld/*
wbld/*
win/*.c
win/*.h
win/*.exe
win/headers
win/linkopts
autoconfig.h

Changes to .fossil-settings/ignore-glob.

1
2
3
4
5
6
7
8
9
1
2


3
4
5
6
7


-
-





compat/openssl*
compat/tcl*
compat/zlib/contrib/ada/*
compat/zlib/doc/*
fossil
fossil.exe
win/fossil.exe
*shell-see.*
*sqlite3-see.*

Changes to BUILD.txt.

53
54
55
56
57
58
59
60
61


62
63
64
65
66
67


68
69
70
71


72
73

74
75
76
77
78

53
54
55
56
57
58
59


60
61
62
63
64
65


66
67
68
69


70
71
72

73
74
75
76
77

78







-
-
+
+




-
-
+
+


-
-
+
+

-
+




-
+

* The configure script (if used) examines the options given
  and runs various tests with the C compiler to create Makefile
  from the Makefile.in template as well as autoconfig.h

* The Makefile just sets up a few macros and then invokes the
  real makefile in src/main.mk.  The src/main.mk makefile is
  automatically generated by a TCL script found at tools/makemake.tcl.
  Do not edit src/main.mk directly.  Update tools/makemake.tcl and
  automatically generated by a TCL script found at src/makemake.tcl.
  Do not edit src/main.mk directly.  Update src/makemake.tcl and
  then rerun it.

* The *.h header files are automatically generated using a program
  called "makeheaders".  Source code to the makeheaders program is
  found in tools/makeheaders.c.  Documentation is found in
  tools/makeheaders.html.
  found in src/makeheaders.c.  Documentation is found in
  src/makeheaders.html.

* Most *.c source files are preprocessed using a program called
  "translate".  The sources to translate are found in tools/translate.c.
  A header comment in tools/translate.c explains in detail what it does.
  "translate".  The sources to translate are found in src/translate.c.
  A header comment in src/translate.c explains in detail what it does.

* The tools/mkindex.c program generates some C code that implements
* The src/mkindex.c program generates some C code that implements
  static lookup tables.  See the header comment in the source code
  for details on what it does.

Additional information on the build process is available from
http://fossil-scm.org/home/doc/trunk/www/makefile.wiki
http://www.fossil-scm.org/fossil/doc/trunk/www/makefile.wiki

Changes to Dockerfile.


1

2


3
4
5
6
7


8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34

35
36
37
38
39


40
41
42
43
44
45

46
47
48

49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65

66
67
68
69
70

71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86

87
88
89
90
1

2

3
4
5




6
7







8


9








10
11








12





13
14






15

16

17




18


19










20
21




22






23

24



25




26




+
-
+
-
+
+

-
-
-
-
+
+
-
-
-
-
-
-
-

-
-
+
-
-
-
-
-
-
-
-
+

-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
+
-
-
-
-
-
-
+
-

-
+
-
-
-
-
+
-
-

-
-
-
-
-
-
-
-
-
-
+

-
-
-
-
+
-
-
-
-
-
-

-
+
-
-
-

-
-
-
-
+
-
-
-
-
###
# syntax=docker/dockerfile:1.3
#   Dockerfile for Fossil
# See www/containers.md for documentation on how to use this file.
###
FROM fedora:28

## ---------------------------------------------------------------------
## STAGE 1: Build static Fossil binary
## ---------------------------------------------------------------------

### Now install some additional parts we will need for the build
RUN dnf update -y && dnf install -y gcc make tcl tcl-devel zlib-devel openssl-devel tar && dnf clean all && groupadd -r fossil -g 433 && useradd -u 431 -r -g fossil -d /opt/fossil -s /sbin/nologin -c "Fossil user" fossil
### We aren't pinning to a more stable version of Alpine because we want
### to build with the latest tools and libraries available in case they
### fixed something that matters to us since the last build.  Everything
### below depends on this layer, and so, alas, we toss this container's
### cache on Alpine's release schedule, roughly once a month.
FROM alpine:latest AS bld
WORKDIR /fsl

### Bake the basic Alpine Linux into a base layer so it only changes
### when the upstream image is updated or we change the package set.
### If you want to build "trunk", change the next line accordingly.
RUN set -x                                                             \
    && apk update                                                      \
    && apk upgrade --no-cache                                          \
    && apk add --no-cache                                              \
         gcc make                                                      \
         linux-headers musl-dev                                        \
         openssl-dev openssl-libs-static                               \
         zlib-dev zlib-static
ENV FOSSIL_INSTALL_VERSION release

### Build Fossil as a separate layer so we don't have to rebuild the
### Alpine environment for each iteration of Fossil's dev cycle.
###
### We must cope with a bizarre ADD misfeature here: it unpacks tarballs
### automatically when you give it a local file name but not if you give
### it a /tarball URL!  It matters because we default to a URL in case
### you're building outside a Fossil checkout, but when building via the
### container-image target, we avoid a costly hit on fossil-scm.org
RUN curl "https://www.fossil-scm.org/index.html/tarball/fossil-src.tar.gz?name=fossil-src&uuid=${FOSSIL_INSTALL_VERSION}" | tar zx
### by leveraging its DVCS nature via the "tarball" command and passing
### the resulting file's name in.
ARG FSLCFG=""
ARG FSLVER="trunk"
ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
RUN cd fossil-src && ./configure --disable-fusefs --json --with-th1-docs --with-th1-hooks --with-tcl=1 --with-tcl-stubs --with-tcl-private-stubs
RUN cd fossil-src/src && mv main.c main.c.orig && sed s/\"now\"/0/ <main.c.orig >main.c
ENV FSLSTB=/fsl/src.tar.gz
ADD $FSLURL $FSLSTB
RUN set -x                                                             \
    && if [ -d $FSLSTB ] ;                                             \
       then mv $FSLSTB/src . ;                                         \
       else tar -xf src.tar.gz ; fi                                    \
RUN cd fossil-src && make && strip fossil && cp fossil /usr/bin && cd .. && rm -rf fossil-src && chmod a+rx /usr/bin/fossil && mkdir -p /opt/fossil && chown fossil:fossil /opt/fossil
    && src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j16


### Build is done, remove modules no longer needed
## ---------------------------------------------------------------------
## STAGE 2: Pare that back to the bare essentials.
## ---------------------------------------------------------------------

RUN dnf remove -y gcc make zlib-devel tcl-devel openssl-devel tar && dnf clean all
FROM busybox AS os
ARG UID=499

### Set up that base OS for our specific use without tying it to
### anything likely to change often.  So long as the user leaves
### UID alone, this layer will be durable.
RUN set -x                                                             \
    && mkdir e log museum                                              \
    && echo "root:x:0:0:Admin:/:/false"                   > /e/passwd  \
    && echo "root:x:0:root"                               > /e/group   \
    && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /e/passwd  \
    && echo "fossil:x:${UID}:fossil"                     >> /e/group

USER fossil

## ---------------------------------------------------------------------
## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
## ---------------------------------------------------------------------

ENV HOME /opt/fossil
FROM scratch AS run
COPY --from=bld --chmod=755           /fsl/fossil /bin/
COPY --from=os  --chmod=600           /e/*        /etc/
COPY --from=os  --chmod=1777          /tmp        /tmp/
COPY --from=os  --chown=fossil:fossil /log        /log/
COPY --from=os  --chown=fossil:fossil /museum     /museum/


EXPOSE 8080
## ---------------------------------------------------------------------
## RUN!
## ---------------------------------------------------------------------

ENV PATH "/bin"
EXPOSE 8080/tcp
USER fossil
ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
CMD ["/usr/bin/fossil", "server", "--create", "--user", "admin", "/opt/fossil/repository.fossil"]
CMD [                       \
    "--create",             \
    "--jsmode", "bundled",  \
    "--user",   "admin" ]

Changes to Makefile.classic.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1
2
3
4
5
6
7
8
9
10
11






12
13
14
15
16
17
18











-
-
-
-
-
-







#!/usr/bin/make
#
# This is the top-level makefile for Fossil when the build is occurring
# on a unix platform.  This works out-of-the-box on most unix platforms.
# But you are free to vary some of the definitions if desired.
#
#### The toplevel directory of the source tree.  Fossil can be built
#    in a directory that is separate from the source tree.  Just change
#    the following to point from the build directory to the src/ folder.
#
SRCDIR = ./src
#### Upstream source files included directly in this repository.
#
SRCDIR_extsrc = ./extsrc
#### In-tree tools such as code generators and translators:
#
SRCDIR_tools = ./tools

#### The directory into which object code files should be written.
#
#
OBJDIR = ./bld

#### C Compiler and options for use in building executables that
40
41
42
43
44
45
46




47
48
49



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67






68
69
70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65



66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83
84
85
86
87








88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104


105







+
+
+
+



+
+
+















-
-
-
+
+
+
+
+
+


-
+













-
-
-
-
-
-
-
-

















-
-

#    the finished binary for fossil.  The BCC compiler above is used
#    for building intermediate code-generator tools.
#
#TCC = gcc -O6
#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
TCC = gcc -g -Os -Wall

# To use the included miniz library
# FOSSIL_ENABLE_MINIZ = 1
# TCC += -DFOSSIL_ENABLE_MINIZ

# To add support for HTTPS
TCC += -DFOSSIL_ENABLE_SSL

# To enable legacy mv/rm support
TCC += -DFOSSIL_ENABLE_LEGACY_MV_RM=1

#### We sometimes add the -static option here so that we can build a
#    static executable that will run in a chroot jail.
#LIB = -static
TCC += -DFOSSIL_DYNAMIC_BUILD=1

TCCFLAGS = $(CFLAGS)

# We don't attempt to use libedit or libreadline in this simplified
# build system (contrast auto.def and Makefile.in) so use the included
# copy of linenoise.  MinGW can't make use of this, but linenoise is
# ifdef'd out elsewhere for that platform.  Note that this is a make
# flag handled in src/main.mk, not a C preprocessor flag.
USE_LINENOISE := 1

#### Extra arguments for linking the finished binary.  Fossil needs
#    to link against the Z-Lib compression library.  There are no
#    other required dependencies.
ZLIB_LIB = -lz
#    to link against the Z-Lib compression library unless the miniz
#    library in the source tree is being used.  There are no other
#    required dependencies.
ZLIB_LIB.0 = -lz
ZLIB_LIB.1 =
ZLIB_LIB.  = $(ZLIB_LIB.0)

# If using zlib:
LIB += $(ZLIB_LIB) $(LDFLAGS)
LIB += $(ZLIB_LIB.$(FOSSIL_ENABLE_MINIZ)) $(LDFLAGS)

# If using HTTPS:
LIB += -lcrypto -lssl

# Many platforms put cos() needed by src/piechart.c in libm, rather than
# in libc.  We cannot enable this by default because libm doesn't exist
# everywhere.
#LIB += -lm

#### Tcl shell for use in running the fossil testsuite.  If you do not
#    care about testing the end result, this can be blank.
#
TCLSH = tclsh

CFLAGS += -fPIE
CPPFLAGS += -I. -I$(SRCDIR_extsrc) -I$(SRCDIR)
LIB = -lm -lz -lssl
INSTALLDIR = $(DESTDIR)$(prefix)/bin
SQLITE3_ORIGINAL = 0
USE_LINENOISE = 1


# You should not need to change anything below this line
###############################################################################
#
# Automatic platform-specific options.
HOST_OS_CMD = uname -s
HOST_OS = $(HOST_OS_CMD:sh)

LIB.SunOS= -lsocket -lnsl
LIB += $(LIB.$(HOST_OS))

TCC.DragonFly += -DUSE_PREAD
TCC.FreeBSD += -DUSE_PREAD
TCC.NetBSD += -DUSE_PREAD
TCC.OpenBSD += -DUSE_PREAD
TCC += $(TCC.$(HOST_OS))

APPNAME = fossil$(E)
.PHONY: all tags
include $(SRCDIR)/main.mk

Changes to Makefile.in.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1
2
3
4
5
6
7
8
9
10
11







12
13
14
15
16
17
18











-
-
-
-
-
-
-







#!/usr/bin/make
#
# This is the top-level makefile for Fossil when the build is occurring
# on a unix platform.  This works out-of-the-box on most unix platforms.
# But you are free to vary some of the definitions if desired.
#
#### The toplevel directory of the source tree.  Fossil can be built
#    in a directory that is separate from the source tree.  Just change
#    the following to point from the build directory to the src/ folder.
#
SRCDIR = @srcdir@/src
TOPDIR = @srcdir@
#### Upstream source files included directly in this repository.
#
SRCDIR_extsrc = @srcdir@/extsrc
#### In-tree tools such as code generators and translators:
#
SRCDIR_tools = @srcdir@/tools

#### The directory into which object code files should be written.
#    Having a "./" prefix in the value of this variable breaks our use of the
#    "makeheaders" tool when running make on the MinGW platform, apparently
#    due to some command line argument manipulation performed automatically
#    by the shell.
#
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
35
36
37
38
39
40
41

42
43

44







45
46









47
48
49





50
















51
52
53
54
55

56
57
58
59




60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76























































-


-
+
-
-
-
-
-
-
-


-
-
-
-
-
-
-
-
-



-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-





-




-
-
-
-

















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

#### Tcl shell for use in running the fossil testsuite.  If you do not
#    care about testing the end result, this can be blank.
#
TCLSH = @TCLSH@

CFLAGS = @CFLAGS@
CFLAGS_INCLUDE = @CFLAGS_INCLUDE@
LIB =	@LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
BCCFLAGS =	@CPPFLAGS@ $(CFLAGS)
TCCFLAGS =	@EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H
TCCFLAGS =	@EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
#
# Fuzzing may be enable by appending -fsanitize=fuzzer -DFOSSIL_FUZZ
# to the TCCFLAGS variable.
# For more thorouth (but also slower) investigation
#      -fsanitize=fuzzer,undefined,address
# might be more useful.

INSTALLDIR = $(DESTDIR)@prefix@/bin
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
SQLITE3_SRC.2 = @SQLITE3_SRC.2@
SQLITE3_OBJ.2 = @SQLITE3_OBJ.2@
SQLITE3_SHELL_SRC.2 = @SQLITE3_SHELL_SRC.2@
SQLITE3_ORIGIN = @SQLITE3_ORIGIN@
# SQLITE3_ORIGIN changes...
#  SQLITE3_SRC:
#   0=src/sqlite3.c, 1=src/sqlite3-see.c, 2=$(SQLITE3_SRC.2)
#  SQLITE3_SHELL_SRC:
#   0=src/shell.c, 1=src/shell-see.c, 2=$(SQLITE3_SHELL_SRC.2)
USE_LINENOISE = @USE_LINENOISE@
USE_MMAN_H = @USE_MMAN_H@
USE_SEE = @USE_SEE@
APPNAME = fossil
#
# APPNAME = fossil-fuzz
# may be more appropriate for fuzzing.

FOSSIL_ENABLE_MINIZ = @FOSSIL_ENABLE_MINIZ@
#### Emscripten stuff for optionally doing in-tree builds
# of any WASM components. We store precompiled WASM in the the SCM, so
# this is only useful for people who actively work on WASM
# components. EMSDK_ENV refers to the "environment" script which comes
# with the Emscripten SDK package:
# https://emscripten.org/docs/getting_started/downloads.html
EMSDK_HOME = @EMSDK_HOME@
EMSDK_ENV = @EMSDK_ENV@
EMCC_OPT = @EMCC_OPT@
EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh

# MAKE_COMPILATION_DB (yes/no) determines whether or not the
# compile_commands.json file will be generated.
MAKE_COMPILATION_DB = @MAKE_COMPILATION_DB@

.PHONY: all tags

include $(SRCDIR)/main.mk

distclean: clean
	-rm -f autoconfig.h config.log Makefile
	-rm -f cscope.out tags

reconfig:
	@AUTOREMAKE@

tags:
	ctags -R @srcdir@/src
	@COLLECT_CSCOPE_DATA@

# Automatically reconfigure whenever an autosetup file or one of the
# make source files change.
#
# The "touch" is necessary to avoid a make loop due to a new upstream
# feature in autosetup (GH 0a71e3c3b7) which rewrites *.in outputs only
# if doing so will write different contents; otherwise, it leaves them
# alone so the mtime doesn't change.  This means that if you change one
# our depdendencies besides Makefile.in, we'll reconfigure but Makefile
# won't change, so this rule will remain out of date, so we'll reconfig
# but Makefile won't change, so we'll reconfig but... endlessly.
#
# This is also why we repeat the reconfig target's command here instead
# of delegating to it with "$(MAKE) reconfig": having children running
# around interfering makes this failure mode even worse.
Makefile: @srcdir@/Makefile.in $(SRCDIR)/main.mk @AUTODEPS@
	@AUTOREMAKE@
	touch @builddir@/Makefile

# Container stuff
SRCTB := src-@FOSSIL_CI_PFX@.tar.gz
IMGVER := fossil:@FOSSIL_CI_PFX@
CNTVER := fossil-@FOSSIL_CI_PFX@
CENGINE := docker
container:
	$(CENGINE) image inspect $(IMGVER) > /dev/null 2>&1 || \
		$(MAKE) container-image
	$(CENGINE) container inspect $(CNTVER) > /dev/null 2>&1 || \
		$(CENGINE) create \
			--name $(CNTVER) \
			--cap-drop AUDIT_WRITE \
			--cap-drop CHOWN \
			--cap-drop FSETID \
			--cap-drop KILL \
			--cap-drop MKNOD \
			--cap-drop NET_BIND_SERVICE \
			--cap-drop NET_RAW \
			--cap-drop SETFCAP \
			--cap-drop SETPCAP \
			--publish 8080:8080 \
			$(DCFLAGS) $(IMGVER) $(DCCMD)

container-clean:
	-$(CENGINE) container kill $(CNTVER)
	-$(CENGINE) container rm   $(CNTVER)
	-$(CENGINE) image     rm   $(IMGVER)

container-image:
	$(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
	$(CENGINE) buildx build \
		--load \
		--tag $(IMGVER) \
		--build-arg FSLURL=$(SRCTB) \
		$(DBFLAGS) @srcdir@
	rm -f $(SRCTB)

container-run container-start: container
	$(CENGINE) start $(DSFLAGS) $(CNTVER)
	@sleep 1   # decrease likelihood of logging race condition
	$(CENGINE) container logs $(CNTVER)

container-stop:
	$(CENGINE) stop $(CNTVER)

container-version:
	@echo $(CNTVER)

Changes to Makefile.osx-jaguar.

36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

62
63

64
65
66

67
68
69
70
71
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71
72
73







-
+


















+

-
+



+





#
BCC = cc
BCCFLAGS = $(CFLAGS)

#### The suffix to add to final executable file.  When cross-compiling
#    to windows, make this ".exe".  Otherwise leave it blank.
#
E =
E = 

TCC = cc
TCCFLAGS = $(CFLAGS)

#### Tcl shell for use in running the fossil testsuite.  If you do not
#    care about testing the end result, this can be blank.
#
TCLSH = tclsh

# LIB =	  -lz
LIB = compat/zlib/libz.a
TCC +=	  -g -O0 -DHAVE_AUTOCONFIG_H
TCC += -Icompat/zlib
TCC += -DSQLITE_WITHOUT_ZONEMALLOC
TCC += -D_BSD_SOURCE=1
TCC += -DWITHOUT_ICONV
TCC += -Dsocklen_t=int
TCC += -DSQLITE_MAX_MMAP_SIZE=0
TCC += -DFOSSIL_ENABLE_LEGACY_MV_RM=1
INSTALLDIR = $(DESTDIR)/usr/local/bin
USE_SYSTEM_SQLITE =
USE_SYSTEM_SQLITE = 
USE_LINENOISE = 1
# FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
FOSSIL_ENABLE_TCL = 0
FOSSIL_ENABLE_MINIZ = 0

include $(SRCDIR)/main.mk

distclean: clean
	rm -f autoconfig.h config.log Makefile

Deleted README.md.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# About Fossil

Fossil is a distributed version control system that has been widely
used since 2007.  Fossil was originally designed to support the
[SQLite](https://sqlite.org) project but has been adopted by many other
projects as well.

Fossil is self-hosting at <https://fossil-scm.org>.

If you are reading this on GitHub, then you are looking at a Git mirror
of the self-hosting Fossil repository.  The purpose of that mirror is to
test and exercise Fossil's ability to export a Git mirror.  Nobody much
uses the GitHub mirror, except to verify that the mirror logic works.  If
you want to know more about Fossil, visit the official self-hosting site
linked above.

Changes to VERSION.

1


1
-
+
2.24
2.7

Added ajax/README.







































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This is the README for how to set up the Fossil/JSON test web page
under Apache on Unix systems. This is only intended only for
Fossil/JSON developers/tinkerers:

First, copy cgi-bin/fossil-json.cgi.example to
cgi-bin/fossil-json.cgi.  Edit it and correct the paths to the fossil
binary and the repo you want to serve. Make it executable.

MAKE SURE that the fossil repo you use is world-writable OR that your
Web/CGI server is set up to run as the user ID of the owner of the
fossil file. ALSO: the DIRECTORY CONTAINING the repo file must be
writable by the CGI process.

Next, set up an apache vhost entry. Mine looks like:

<VirtualHost *:80>
    ServerAlias fjson
    ScriptAlias /cgi-bin/ /home/stephan/cvs/fossil/fossil-json/ajax/cgi-bin/
    DocumentRoot /home/stephan/cvs/fossil/fossil-json/ajax
</VirtualHost>

Now add your preferred vhost name (fjson in the above example) to /etc/hosts:

  127.0.0.1 ...other aliases... fjson

Restart your Apache.

Now visit: http://fjson/

that will show the test/demo page. If it doesn't, edit index.html and
make sure that:

  WhAjaj.Connector.options.ajax.url = ...;

points to your CGI script. In theory you can also do this over fossil
standalone server mode, but i haven't yet tested that particular test
page in that mode.

Added ajax/cgi-bin/fossil-json.cgi.example.



1
2
+
+
#!/path/to/fossil/binary
repository: /path/to/repo.fsl

Added ajax/i-test/rhino-shell.js.

















































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
var FShell = {
    serverUrl:
        'http://localhost:8080'
        //'http://fjson/cgi-bin/fossil-json.cgi'
        //'http://192.168.1.62:8080'
        //'http://fossil.wanderinghorse.net/repos/fossil-json-java/index.cgi'
        ,
    verbose:false,
    prompt:"fossil shell > ",
    wiki:{},
    consol:java.lang.System.console(),
    v:function(msg){
        if(this.verbose){
            print("VERBOSE: "+msg);
        }
    }
};
(function bootstrap() {
    var srcdir = '../js/';
    var includes = [srcdir+'json2.js',
                    srcdir+'whajaj.js',
                    srcdir+'fossil-ajaj.js'
                    ];
    for( var i in includes ) {
        load(includes[i]);
    }
    WhAjaj.Connector.prototype.sendImpl = WhAjaj.Connector.sendImpls.rhino;
    FShell.fossil = new FossilAjaj({
        asynchronous:false, /* rhino-based impl doesn't support async. */
        timeout:10000,
        url:FShell.serverUrl
    });
    print("Server: "+FShell.serverUrl);
    var cb = FShell.fossil.ajaj.callbacks;
    cb.beforeSend = function(req,opt){
        if(!FShell.verbose) return;
        print("SENDING REQUEST: AJAJ options="+JSON.stringify(opt));
        if(req) print("Request envelope="+WhAjaj.stringify(req));
    };
    cb.afterSend = function(req,opt){
        //if(!FShell.verbose) return;
        //print("REQUEST RETURNED: opt="+JSON.stringify(opt));
        //if(req) print("Request="+WhAjaj.stringify(req));
    };
    cb.onError = function(req,opt){
        //if(!FShell.verbose) return;
        print("ERROR: "+WhAjaj.stringify(opt));
    };
    cb.onResponse = function(resp,req){
        if(!FShell.verbose) return;
        if(resp && resp.resultCode){
            print("Response contains error info: "+resp.resultCode+": "+resp.resultText);
        }
        print("GOT RESPONSE: "+(('string'===typeof resp) ? resp : WhAjaj.stringify(resp)));
    };
    FShell.fossil.HAI({
        onResponse:function(resp,opt){
            assertResponseOK(resp);
        }
    });
})();

/**
    Throws an exception of cond is a falsy value.
*/
function assert(cond, descr){
    descr = descr || "Undescribed condition.";
    if(!cond){
        throw new Error("Assertion failed: "+descr);
    }else{
        //print("Assertion OK: "+descr);
    }
}

/**
    Convenience form of FShell.fossil.sendCommand(command,payload,ajajOpt).
*/
function send(command,payload, ajajOpt){
    FShell.fossil.sendCommand(command,payload,ajajOpt);
}

/**
    Asserts that resp is-a Object, resp.fossil is-a string, and
    !resp.resultCode.
*/
function assertResponseOK(resp){
    assert('object' === typeof resp,'Response is-a object.');
    assert( 'string' === typeof resp.fossil, 'Response contains fossil property.');
    assert( !resp.resultCode, 'resp.resultCode='+resp.resultCode);
}
/**
    Asserts that resp is-a Object, resp.fossil is-a string, and
    resp.resultCode is a truthy value. If expectCode is set then
    it also asserts that (resp.resultCode=='FOSSIL-'+expectCode).
*/
function assertResponseError(resp,expectCode){
    assert('object' === typeof resp,'Response is-a object.');
    assert( 'string' === typeof resp.fossil, 'Response contains fossil property.');
    assert( resp.resultCode, 'resp.resultCode='+resp.resultCode);
    if(expectCode){
        assert( 'FOSSIL-'+expectCode == resp.resultCode, 'Expecting result code '+expectCode );
    }
}

FShell.readline = (typeof readline === 'function') ? (readline) : (function() {
     importPackage(java.io);
     importPackage(java.lang);
     var stdin = new BufferedReader(new InputStreamReader(System['in']));
     var self = this;
     return function(prompt) {
        if(prompt) print(prompt);
        var x = stdin.readLine();
        return null===x ? x : String(x) /*convert to JS string!*/;
     };
}());

FShell.dispatchLine = function(line){
    var av = line.split(' '); // FIXME: to shell-like tokenization. Too tired!
    var cmd = av[0];
    var key, h;
    if('/' == cmd[0]) key = '/';
    else key = this.commandAliases[cmd];
    if(!key) key = cmd;
    h = this.commandHandlers[key];
    if(!h){
        print("Command not known: "+cmd +" ("+key+")");
    }else if(!WhAjaj.isFunction(h)){
        print("Not a function: "+key);
    }
    else{
        print("Sending ["+key+"] command... ");
        try{h(av);}
        catch(e){ print("EXCEPTION: "+e); }
    }
};

FShell.onResponseDefault = function(callback){
    return function(resp,req){
        assertResponseOK(resp);
        print("Payload: "+(resp.payload ? WhAjaj.stringify(resp.payload) : "none"));
        if(WhAjaj.isFunction(callback)){
            callback(resp,req);
        }
    };
};
FShell.commandHandlers = {
    "?":function(args){
        var k;
        print("Available commands...\n");
        var o = FShell.commandHandlers;
        for(k in o){
            if(! o.hasOwnProperty(k)) continue;
            print("\t"+k);
        }
    },
    "/":function(args){
        FShell.fossil.sendCommand('/json'+args[0],undefined,{
            beforeSend:function(req,opt){
                print("Sending to: "+opt.url);
            },
            onResponse:FShell.onResponseDefault()
        });
    },
    "eval":function(args){
        eval(args.join(' '));
    },
    "login":function(args){
        FShell.fossil.login(args[1], args[2], {
            onResponse:FShell.onResponseDefault()
        });
    },
    "whoami":function(args){
        FShell.fossil.whoami({
            onResponse:FShell.onResponseDefault()
        });
    },
    "HAI":function(args){
        FShell.fossil.HAI({
            onResponse:FShell.onResponseDefault()
        });
    }

};
FShell.commandAliases = {
    "li":"login",
    "lo":"logout",
    "who":"whoami",
    "hi":"HAI",
    "tci":"/timeline/ci?limit=3"
};
FShell.mainLoop = function(){
    var line;
    var check = /\S/;
    //var isJavaNull = /java\.lang\.null/;
    //print(typeof java.lang['null']);
    while( null != (line=this.readline(this.prompt)) ){
        if(null===line) break /*EOF*/;
        else if( "" === line ) continue;
        //print("Got line: "+line);
        else if(!check.test(line)) continue;
        print('typeof line = '+typeof line);
        this.dispatchLine(line);
        print("");
    }
    print("Bye!");
};

FShell.mainLoop();

Added ajax/i-test/rhino-test.js.
























































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
var TestApp = {
    serverUrl:
        'http://localhost:8080'
        //'http://fjson/cgi-bin/fossil-json.cgi'
        //'http://192.168.1.62:8080'
        //'http://fossil.wanderinghorse.net/repos/fossil-json-java/index.cgi'
        ,
    verbose:true,
    fossilBinary:'fossil',
    wiki:{}
};
(function bootstrap() {
    var srcdir = '../js/';
    var includes = [srcdir+'json2.js',
                    srcdir+'whajaj.js',
                    srcdir+'fossil-ajaj.js'
                    ];
    for( var i in includes ) {
        load(includes[i]);
    }
    WhAjaj.Connector.prototype.sendImpl = WhAjaj.Connector.sendImpls.rhino;
    TestApp.fossil = new FossilAjaj({
        asynchronous:false, /* rhino-based impl doesn't support async or timeout. */
        timeout:0,
        url:TestApp.serverUrl,
        fossilBinary:TestApp.fossilBinary
    });
    var cb = TestApp.fossil.ajaj.callbacks;
    cb.beforeSend = function(req,opt){
        if(!TestApp.verbose) return;
        print("SENDING REQUEST: AJAJ options="+JSON.stringify(opt));
        if(req) print("Request envelope="+WhAjaj.stringify(req));
    };
    cb.afterSend = function(req,opt){
        //if(!TestApp.verbose) return;
        //print("REQUEST RETURNED: opt="+JSON.stringify(opt));
        //if(req) print("Request="+WhAjaj.stringify(req));
    };
    cb.onError = function(req,opt){
        if(!TestApp.verbose) return;
        print("ERROR: "+WhAjaj.stringify(opt));
    };
    cb.onResponse = function(resp,req){
        if(!TestApp.verbose) return;
        print("GOT RESPONSE: "+(('string'===typeof resp) ? resp : WhAjaj.stringify(resp)));
    };

})();

/**
    Throws an exception of cond is a falsy value.
*/
function assert(cond, descr){
    descr = descr || "Undescribed condition.";
    if(!cond){
        print("Assertion FAILED: "+descr);
        throw new Error("Assertion failed: "+descr);
        // aarrgghh. Exceptions are of course swallowed by
        // the AJAX layer, to keep from killing a browser's
        // script environment.
    }else{
        if(TestApp.verbose) print("Assertion OK: "+descr);
    }
}

/**
    Calls func() in a try/catch block and throws an exception if
    func() does NOT throw.
*/
function assertThrows(func, descr){
    descr = descr || "Undescribed condition failed.";
    var ex;
    try{
        func();
    }catch(e){
        ex = e;
    }
    if(!ex){
        throw new Error("Function did not throw (as expected): "+descr);
    }else{
        if(TestApp.verbose) print("Function threw (as expected): "+descr+": "+ex);
    }
}

/**
    Convenience form of TestApp.fossil.sendCommand(command,payload,ajajOpt).
*/
function send(command,payload, ajajOpt){
    TestApp.fossil.sendCommand(command,payload,ajajOpt);
}

/**
    Asserts that resp is-a Object, resp.fossil is-a string, and
    !resp.resultCode.
*/
function assertResponseOK(resp){
    assert('object' === typeof resp,'Response is-a object.');
    assert( 'string' === typeof resp.fossil, 'Response contains fossil property.');
    assert( undefined === resp.resultCode, 'resp.resultCode is not set');
}
/**
    Asserts that resp is-a Object, resp.fossil is-a string, and
    resp.resultCode is a truthy value. If expectCode is set then
    it also asserts that (resp.resultCode=='FOSSIL-'+expectCode).
*/
function assertResponseError(resp,expectCode){
    assert('object' === typeof resp,'Response is-a object.');
    assert( 'string' === typeof resp.fossil, 'Response contains fossil property.');
    assert( !!resp.resultCode, 'resp.resultCode='+resp.resultCode);
    if(expectCode){
        assert( 'FOSSIL-'+expectCode == resp.resultCode, 'Expecting result code '+expectCode );
    }
}

function testHAI(){
    var rs;
    TestApp.fossil.HAI({
        onResponse:function(resp,req){
            rs = resp;
        }
    });
    assertResponseOK(rs);
    TestApp.serverVersion = rs.fossil;
    assert( 'string' === typeof TestApp.serverVersion, 'server version = '+TestApp.serverVersion);
}
testHAI.description = 'Get server version info.';

function testIAmNobody(){
    TestApp.fossil.whoami('/json/whoami');
    assert('nobody' === TestApp.fossil.auth.name, 'User == nobody.' );
    assert(!TestApp.fossil.auth.authToken, 'authToken is not set.' );

}
testIAmNobody.description = 'Ensure that current user is "nobody".';


function testAnonymousLogin(){
    TestApp.fossil.login();
    assert('string' === typeof TestApp.fossil.auth.authToken, 'authToken = '+TestApp.fossil.auth.authToken);
    assert( 'string' === typeof TestApp.fossil.auth.name, 'User name = '+TestApp.fossil.auth.name);
    TestApp.fossil.userName = null;
    TestApp.fossil.whoami('/json/whoami');
    assert( 'string' === typeof TestApp.fossil.auth.name, 'User name = '+TestApp.fossil.auth.name);
}
testAnonymousLogin.description = 'Perform anonymous login.';

function testAnonWiki(){
    var rs;
    TestApp.fossil.sendCommand('/json/wiki/list',undefined,{
        beforeSend:function(req,opt){
            assert( req && (req.authToken==TestApp.fossil.auth.authToken), 'Request envelope contains expected authToken.'  );
        },
        onResponse:function(resp,req){
            rs = resp;
        }
    });
    assertResponseOK(rs);
    assert( (typeof [] === typeof rs.payload) && rs.payload.length,
        "Wiki list seems to be okay.");
    TestApp.wiki.list = rs.payload;

    TestApp.fossil.sendCommand('/json/wiki/get',{
        name:TestApp.wiki.list[0]
    },{
        onResponse:function(resp,req){
            rs = resp;
        }
    });
    assertResponseOK(rs);
    assert(rs.payload.name == TestApp.wiki.list[0], "Fetched page name matches expectations.");
    print("Got first wiki page: "+WhAjaj.stringify(rs.payload));

}
testAnonWiki.description = 'Fetch wiki list as anonymous user.';

function testFetchCheckinArtifact(){
    var art = '18dd383e5e7684ece';
    var rs;
    TestApp.fossil.sendCommand('/json/artifact',{
        'name': art
        },
        {
            onResponse:function(resp,req){
                rs = resp;
            }
        });
    assertResponseOK(rs);
    assert(3 == rs.payload.parents.length, 'Got 3 parent artifacts.');
}
testFetchCheckinArtifact.description = '/json/artifact/CHECKIN';

function testAnonLogout(){
    var rs;
    TestApp.fossil.logout({
        onResponse:function(resp,req){
            rs = resp;
        }
    });
    assertResponseOK(rs);
    print("Ensure that second logout attempt fails...");
    TestApp.fossil.logout({
        onResponse:function(resp,req){
            rs = resp;
        }
    });
    assertResponseError(rs);
}
testAnonLogout.description = 'Log out anonymous user.';

function testExternalProcess(){

    var req = { command:"HAI", requestId:'testExternalProcess()' };
    var args = [TestApp.fossilBinary, 'json', '--json-input', '-'];
    var p = java.lang.Runtime.getRuntime().exec(args);
    var outs = p.getOutputStream();
    var osr = new java.io.OutputStreamWriter(outs);
    var osb = new java.io.BufferedWriter(osr);
    var json = JSON.stringify(req);
    osb.write(json,0, json.length);
    osb.close();
    req = json = outs = osr = osb = undefined;
    var ins = p.getInputStream();
    var isr = new java.io.InputStreamReader(ins);
    var br = new java.io.BufferedReader(isr);
    var line;

    while( null !== (line=br.readLine())){
        print(line);
    }
    br.close();
    isr.close();
    ins.close();
    p.waitFor();
}
testExternalProcess.description = 'Run fossil as external process.';

function testExternalProcessHandler(){
    var aj = TestApp.fossil.ajaj;
    var oldImpl = aj.sendImpl;
    aj.sendImpl = FossilAjaj.rhinoLocalBinarySendImpl;
    var rs;
    TestApp.fossil.sendCommand('/json/HAI',undefined,{
        onResponse:function(resp,opt){
            rs = resp;
        }
    });
    aj.sendImpl = oldImpl;
    assertResponseOK(rs);
    print("Using local fossil binary via AJAX interface, we fetched: "+
        WhAjaj.stringify(rs));
}
testExternalProcessHandler.description = 'Try local fossil binary via AJAX interface.';

(function runAllTests(){
    var testList = [
        testHAI,
        testIAmNobody,
        testAnonymousLogin,
        testAnonWiki,
        testFetchCheckinArtifact,
        testAnonLogout,
        testExternalProcess,
        testExternalProcessHandler
    ];
    var i, f;
    for( i = 0; i < testList.length; ++i ){
        f = testList[i];
        try{
            print("Running test #"+(i+1)+": "+(f.description || "no description."));
            f();
        }catch(e){
            print("Test #"+(i+1)+" failed: "+e);
            throw e;
        }
    }

})();

print("Done! If you don't see an exception message in the last few lines, you win!");

Added ajax/index.html.













































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <title>Fossil/JSON raw request sending</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    <script type="text/javascript" src="js/whajaj.js"></script>
    <script type="text/javascript" src="js/fossil-ajaj.js"></script>

<style type='text/css'>
th {
  text-align: left;
  background-color: #ececec;
}

.dangerWillRobinson {
    background-color: yellow;
}
</style>

<script type='text/javascript'>
WhAjaj.Connector.options.ajax.url =
/*
    Change this to your CGI/server root path:
*/
     //'http://fjson/cgi-bin/fossil.cgi'
     //'/repos/fossil-sgb/json.cgi'
    '/cgi-bin/fossil-json.cgi'
     ;
var TheApp = {
      response:null,
      sessionID:null,
      jqe:{}/*jqe==jQuery Elements*/,
      ajaxCount:0,
      cgi: new FossilAjaj()
};


TheApp.startAjaxNotif = function()
{
    ++this.ajaxCount;
    TheApp.jqe.responseContainer.removeClass('dangerWillRobinson');
    this.jqe.ajaxNotification.attr( 'title', this.ajaxCount+" pending AJAX operation(s)..." );
    if( 1 == this.ajaxCount ) this.jqe.ajaxNotification.fadeIn();
};

TheApp.endAjaxNotif = function()
{
    --this.ajaxCount;
    this.jqe.ajaxNotification.attr( 'title', this.ajaxCount+" pending AJAX operation(s)..." );
    if( 0 == this.ajaxCount ) this.jqe.ajaxNotification.fadeOut();
};

TheApp.responseContainsError = function(resp) {
    if( resp && resp.resultCode ) {
        //alert("Error response:\n"+JSON.stringify(resp,0,4));
        TheApp.jqe.taResponse.val( "RESPONSE CONTAINS ERROR INFO:\n"+WhAjaj.stringify(resp) );
        //TheApp.jqe.responseContainer.css({backgroundColor:'yellow'});
        //TheApp.jqe.responseContainer.addClass('dangerWillRobinson');
        TheApp.jqe.responseContainer.flash( '255,0,0', 1500 );
        return true;
    }
    return false;
};


TheApp.sendRequest = function() {
    var path = this.jqe.textPath.val();
    var self = this;
    var data = this.jqe.taRequest.val();
    var doPost = (data && data.length);
    var req;
    if( doPost ) try {
        req = JSON.parse(data);
    }
    catch(e) {
        TheApp.jqe.taResponse.val("Request is not valid JSON.\n"+e);
        return;
    }
    if( req ) {
        req.requestId = this.cgi.generateRequestId();
    }
    var self = this;
    var opt = {
        url: WhAjaj.Connector.options.ajax.url + path,
        method: doPost ? 'POST' : 'GET'
    };
    this.cgi.sendRequest( req, opt );
};
jQuery.fn.animateHighlight = function(highlightColor, duration) {
    var highlightBg = highlightColor || "#FFFF9C";
    var animateMs = duration || 1500;
    var originalBg = this.css("backgroundColor");
    this.stop().css("background-color", highlightBg).animate({backgroundColor: originalBg}, animateMs);
};
jQuery.fn.flash = function( color, duration )
{
    var current = this.css( 'color' );
    this.animate( { color: 'rgb(' + color + ')' }, duration / 2);
    this.animate( { color: current }, duration / 2 );
};

function myJsonPCallback(obj){
    alert("JSONP callback got:\n"+WhAjaj.stringify(obj));
}

jQuery(document).ready(function(){
    var ids = [// list of HTML element IDs we use often.
        'btnSend',
        'ajaxNotification',
        'currentAuthToken',
        'responseContainer',
        'taRequest',
        'taRequestOpt',
        'taResponse',
        'textPath',
        'timer'
    ];
    var i, k;
    for( i = 0; i < ids.length; ++i ) {
        k = ids[i];
        TheApp.jqe[k] = jQuery('#'+k);
    }
    TheApp.jqe.textPath.
        keyup(function(event){
            if(event.keyCode == 13){
                TheApp.sendRequest();
            }
        });
    TheApp.timer = {
        _tstart:0,_tend:0,duration:0,
        start:function(){
            this._tstart = (new Date()).getTime();
        },
        end:function(){
            this._tend = (new Date()).getTime();
            return this.duration = this._tend - this._tstart;
        }
    };

    var ajcb = TheApp.cgi.ajaj.callbacks;
    ajcb.beforeSend = function(req,opt) {
        TheApp.timer.start();
        var val =
            req ?
            (('string'===typeof req) ? req : WhAjaj.stringify(req))
            : '';
        TheApp.jqe.taResponse.val('');
        TheApp.jqe.taRequest.val( val );
        TheApp.jqe.taRequestOpt.val( opt ? WhAjaj.stringify(opt) : '' );
        TheApp.startAjaxNotif();
    };
    ajcb.afterSend = function(req,opt) {
        TheApp.timer.end();
        TheApp.endAjaxNotif();
        TheApp.jqe.timer.text( "(Round-trip time (incl. JS overhead): "+TheApp.timer.duration+'ms)' );
    };
    ajcb.onResponse = function(resp,req, opt) {
        var val;
        if(this.jsonp) return /*was already handled*/;
        try {
            val = WhAjaj.stringify(resp);
        }
        catch(e) {
            val = WhAjaj.stringify(e)
        }
        //alert("onResponse this:"+WhAjaj.stringify(this));
        //alert("val="+val);
        // FIXME: this.url is hosed for login because of how i overload onResponse()
        if( opt.url ) TheApp.jqe.textPath.val(opt.url.replace(WhAjaj.Connector.options.ajax.url,''));
        TheApp.jqe.taResponse.val( val );
    };
    ajcb.onError = function(req,opt) {
        TheApp.jqe.taResponse.val( "ERROR SENDING REQUEST:\n"+WhAjaj.stringify(opt) );
    };

    TheApp.cgi.onLogin = function(){
      TheApp.jqe.taResponse.val( "Logged in:\n"+WhAjaj.stringify(this.auth));
      TheApp.jqe.currentAuthToken.html("Logged in: "+WhAjaj.stringify(this.auth));
    };
    TheApp.cgi.onLogout = function(){
      TheApp.jqe.taResponse.val( "Logged out!" );
      TheApp.jqe.currentAuthToken.text("Not logged in");
    };
    TheApp.cgi.whoami();
    jQuery('#headerArea').click(function(){
        jQuery(this).slideUp('fast',function(){
            jQuery(this).remove();
        });
    });
});

</script>

</head>

<body>
<span id='ajaxNotification'></span>
<div id='headerArea'>
<h1>You know, for sending raw JSON requests to Fossil...</h1>

If you're actually using this page, then you know what you're doing and don't
need help text, hoverhelp, and a snazzy interface.

<br><br>


JSON API docs: <a href='https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/edit'>https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/edit</a>

</div><!-- #headerArea -->
See also: <a href='wiki-editor.html'>prototype wiki editor</a>.

<h2>Request...</h2>

Path: <input type='text' size='40' id='textPath' value='/json/HAI'/>
<input type='button' value='Send...' id='btnSend' onclick='TheApp.sendRequest()' /><br/>
If the POST textarea is not empty then it will be posted with the request.
<hr/>
<strong>Quick-posts:</strong><br/>
<input type='button' value='HAI' onclick='TheApp.cgi.HAI()' />
<input type='button' value='HAI JSONP' onclick='TheApp.cgi.sendCommand("/json/HAI",undefined,{jsonp:"myJsonPCallback"});' />
<input type='button' value='version' onclick='TheApp.cgi.sendCommand("/json/version")' />
<input type='button' value='stat' onclick='TheApp.cgi.sendCommand("/json/stat?full=0")' />
<input type='button' value='whoami' onclick='TheApp.cgi.whoami()' />
<input type='button' value='cap' onclick='TheApp.cgi.sendCommand("/json/cap")' />
<input type='button' value='resultCodes' onclick='TheApp.cgi.sendCommand("/json/resultCodes")' />
<input type='button' value='g' onclick='TheApp.cgi.sendCommand("/json/g")' />

<br/>

<input type='button' value='branch/list' onclick='TheApp.cgi.sendCommand("/json/branch/list")' />
<input type='button' value='timeline/ci' onclick='TheApp.cgi.sendCommand("/json/timeline/ci?files=true")' />
<input type='button' value='timeline/wiki' onclick='TheApp.cgi.sendCommand("/json/timeline/wiki")' />
<input type='button' value='timeline/ticket' onclick='TheApp.cgi.sendCommand("/json/timeline/ticket")' />
<input type='button' value='timeline/branch' onclick='TheApp.cgi.sendCommand("/json/timeline/branch")' />

<br/>

<input type='button' value='wiki/list' onclick='TheApp.cgi.sendCommand("/json/wiki/list")' />
<input type='button' value='wiki/list verbose' onclick='TheApp.cgi.sendCommand("/json/wiki/list",{verbose:1})' />
<input type='button' value='wiki/get Fossil' onclick='TheApp.cgi.sendCommand("/json/wiki/get",{name:"Fossil"})' />
<input type='button' value='wiki/get/Fossil' onclick='TheApp.cgi.sendCommand("/json/wiki/get/Fossil")' />
<input type='button' value='wiki/diff' onclick='TheApp.cgi.sendCommand("/json/wiki/diff/e32ccdcda59e930c77c/e15992f475760cdf3a9")' />

<br/>

<input type='button' value='user/list' onclick='TheApp.cgi.sendCommand("/json/user/list")' />
<input type='button' value='user/get' onclick='TheApp.cgi.sendCommand("/json/user/get?name=anonymous")' />
<input type='button' value='tag/list' onclick='TheApp.cgi.sendCommand("/json/tag/list?includeTickets=false&raw=false")' />
<input type='button' value='tag/list/json' onclick='TheApp.cgi.sendCommand("/json/tag/list/json?raw=false")' />
<input type='button' value='tag/add'
    onclick='TheApp.cgi.sendCommand("/json/tag/add",{name:"json-add-tag-test",checkin:"json",value:"tag test",propagate:false,raw:false})' />
<input type='button' value='tag/cancel'
    onclick='TheApp.cgi.sendCommand("/json/tag/cancel",{name:"json-add-tag-test",checkin:"json",raw:false})' />
<input type='button' value='tag/find'
    onclick='TheApp.cgi.sendCommand("/json/tag/find",{name:"json",type:"*",raw:false,limit:5})' />

<br/>

<input type='button' value='diff'
    onclick='TheApp.cgi.sendCommand("/json/diff",{v1:"b0e9b45baed6f885",v2:"5f225e261d836287",context:2})' />
<input type='button' value='diff/A/B'
    onclick='TheApp.cgi.sendCommand("/json/diff/b0e9b45baed6f885/5f225e261d836287?context=2")' />

<input type='button' value='query'
    onclick='TheApp.cgi.sendCommand("/json/query?format=o","SELECT * from user")' />

<input type='button' value='report list'
    onclick='TheApp.cgi.sendCommand("/json/report/list")' />
<input type='button' value='report get'
    onclick='TheApp.cgi.sendCommand("/json/report/get",2)' />

<input type='button' value='report run'
    onclick='TheApp.cgi.sendCommand("/json/report/run",{"report":2,"format":"o"})' />

<input type='button' value='config/get' onclick='TheApp.cgi.sendCommand("/json/config/get")' />

<!-- not yet ready...
<input type='button' value='artifact/XYZ' onclick='TheApp.cgi.sendCommand("/json/artifact?uuid=json")' />
-->

<!--
<input type='button' value='get whiki' onclick='TheApp.cgi.getPages("whiki")' />
<input type='button' value='get more' onclick='TheApp.cgi.getPages("HelloWorld/WhikiNews")' />
<input type='button' value='get client data' onclick='TheApp.cgi.getPageClientData("HelloWorld/whiki/WhikiCommands")' />
<input type='button' value='save client data' onclick='TheApp.cgi.savePageClientData({"HelloWorld":[1,3,5]})' />
-->
<hr/>
<b>Login:</b>
<br/>
<input type='button' value='Anon. PW' onclick='TheApp.cgi.sendCommand("/json/anonymousPassword")' />
<input type='button' value='Anon. PW+Login' onclick='TheApp.cgi.login()' />
<br/>
name:<input type='text' id='textUser' value='json-demo' size='12'/>
pw:<input type='password' id='textPassword' value='json-demo' size='12'/>
<input type='button' value='login' onclick='TheApp.cgi.login(jQuery("#textUser").val(),jQuery("#textPassword").val(),{onResponse:TheApp.onLogin})' />
<input type='button' value='logout' onclick='TheApp.cgi.logout()' />
<br/>
<span id='currentAuthToken' style='font-family:monospaced'></span>

<br/>

<hr/>

<table>
    <tr>
        <th>POST data</th>
        <th>Request AJAJ options</th>
    </tr>
    <tr>
        <td width='50%' valign='top'>
            <textarea id='taRequest' rows='10' cols='50'></textarea>
        </td>
        <td width='50%' valign='top'>
            <textarea id='taRequestOpt' rows='10' cols='40' readonly></textarea>
        </td>
    </tr>
    <tr>
        <th colspan='2'>Response <span id='timer'></span></th>
    </tr>
    <tr>
        <td colspan='2' id='responseContainer' valign='top'>
            <textarea id='taResponse' rows='20' cols='80' readonly></textarea>
        </td>
    </tr>
</table>
<div></div>
<div></div>
<div></div>

</body></html>

Added ajax/js/fossil-ajaj.js.



















































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/**
    This file contains a WhAjaj extension for use with Fossil/JSON.

    Author: Stephan Beal (sgbeal@googlemail.com)

    License: Public Domain
*/

/**
    Constructor for a new Fossil AJAJ client. ajajOpt may be an optional
    object suitable for passing to the WhAjaj.Connector() constructor.

    On returning, this.ajaj is-a WhAjaj.Connector instance which can
    be used to send requests to the back-end (though the convenience
    functions of this class are the preferred way to do it). Clients
    are encouraged to use FossilAjaj.sendCommand() (and friends) instead
    of the underlying WhAjaj.Connector API, since this class' API
    contains Fossil-specific request-calling handling (e.g. of authentication
    info) whereas WhAjaj is more generic.
*/
function FossilAjaj(ajajOpt)
{
    this.ajaj = new WhAjaj.Connector(ajajOpt);
    return this;
}

FossilAjaj.prototype.generateRequestId = function() {
    return this.ajaj.generateRequestId();
};

/**
   Proxy for this.ajaj.sendRequest().
*/
FossilAjaj.prototype.sendRequest = function(req,opt) {
    return this.ajaj.sendRequest(req,opt);
};

/**
    Sends a command to the fossil back-end. Command should be the
    path part of the URL, e.g. /json/stat, payload is a request-specific
    value type (may often be null/undefined). ajajOpt is an optional object
    holding WhAjaj.sendRequest()-compatible options.

    This function constructs a Fossil/JSON request envelope based
    on the given arguments and adds this.auth.authToken and a requestId
    to it.
*/
FossilAjaj.prototype.sendCommand = function(command, payload, ajajOpt) {
    var req;
    ajajOpt = ajajOpt || {};
    if(payload || (this.auth && this.auth.authToken) || ajajOpt.jsonp) {
        req = {
            payload:payload,
            requestId:('function' === typeof this.generateRequestId) ? this.generateRequestId() : undefined,
            authToken:(this.auth ? this.auth.authToken : undefined),
            jsonp:('string' === typeof ajajOpt.jsonp) ? ajajOpt.jsonp : undefined
        };
    }
    ajajOpt.method = req ? 'POST' : 'GET';
    // just for debuggering: ajajOpt.method = 'POST'; if(!req) req={};
    if(command) ajajOpt.url = this.ajaj.derivedOption('url',ajajOpt) + command;
    this.ajaj.sendRequest(req,ajajOpt);
};

/**
    Sends a login request to the back-end.

    ajajOpt is an optional configuration object suitable for passing
    to sendCommand().

    After the response returns, this.auth will be
    set to the response payload.

    If name === 'anonymous' (the default if none is passed in) then this
    function ignores the pw argument and must make two requests - the first
    one gets the captcha code and the second one submits it.
    ajajOpt.onResponse() (if set) is only called for the actual login
    response (the 2nd one), as opposed to being called for both requests.
    However, this.ajaj.callbacks.onResponse() _is_ called for both (because
    it happens at a lower level).

    If this object has an onLogin() function it is called (with
    no arguments) before the onResponse() handler of the login is called
    (that is the 2nd request for anonymous logins) and any exceptions
    it throws are ignored.

*/
FossilAjaj.prototype.login = function(name,pw,ajajOpt) {
    name = name || 'anonymous';
    var self = this;
    var loginReq = {
        name:name,
        password:pw
    };
    ajajOpt = this.ajaj.normalizeAjaxParameters( ajajOpt || {} );
    var oldOnResponse = ajajOpt.onResponse;
    ajajOpt.onResponse = function(resp,req) {
        var thisOpt = this;
        //alert('login response:\n'+WhAjaj.stringify(resp));
        if( resp && resp.payload ) {
            //self.userName = resp.payload.name;
            //self.capabilities = resp.payload.capabilities;
            self.auth = resp.payload;
        }
        if( WhAjaj.isFunction( self.onLogin ) ){
            try{ self.onLogin(); }
            catch(e){}
        }
        if( WhAjaj.isFunction(oldOnResponse) ) {
            oldOnResponse.apply(thisOpt,[resp,req]);
        }
    };
    function doLogin(){
        //alert("Sending login request..."+WhAjaj.stringify(loginReq));
        self.sendCommand('/json/login', loginReq, ajajOpt);
    }
    if( 'anonymous' === name ){
      this.sendCommand('/json/anonymousPassword',undefined,{
          onResponse:function(resp,req){
/*
            if( WhAjaj.isFunction(oldOnResponse) ){
                oldOnResponse.apply(this, [resp,req]);
            };
*/
            if(resp && !resp.resultCode){
                //alert("Got PW. Trying to log in..."+WhAjaj.stringify(resp));
                loginReq.anonymousSeed = resp.payload.seed;
                loginReq.password = resp.payload.password;
                doLogin();
            }
          }
      });
    }
    else doLogin();
};

/**
    Logs out of fossil, invaliding this login token.

    ajajOpt is an optional configuration object suitable for passing
    to sendCommand().

    If this object has an onLogout() function it is called (with
    no arguments) before the onResponse() handler is called.
    IFF the response succeeds then this.auth is unset.
*/
FossilAjaj.prototype.logout = function(ajajOpt) {
    var self = this;
    ajajOpt = this.ajaj.normalizeAjaxParameters( ajajOpt || {} );
    var oldOnResponse = ajajOpt.onResponse;
    ajajOpt.onResponse = function(resp,req) {
        var thisOpt = this;
        self.auth = undefined;
        if( WhAjaj.isFunction( self.onLogout ) ){
            try{ self.onLogout(); }
            catch(e){}
        }
        if( WhAjaj.isFunction(oldOnResponse) ) {
            oldOnResponse.apply(thisOpt,[resp,req]);
        }
    };
    this.sendCommand('/json/logout', undefined, ajajOpt );
};

/**
    Sends a HAI request to the server. /json/HAI is an alias /json/version.

    ajajOpt is an optional configuration object suitable for passing
    to sendCommand().
*/
FossilAjaj.prototype.HAI = function(ajajOpt) {
    this.sendCommand('/json/HAI', undefined, ajajOpt);
};


/**
    Sends a /json/whoami request. Updates this.auth to contain
    the login info, removing them if the response does not contain
    that data.
*/
FossilAjaj.prototype.whoami = function(ajajOpt) {
    var self = this;
    ajajOpt = this.ajaj.normalizeAjaxParameters( ajajOpt || {} );
    var oldOnResponse = ajajOpt.onResponse;
    ajajOpt.onResponse = function(resp,req) {
        var thisOpt = this;
        if( resp && resp.payload ){
            if(!self.auth || (self.auth.authToken!==resp.payload.authToken)){
                self.auth = resp.payload;
                if( WhAjaj.isFunction(self.onLogin) ){
                    self.onLogin();
                }
            }
        }
        else { delete self.auth; }
        if( WhAjaj.isFunction(oldOnResponse) ) {
            oldOnResponse.apply(thisOpt,[resp,req]);
        }
    };
    self.sendCommand('/json/whoami', undefined, ajajOpt);
};

/**
    EXPERIMENTAL concrete WhAjaj.Connector.sendImpl() implementation which
    uses Rhino to connect to a local fossil binary for input and output. Its
    signature and semantics are as described for
    WhAjaj.Connector.prototype.sendImpl(), with a few exceptions and
    additions:

    - It does not support timeouts or asynchronous mode.

    - The args.fossilBinary property must point to the local fossil binary
    (it need not be a complete path if fossil is in the $PATH). This
    function throws (without calling any request callbacks) if
    args.fossilBinary is not set. fossilBinary may be set on
    WhAjaj.Connector.options.ajax, in the FossilAjaj constructor call, as
    the ajax options parameter to any of the FossilAjaj.sendCommand() family
    of functions, or by setting
    aFossilAjajInstance.ajaj.options.fossilBinary on a specific
    FossilAjaj instance.

    - It uses the args.url field to create the "command" property of the
    request, constructs a request envelope, spawns a fossil process in JSON
    mode, feeds it the request envelope, and returns the response envelope
    via the same mechanisms defined for the HTTP-based implementations.

    The interface is otherwise compatible with the "normal"
    FossilAjaj.sendCommand() front-end (it is, however, fossil-specific, and
    not back-end agnostic like the WhAjaj.sendImpl() interface intends).


*/
FossilAjaj.rhinoLocalBinarySendImpl = function(request,args){
    var self = this;
    request = request || {};
    if(!args.fossilBinary){
        throw new Error("fossilBinary is not set on AJAX options!");
    }
    var url = args.url.split('?')[0].split(/\/+/);
    if(url.length>1){
        // 3x shift(): protocol, host, 'json' part of path
        request.command = (url.shift(),url.shift(),url.shift(), url.join('/'));
    }
    delete args.url;
    //print("rhinoLocalBinarySendImpl SENDING: "+WhAjaj.stringify(request));
    var json;
    try{
        var pargs = [args.fossilBinary, 'json', '--json-input', '-'];
        var p = java.lang.Runtime.getRuntime().exec(pargs);
        var outs = p.getOutputStream();
        var osr = new java.io.OutputStreamWriter(outs);
        var osb = new java.io.BufferedWriter(osr);

        json = JSON.stringify(request);
        osb.write(json,0, json.length);
        osb.close();
        var ins = p.getInputStream();
        var isr = new java.io.InputStreamReader(ins);
        var br = new java.io.BufferedReader(isr);
        var line;
        json = [];
        while( null !== (line=br.readLine())){
            json.push(line);
        }
        ins.close();
    }catch(e){
        args.errorMessage = e.toString();
        WhAjaj.Connector.sendHelper.onSendError.apply( self, [request, args] );
        return undefined;
    }
    json = json.join('');
    //print("READ IN JSON: "+json);
    WhAjaj.Connector.sendHelper.onSendSuccess.apply( self, [request, json, args] );
}/*rhinoLocalBinary*/

Added ajax/js/json2.js.





























































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
    http://www.JSON.org/json2.js
    2009-06-29

    Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

    See http://www.JSON.org/js.html

    This file creates a global JSON object containing two methods: stringify
    and parse.

        JSON.stringify(value, replacer, space)
            value       any JavaScript value, usually an object or array.

            replacer    an optional parameter that determines how object
                        values are stringified for objects. It can be a
                        function or an array of strings.

            space       an optional parameter that specifies the indentation
                        of nested structures. If it is omitted, the text will
                        be packed without extra whitespace. If it is a number,
                        it will specify the number of spaces to indent at each
                        level. If it is a string (such as '\t' or '&nbsp;'),
                        it contains the characters used to indent at each level.

            This method produces a JSON text from a JavaScript value.

            When an object value is found, if the object contains a toJSON
            method, its toJSON method will be called and the result will be
            stringified. A toJSON method does not serialize: it returns the
            value represented by the name/value pair that should be serialized,
            or undefined if nothing should be serialized. The toJSON method
            will be passed the key associated with the value, and this will be
            bound to the object holding the key.

            For example, this would serialize Dates as ISO strings.

                Date.prototype.toJSON = function (key) {
                    function f(n) {
                        // Format integers to have at least two digits.
                        return n < 10 ? '0' + n : n;
                    }

                    return this.getUTCFullYear()   + '-' +
                         f(this.getUTCMonth() + 1) + '-' +
                         f(this.getUTCDate())      + 'T' +
                         f(this.getUTCHours())     + ':' +
                         f(this.getUTCMinutes())   + ':' +
                         f(this.getUTCSeconds())   + 'Z';
                };

            You can provide an optional replacer method. It will be passed the
            key and value of each member, with this bound to the containing
            object. The value that is returned from your method will be
            serialized. If your method returns undefined, then the member will
            be excluded from the serialization.

            If the replacer parameter is an array of strings, then it will be
            used to select the members to be serialized. It filters the results
            such that only members with keys listed in the replacer array are
            stringified.

            Values that do not have JSON representations, such as undefined or
            functions, will not be serialized. Such values in objects will be
            dropped; in arrays they will be replaced with null. You can use
            a replacer function to replace those with JSON values.
            JSON.stringify(undefined) returns undefined.

            The optional space parameter produces a stringification of the
            value that is filled with line breaks and indentation to make it
            easier to read.

            If the space parameter is a non-empty string, then that string will
            be used for indentation. If the space parameter is a number, then
            the indentation will be that many spaces.

            Example:

            text = JSON.stringify(['e', {pluribus: 'unum'}]);
            // text is '["e",{"pluribus":"unum"}]'


            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

            text = JSON.stringify([new Date()], function (key, value) {
                return this[key] instanceof Date ?
                    'Date(' + this[key] + ')' : value;
            });
            // text is '["Date(---current time---)"]'


        JSON.parse(text, reviver)
            This method parses a JSON text to produce an object or array.
            It can throw a SyntaxError exception.

            The optional reviver parameter is a function that can filter and
            transform the results. It receives each of the keys and values,
            and its return value is used instead of the original value.
            If it returns what it received, then the structure is not modified.
            If it returns undefined then the member is deleted.

            Example:

            // Parse the text. Values that look like ISO date strings will
            // be converted to Date objects.

            myData = JSON.parse(text, function (key, value) {
                var a;
                if (typeof value === 'string') {
                    a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
                    if (a) {
                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
                            +a[5], +a[6]));
                    }
                }
                return value;
            });

            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
                var d;
                if (typeof value === 'string' &&
                        value.slice(0, 5) === 'Date(' &&
                        value.slice(-1) === ')') {
                    d = new Date(value.slice(5, -1));
                    if (d) {
                        return d;
                    }
                }
                return value;
            });


    This is a reference implementation. You are free to copy, modify, or
    redistribute.

    This code should be minified before deployment.
    See http://javascript.crockford.com/jsmin.html

    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
    NOT CONTROL.
*/

/*jslint evil: true */

/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
    lastIndex, length, parse, prototype, push, replace, slice, stringify,
    test, toJSON, toString, valueOf
*/

// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.

var JSON = JSON || {};

(function () {

    function f(n) {
        // Format integers to have at least two digits.
        return n < 10 ? '0' + n : n;
    }

    if (typeof Date.prototype.toJSON !== 'function') {

        Date.prototype.toJSON = function (key) {

            return isFinite(this.valueOf()) ?
                   this.getUTCFullYear()   + '-' +
                 f(this.getUTCMonth() + 1) + '-' +
                 f(this.getUTCDate())      + 'T' +
                 f(this.getUTCHours())     + ':' +
                 f(this.getUTCMinutes())   + ':' +
                 f(this.getUTCSeconds())   + 'Z' : null;
        };

        String.prototype.toJSON =
        Number.prototype.toJSON =
        Boolean.prototype.toJSON = function (key) {
            return this.valueOf();
        };
    }

    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        gap,
        indent,
        meta = {    // table of character substitutions
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        rep;


    function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

        escapable.lastIndex = 0;
        return escapable.test(string) ?
            '"' + string.replace(escapable, function (a) {
                var c = meta[a];
                return typeof c === 'string' ? c :
                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
            }) + '"' :
            '"' + string + '"';
    }


    function str(key, holder) {

// Produce a string from holder[key].

        var i,          // The loop counter.
            k,          // The member key.
            v,          // The member value.
            length,
            mind = gap,
            partial,
            value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

        if (value && typeof value === 'object' &&
                typeof value.toJSON === 'function') {
            value = value.toJSON(key);
        }

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

        if (typeof rep === 'function') {
            value = rep.call(holder, key, value);
        }

// What happens next depends on the value's type.

        switch (typeof value) {
        case 'string':
            return quote(value);

        case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

            return isFinite(value) ? String(value) : 'null';

        case 'boolean':
        case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

            return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

        case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

            if (!value) {
                return 'null';
            }

// Make an array to hold the partial results of stringifying this object value.

            gap += indent;
            partial = [];

// Is the value an array?

            if (Object.prototype.toString.apply(value) === '[object Array]') {

// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

                length = value.length;
                for (i = 0; i < length; i += 1) {
                    partial[i] = str(i, value) || 'null';
                }

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

                v = partial.length === 0 ? '[]' :
                    gap ? '[\n' + gap +
                            partial.join(',\n' + gap) + '\n' +
                                mind + ']' :
                          '[' + partial.join(',') + ']';
                gap = mind;
                return v;
            }

// If the replacer is an array, use it to select the members to be stringified.

            if (rep && typeof rep === 'object') {
                length = rep.length;
                for (i = 0; i < length; i += 1) {
                    k = rep[i];
                    if (typeof k === 'string') {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            } else {

// Otherwise, iterate through all of the keys in the object.

                for (k in value) {
                    if (Object.hasOwnProperty.call(value, k)) {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            }

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

            v = partial.length === 0 ? '{}' :
                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
                        mind + '}' : '{' + partial.join(',') + '}';
            gap = mind;
            return v;
        }
    }

// If the JSON object does not yet have a stringify method, give it one.

    if (typeof JSON.stringify !== 'function') {
        JSON.stringify = function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

            var i;
            gap = '';
            indent = '';

// If the space parameter is a number, make an indent string containing that
// many spaces.

            if (typeof space === 'number') {
                for (i = 0; i < space; i += 1) {
                    indent += ' ';
                }

// If the space parameter is a string, it will be used as the indent string.

            } else if (typeof space === 'string') {
                indent = space;
            }

// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.

            rep = replacer;
            if (replacer && typeof replacer !== 'function' &&
                    (typeof replacer !== 'object' ||
                     typeof replacer.length !== 'number')) {
                throw new Error('JSON.stringify');
            }

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

            return str('', {'': value});
        };
    }


// If the JSON object does not yet have a parse method, give it one.

    if (typeof JSON.parse !== 'function') {
        JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

            var j;

            function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

                var k, v, value = holder[key];
                if (value && typeof value === 'object') {
                    for (k in value) {
                        if (Object.hasOwnProperty.call(value, k)) {
                            v = walk(value, k);
                            if (v !== undefined) {
                                value[k] = v;
                            } else {
                                delete value[k];
                            }
                        }
                    }
                }
                return reviver.call(holder, key, value);
            }


// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.

            cx.lastIndex = 0;
            if (cx.test(text)) {
                text = text.replace(cx, function (a) {
                    return '\\u' +
                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
                });
            }

// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.

// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

            if (/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

                j = eval('(' + text + ')');

// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

                return typeof reviver === 'function' ?
                    walk({'': j}, '') : j;
            }

// If the text is not JSON parseable, then a SyntaxError is thrown.

            throw new SyntaxError('JSON.parse');
        };
    }
}());

Added ajax/js/whajaj.js.






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/**
    This file provides a JS interface into the core functionality of
    JSON-centric back-ends. It sends GET or JSON POST requests to
    a back-end and expects JSON responses. The exact semantics of
    the underlying back-end and overlying front-end are not its concern,
    and it leaves the interpretation of the data up to the client/server
    insofar as possible.

    All functionality is part of a class named WhAjaj, and that class
    acts as namespace for this framework.

    Author: Stephan Beal (http://wanderinghorse.net/home/stephan/)

    License: Public Domain

    This framework is directly derived from code originally found in
    http://code.google.com/p/jsonmessage, and later in
    http://whiki.wanderinghorse.net, where it contained quite a bit
    of application-specific logic. It was eventually (the 3rd time i
    needed it) split off into its own library to simplify inclusion
    into my many mini-projects.
*/


/**
    The WhAjaj function is primarily a namespace, and not intended
    to called or instantiated via the 'new' operator.
*/
function WhAjaj()
{
}

/** Returns a millisecond Unix Epoch timestamp. */
WhAjaj.msTimestamp = function()
{
    return (new Date()).getTime();
};

/** Returns a Unix Epoch timestamp (in seconds) in integer format.

    Reminder to self: (1.1 %1.2) evaluates to a floating-point value
    in JS, and thus this implementation is less than optimal.
*/
WhAjaj.unixTimestamp = function()
{
    var ts = (new Date()).getTime();
    return parseInt( ""+((ts / 1000) % ts) );
};

/**
    Returns true if v is-a Array instance.
*/
WhAjaj.isArray = function( v )
{
    return (v &&
            (v instanceof Array) ||
            (Object.prototype.toString.call(v) === "[object Array]")
            );
    /* Reminders to self:
        typeof [] == "object"
        toString.call([]) == "[object Array]"
        ([]).toString() == empty
    */
};

/**
    Returns true if v is-a Object instance.
*/
WhAjaj.isObject = function( v )
{
    return v &&
        (v instanceof Object) &&
        ('[object Object]' === Object.prototype.toString.apply(v) );
};

/**
    Returns true if v is-a Function instance.
*/
WhAjaj.isFunction = function(obj)
{
    return obj
    && (
    (obj instanceof Function)
    || ('function' === typeof obj)
    || ("[object Function]" === Object.prototype.toString.call(obj))
    )
    ;
};

/**
    Parses window.location.search-style string into an object
    containing key/value pairs of URL arguments (already urldecoded).

    If the str argument is not passed (arguments.length==0) then
    window.location.search.substring(1) is used by default. If
    neither str is passed in nor window exists then false is returned.

    On success it returns an Object containing the key/value pairs
    parsed from the string. Keys which have no value are treated
    has having the boolean true value.

    FIXME: for keys in the form "name[]", build an array of results,
    like PHP does.

*/
WhAjaj.processUrlArgs = function(str) {
    if( 0 === arguments.length ) {
        if( ('undefined' === typeof window) ||
            !window.location ||
            !window.location.search )  return false;
        else str = (''+window.location.search).substring(1);
    }
    if( ! str ) return false;
    str = (''+str).split(/#/,2)[0]; // remove #... to avoid it being added as part of the last value.
    var args = {};
    var sp = str.split(/&+/);
    var rx = /^([^=]+)(=(.+))?/;
    var i, m;
    for( i in sp ) {
        m = rx.exec( sp[i] );
        if( ! m ) continue;
        args[decodeURIComponent(m[1])] = (m[3] ? decodeURIComponent(m[3]) : true);
    }
    return args;
};

/**
    A simple wrapper around JSON.stringify(), using my own personal
    preferred values for the 2nd and 3rd parameters. To globally
    set its indentation level, assign WhAjaj.stringify.indent to
    an integer value (0 for no intendation).

    This function is intended only for human-readable output, not
    generic over-the-wire JSON output (where JSON.stringify(val) will
    produce smaller results).
*/
WhAjaj.stringify = function(val) {
    if( ! arguments.callee.indent ) arguments.callee.indent = 4;
    return JSON.stringify(val,0,arguments.callee.indent);
};

/**
    Each instance of this class holds state information for making
    AJAJ requests to a back-end system. While clients may use one
    "requester" object per connection attempt, for connections to the
    same back-end, using an instance configured for that back-end
    can simplify usage. This class is designed so that the actual
    connection-related details (i.e. _how_ it connects to the
    back-end) may be re-implemented to use a client's preferred
    connection mechanism (e.g. jQuery).

    The optional opt parameter may be an object with any (or all) of
    the properties documented for WhAjaj.Connector.options.ajax.
    Properties set here (or later via modification of the "options"
    property of this object) will be used in calls to
    WhAjaj.Connector.sendRequest(), and these override (normally) any
    options set in WhAjaj.Connector.options.ajax. Note that
    WhAjaj.Connector.sendRequest() _also_ takes an options object,
    and ones passed there will override, for purposes of that one
    request, any options passed in here or defined in
    WhAjaj.Connector.options.ajax. See WhAjaj.Connector.options.ajax
    and WhAjaj.Connector.prototype.sendRequest() for more details
    about the precedence of options.

    Sample usage:

    @code
    // Set up common connection-level options:
    var cgi = new WhAjaj.Connector({
        url: '/cgi-bin/my.cgi',
        timeout:10000,
        onResponse(resp,req) { alert(JSON.stringify(resp,0.4)); },
        onError(req,opt) {
            alert(opt.errorMessage);
        }
    });
    // Any of those options may optionally be set globally in
    // WhAjaj.Connector.options.ajax (onError(), beforeSend(), and afterSend()
    // are often easiest/most useful to set globally).

    // Get list of pages...
    cgi.sendRequest( null, {
        onResponse(resp,req){ alert(WhAjaj.stringify(resp)); }
    });
    @endcode

    For common request types, clients can add functions to this
    object which act as wrappers for backend-specific functionality. As
    a simple example:

    @code
    cgi.login = function(name,pw,ajajOpt) {
        this.sendRequest(
            {command:"json/login",
              name:name,
              password:pw
            }, ajajOpt );
    };
    @endcode

    TODOs:

    - Caching of page-load requests, with a configurable lifetime.

    - Use-cases like the above login() function are a tiny bit
    problematic to implement when each request has a different URL
    path (i know this from the whiki and fossil implementations).
    This is partly a side-effect of design descisions made back in
    the very first days of this code's life. i need to go through
    and see where i can bend those conventions a bit (where it won't
    break my other apps unduly).
*/
WhAjaj.Connector = function(opt)
{
    if(WhAjaj.isObject(opt)) this.options = opt;
    //TODO?: this.$cache = {};
};

/**
    The core options used by WhAjaj.Connector instances for performing
    network operations. These options can (and some _should_)
    be changed by a client application. They can also be changed
    on specific instances of WhAjaj.Connector, but for most applications
    it is simpler to set them here and not have to bother with configuring
    each WhAjaj.Connector instance. Apps which use multiple back-ends at one time,
    however, will need to customize each instance for a given back-end.
*/
WhAjaj.Connector.options = {
    /**
        A (meaningless) prefix to apply to WhAjaj.Connector-generated
        request IDs.
    */
    requestIdPrefix:'WhAjaj.Connector-',
    /**
        Default options for WhAjaj.Connector.sendRequest() connection
        parameters. This object holds only connection-related
        options and callbacks (all optional), and not options
        related to the required JSON structure of any given request.
        i.e. the page name used in a get-page request are not set
        here but are specified as part of the request object.

        These connection options are a "normalized form" of options
        often found in various AJAX libraries like jQuery,
        Prototype, dojo, etc. This approach allows us to swap out
        the real connection-related parts by writing a simple proxy
        which transforms our "normalized" form to the
        backend-specific form. For examples, see the various
        implementations stored in WhAjaj.Connector.sendImpls.

        The following callback options are, in practice, almost
        always set globally to some app-wide defaults:

        - onError() to report errors using a common mechanism.
        - beforeSend() to start a visual activity notification
        - afterSend() to disable the visual activity notification

        However, be aware that if any given WhAjaj.Connector instance is
        given its own before/afterSend callback then those will
        override these. Mixing shared/global and per-instance
        callbacks can potentially lead to confusing results if, e.g.,
        the beforeSend() and afterSend() functions have side-effects
        but are not used with their proper before/after partner.

        TODO: rename this to 'ajaj' (the name is historical). The
        problem with renaming it is is that the word 'ajax' is
        pretty prevelant in the source tree, so i can't globally
        swap it out.
    */
    ajax: {
        /**
            URL of the back-end server/CGI.
        */
        url: '/some/path',

        /**
            Connection method. Some connection-related functions might
            override any client-defined setting.

            Must be one of 'GET' or 'POST'. For custom connection
            implementation, it may optionally be some
            implementation-specified value.

            Normally the API can derive this value automatically - if the
            request uses JSON data it is POSTed, else it is GETted.
        */
        method:'GET',

        /**
            A hint whether to run the operation asynchronously or
            not. Not all concrete WhAjaj.Connector.sendImpl()
            implementations can support this. Interestingly, at
            least one popular AJAX toolkit does not document
            supporting _synchronous_ AJAX operations. All common
            browser-side implementations support async operation, but
            non-browser implementations might not.
        */
        asynchronous:true,

        /**
            A HTTP authentication login name for the AJAX
            connection. Not all concrete WhAjaj.Connector.sendImpl()
            implementations can support this.
        */
        loginName:undefined,

        /**
            An HTTP authentication login password for the AJAJ
            connection. Not all concrete WhAjaj.Connector.sendImpl()
            implementations can support this.
        */
        loginPassword:undefined,

        /**
            A connection timeout, in milliseconds, for establishing
            an AJAJ connection. Not all concrete
            WhAjaj.Connector.sendImpl() implementations can support this.
        */
        timeout:10000,

        /**
            If an AJAJ request receives JSON data from the back-end,
            that data is passed as a plain Object as the response
            parameter (exception: in jsonp mode it is passed a
            string (why???)). The initiating request object is
            passed as the second parameter, but clients can normally
            ignore it (only those which need a way to map specific
            requests to responses will need it). The 3rd parameter
            is the same as the 'this' object for the context of the
            callback, but is provided because the instance-level
            callbacks (set in (WhAjaj.Connector instance).callbacks,
            require it in some cases (because their 'this' is
            different!).

            Note that the response might contain error information
            which comes from the back-end. The difference between
            this error info and the info passed to the onError()
            callback is that this data indicates an
            application-level error, whereas onError() is used to
            report connection-level problems or when the backend
            produces non-JSON data (which, when not in jsonp mode,
            is unexpected and is as fatal to the request as a
            connection error).
        */
        onResponse: function(response, request, opt){},

        /**
            If an AJAX request fails to establish a connection or it
            receives non-JSON data from the back-end, this function
            is called (e.g. timeout error or host name not
            resolvable). It is passed the originating request and the
            "normalized" connection parameters used for that
            request. The connectOpt object "should" (or "might")
            have an "errorMessage" property which describes the
            nature of the problem.

            Clients will almost always want to replace the default
            implementation with something which integrates into
            their application.
        */
        onError: function(request, connectOpt)
        {
            alert('AJAJ request failed:\n'
                +'Connection information:\n'
                +JSON.stringify(connectOpt,0,4)
            );
        },

        /**
            Called before each connection attempt is made. Clients
            can use this to, e.g.,  enable a visual "network activity
            notification" for the user. It is passed the original
            request object and the normalized connection parameters
            for the request. If this function changes opt, those
            changes _are_ applied to the subsequent request. If this
            function throws, neither the onError() nor afterSend()
            callbacks are triggered and WhAjaj.Connector.sendImpl()
            propagates the exception back to the caller.
        */
        beforeSend: function(request,opt){},

        /**
            Called after an AJAJ connection attempt completes,
            regardless of success or failure. Passed the same
            parameters as beforeSend() (see that function for
            details).

            Here's an example of setting up a visual notification on
            ajax operations using jQuery (but it's also easy to do
            without jQuery as well):

            @code
            function startAjaxNotif(req,opt) {
                var me = arguments.callee;
                var c = ++me.ajaxCount;
                me.element.text( c + " pending AJAX operation(s)..." );
                if( 1 == c ) me.element.stop().fadeIn();
            }
            startAjaxNotif.ajaxCount = 0.
            startAjaxNotif.element = jQuery('#whikiAjaxNotification');

            function endAjaxNotif() {
                var c = --startAjaxNotif.ajaxCount;
                startAjaxNotif.element.text( c+" pending AJAX operation(s)..." );
                if( 0 == c ) startAjaxNotif.element.stop().fadeOut();
            }
            @endcode

            Set the beforeSend/afterSend properties to those
            functions to enable the notifications by default.
        */
        afterSend: function(request,opt){},

        /**
            If jsonp is a string then the WhAjaj-internal response
            handling code ASSUMES that the response contains a JSONP-style
            construct and eval()s it after afterSend() but before onResponse().
            In this case, onResponse() will get a string value for the response
            instead of a response object parsed from JSON.
        */
        jsonp:undefined,
        /**
            Don't use yet. Planned future option.
        */
        propagateExceptions:false
    }
};


/**
    WhAjaj.Connector.prototype.callbacks defines callbacks analog
    to the onXXX callbacks defined in WhAjaj.Connector.options.ajax,
    with two notable differences:

    1) these callbacks, if set, are called in addition to any
    request-specific callback. The intention is to allow a framework to set
    "framework-level" callbacks which should be called independently of the
    request-specific callbacks (without interfering with them, e.g.
    requiring special re-forwarding features).

    2) The 'this' object in these callbacks is the Connector instance
    associated with the callback, whereas the "other" onXXX form has its
    "ajax options" object as its this.

    When this API says that an onXXX callback will be called for a request,
    both the request's onXXX (if set) and this one (if set) will be called.
*/
WhAjaj.Connector.prototype.callbacks = {};
/**
    Instance-specific values for AJAJ-level properties (as opposed to
    application-level request properties). Options set here "override" those
    specified in WhAjaj.Connector.options.ajax and are "overridden" by
    options passed to sendRequest().
*/
WhAjaj.Connector.prototype.options = {};


/**
    Tries to find the given key in any of the following, returning
    the first match found: opt, this.options, WhAjaj.Connector.options.ajax.

    Returns undefined if key is not found.
*/
WhAjaj.Connector.prototype.derivedOption = function(key,opt) {
    var v = opt ? opt[key] : undefined;
    if( undefined !== v ) return v;
    else v = this.options[key];
    if( undefined !== v ) return v;
    else v = WhAjaj.Connector.options.ajax[key];
    return v;
};

/**
    Returns a unique string on each call containing a generic
    reandom request identifier string. This is not used by the core
    API but can be used by client code to generate unique IDs for
    each request (if needed).

    The exact format is unspecified and may change in the future.

    Request IDs can be used by clients to "match up" responses to
    specific requests if needed. In practice, however, they are
    seldom, if ever, needed. When passing several concurrent
    requests through the same response callback, it might be useful
    for some clients to be able to distinguish, possibly re-routing
    them through other handlers based on the originating request type.

    If this.options.requestIdPrefix or
    WhAjaj.Connector.options.requestIdPrefix is set then that text
    is prefixed to the returned string.
*/
WhAjaj.Connector.prototype.generateRequestId = function()
{
    if( undefined === arguments.callee.sequence )
    {
        arguments.callee.sequence = 0;
    }
    var pref = this.options.requestIdPrefix || WhAjaj.Connector.options.requestIdPrefix || '';
    return pref +
        WhAjaj.msTimestamp() +
        '/'+(Math.round( Math.random() * 100000000) )+
        ':'+(++arguments.callee.sequence);
};

/**
    Copies (SHALLOWLY) all properties in opt to this.options.
*/
WhAjaj.Connector.prototype.addOptions = function(opt) {
    var k, v;
    for( k in opt ) {
        if( ! opt.hasOwnProperty(k) ) continue /* proactive Prototype kludge! */;
        this.options[k] = opt[k];
    }
    return this.options;
};

/**
    An internal helper object which holds several functions intended
    to simplify the creation of concrete communication channel
    implementations for WhAjaj.Connector.sendImpl(). These operations
    take care of some of the more error-prone parts of ensuring that
    onResponse(), onError(), etc. callbacks are called consistently
    using the same rules.
*/
WhAjaj.Connector.sendHelper = {
    /**
        opt is assumed to be a normalized set of
        WhAjaj.Connector.sendRequest() options. This function
        creates a url by concatenating opt.url and some form of
        opt.urlParam.

        If opt.urlParam is an object or string then it is appended
        to the url. An object is assumed to be a one-dimensional set
        of simple (urlencodable) key/value pairs, and not larger
        data structures. A string value is assumed to be a
        well-formed, urlencoded set of key/value pairs separated by
        '&' characters.

        The new/normalized URL is returned (opt is not modified). If
        opt.urlParam is not set then opt.url is returned (or an
        empty string if opt.url is itself a false value).

        TODO: if opt is-a Object and any key points to an array,
        build up a list of keys in the form "keyname[]". We could
        arguably encode sub-objects like "keyname[subkey]=...", but
        i don't know if that's conventions-compatible with other
        frameworks.
    */
    normalizeURL: function(opt) {
        var u = opt.url || '';
        if( opt.urlParam ) {
            var addQ = (u.indexOf('?') >= 0) ? false : true;
            var addA = addQ ? false : ((u.indexOf('&')>=0) ? true : false);
            var tail = '';
            if( WhAjaj.isObject(opt.urlParam) ) {
                var li = [], k;
                for( k in opt.urlParam) {
                    li.push( k+'='+encodeURIComponent( opt.urlParam[k] ) );
                }
                tail = li.join('&');
            }
            else if( 'string' === typeof opt.urlParam ) {
                tail = opt.urlParam;
            }
            u = u + (addQ ? '?' : '') + (addA ? '&' : '') + tail;
        }
        return u;
    },
    /**
        Should be called by WhAjaj.Connector.sendImpl()
        implementations after a response has come back. This
        function takes care of most of ensuring that framework-level
        conventions involving WhAjaj.Connector.options.ajax
        properties are followed.

        The request argument must be the original request passed to
        the sendImpl() function. It may legally be null for GET requests.

        The opt object should be the normalized AJAX options used
        for the connection.

        The resp argument may be either a plain Object or a string
        (in which case it is assumed to be JSON).

        The 'this' object for this call MUST be a WhAjaj.Connector
        instance in order for callback processing to work properly.

        This function takes care of the following:

        - Calling opt.afterSend()

        - If resp is a string, de-JSON-izing it to an object.

        - Calling opt.onResponse()

        - Calling opt.onError() in several common (potential) error
        cases.

        - If resp is-a String and opt.jsonp then resp is assumed to be
        a JSONP-form construct and is eval()d BEFORE opt.onResponse()
        is called. It is arguable to eval() it first, but the logic
        integrates better with the non-jsonp handler.

        The sendImpl() should return immediately after calling this.

        The sendImpl() must call only one of onSendSuccess() or
        onSendError(). It must call one of them or it must implement
        its own response/error handling, which is not recommended
        because getting the documented semantics of the
        onError/onResponse/afterSend handling correct can be tedious.
    */
    onSendSuccess:function(request,resp,opt) {
        var cb = this.callbacks || {};
        if( WhAjaj.isFunction(cb.afterSend) ) {
            try {cb.afterSend( request, opt );}
            catch(e){}
        }
        if( WhAjaj.isFunction(opt.afterSend) ) {
            try {opt.afterSend( request, opt );}
            catch(e){}
        }
        function doErr(){
            if( WhAjaj.isFunction(cb.onError) ) {
                try {cb.onError( request, opt );}
                catch(e){}
            }
            if( WhAjaj.isFunction(opt.onError) ) {
                try {opt.onError( request, opt );}
                catch(e){}
            }
        }
        if( ! resp ) {
            opt.errorMessage = "Sending of request succeeded but returned no data!";
            doErr();
            return false;
        }

        if( 'string' === typeof resp ) {
            try {
                resp = opt.jsonp ? eval(resp) : JSON.parse(resp);
            } catch(e) {
                opt.errorMessage = e.toString();
                doErr();
                return;
            }
        }
        try {
            if( WhAjaj.isFunction( cb.onResponse  ) ) {
                cb.onResponse( resp, request, opt );
            }
            if( WhAjaj.isFunction( opt.onResponse  ) ) {
                opt.onResponse( resp, request, opt );
            }
            return true;
        }
        catch(e) {
            opt.errorMessage = "Exception while handling inbound JSON response:\n"
                + e
                +"\nOriginal response data:\n"+JSON.stringify(resp,0,2)
                ;
            ;
            doErr();
            return false;
        }
    },
   /**
        Should be called by sendImpl() implementations after a response
        has failed to connect (e.g. could not resolve host or timeout
        reached). This function takes care of most of ensuring that
        framework-level conventions involving WhAjaj.Connector.options.ajax
        properties are followed.

        The request argument must be the original request passed to
        the sendImpl() function. It may legally be null for GET
        requests.

        The 'this' object for this call MUST be a WhAjaj.Connector
        instance in order for callback processing to work properly.

        The opt object should be the normalized AJAX options used
        for the connection. By convention, the caller of this
        function "should" set opt.errorMessage to contain a
        human-readable description of the error.

        The sendImpl() should return immediately after calling this. The
        return value from this function is unspecified.
    */
    onSendError: function(request,opt) {
        var cb = this.callbacks || {};
        if( WhAjaj.isFunction(cb.afterSend) ) {
            try {cb.afterSend( request, opt );}
            catch(e){}
        }
        if( WhAjaj.isFunction(opt.afterSend) ) {
            try {opt.afterSend( request, opt );}
            catch(e){}
        }
        if( WhAjaj.isFunction( cb.onError ) ) {
            try {cb.onError( request, opt );}
            catch(e) {/*ignore*/}
        }
        if( WhAjaj.isFunction( opt.onError ) ) {
            try {opt.onError( request, opt );}
            catch(e) {/*ignore*/}
        }
    }
};

/**
    WhAjaj.Connector.sendImpls holds several concrete
    implementations of WhAjaj.Connector.prototype.sendImpl(). To use
    a specific implementation by default assign
    WhAjaj.Connector.prototype.sendImpl to one of these functions.

    The functions defined here require that the 'this' object be-a
    WhAjaj.Connector instance.

    Historical notes:

    a) We once had an implementation based on Prototype, but that
    library just pisses me off (they change base-most types'
    prototypes, introducing side-effects in client code which
    doesn't even use Prototype). The Prototype version at the time
    had a serious toJSON() bug which caused empty arrays to
    serialize as the string "[]", which broke a bunch of my code.
    (That has been fixed in the mean time, but i don't use
    Prototype.)

    b) We once had an implementation for the dojo library,

    If/when the time comes to add Prototype/dojo support, we simply
    need to port:

    http://code.google.com/p/jsonmessage/source/browse/trunk/lib/JSONMessage/JSONMessage.inc.js

    (search that file for "dojo" and "Prototype") to this tree. That
    code is this code's generic grandfather and they are still very
    similar, so a port is trivial.

*/
WhAjaj.Connector.sendImpls = {
    /**
        This is a concrete implementation of
        WhAjaj.Connector.prototype.sendImpl() which uses the
        environment's native XMLHttpRequest class to send whiki
        requests and fetch the responses.

        The only argument must be a connection properties object, as
        constructed by WhAjaj.Connector.normalizeAjaxParameters().

        If window.firebug is set then window.firebug.watchXHR() is
        called to enable monitoring of the XMLHttpRequest object.

        This implementation honors the loginName and loginPassword
        connection parameters.

        Returns the XMLHttpRequest object.

        This implementation requires that the 'this' object be-a
        WhAjaj.Connector.

        This implementation uses setTimeout() to implement the
        timeout support, and thus the JS engine must provide that
        functionality.
    */
    XMLHttpRequest: function(request, args)
    {
        var json = WhAjaj.isObject(request) ? JSON.stringify(request) : request;
        var xhr = new XMLHttpRequest();
        var startTime = (new Date()).getTime();
        var timeout = args.timeout || 10000/*arbitrary!*/;
        var hitTimeout = false;
        var done = false;
        var tmid /* setTimeout() ID */;
        var whself = this;
        function handleTimeout()
        {
            hitTimeout = true;
            if( ! done )
            {
                var now = (new Date()).getTime();
                try { xhr.abort(); } catch(e) {/*ignore*/}
                // see: http://www.w3.org/TR/XMLHttpRequest/#the-abort-method
                args.errorMessage = "Timeout of "+timeout+"ms reached after "+(now-startTime)+"ms during AJAX request.";
                WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
            }
            return;
        }
        function onStateChange()
        { // reminder to self: apparently 'this' is-not-a XHR :/
            if( hitTimeout )
            { /* we're too late - the error was already triggered. */
                return;
            }

            if( 4 == xhr.readyState )
            {
                done = true;
                if( tmid )
                {
                    clearTimeout( tmid );
                    tmid = null;
                }
                if( (xhr.status >= 200) && (xhr.status < 300) )
                {
                    WhAjaj.Connector.sendHelper.onSendSuccess.apply( whself, [request, xhr.responseText, args] );
                    return;
                }
                else
                {
                    if( undefined === args.errorMessage )
                    {
                        args.errorMessage = "Error sending a '"+args.method+"' AJAX request to "
                                +"["+args.url+"]: "
                                +"Status text=["+xhr.statusText+"]"
                            ;
                        WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
                    }
                    else { /*maybe it was was set by the timeout handler. */ }
                    return;
                }
            }
        };

        xhr.onreadystatechange = onStateChange;
        if( ('undefined'!==(typeof window)) && ('firebug' in window) && ('watchXHR' in window.firebug) )
        { /* plug in to firebug lite's XHR monitor... */
            window.firebug.watchXHR( xhr );
        }
        try
        {
            //alert( JSON.stringify( args  ));
            function xhrOpen()
            {
                if( ('loginName' in args) && args.loginName )
                {
                    xhr.open( args.method, args.url, args.asynchronous, args.loginName, args.loginPassword );
                }
                else
                {
                    xhr.open( args.method, args.url, args.asynchronous  );
                }
            }
            if( json && ('POST' ===  args.method.toUpperCase()) )
            {
                xhrOpen();
                xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                // Google Chrome warns that it refuses to set these
                // "unsafe" headers (his words, not mine):
                // xhr.setRequestHeader("Content-length", json.length);
                // xhr.setRequestHeader("Connection", "close");
                xhr.send( json );
            }
            else /* assume GET */
            {
                xhrOpen();
                xhr.send(null);
            }
            tmid = setTimeout( handleTimeout, timeout );
            return xhr;
        }
        catch(e)
        {
            args.errorMessage = e.toString();
            WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
            return undefined;
        }
    }/*XMLHttpRequest()*/,
    /**
        This is a concrete implementation of
        WhAjaj.Connector.prototype.sendImpl() which uses the jQuery
        AJAX API to send requests and fetch the responses.

        The first argument may be either null/false, an Object
        containing toJSON-able data to post to the back-end, or such an
        object in JSON string form.

        The second argument must be a connection properties object, as
        constructed by WhAjaj.Connector.normalizeAjaxParameters().

        If window.firebug is set then window.firebug.watchXHR() is
        called to enable monitoring of the XMLHttpRequest object.

        This implementation honors the loginName and loginPassword
        connection parameters.

        Returns the XMLHttpRequest object.

        This implementation requires that the 'this' object be-a
        WhAjaj.Connector.
    */
    jQuery:function(request,args)
    {
        var data = request || undefined;
        var whself = this;
        if( data ) {
            if('string'!==typeof data) {
                try {
                    data = JSON.stringify(data);
                }
                catch(e) {
                    WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
                    return;
                }
            }
        }
        var ajopt = {
            url: args.url,
            data: data,
            type: args.method,
            async: args.asynchronous,
            password: (undefined !== args.loginPassword) ? args.loginPassword : undefined,
            username: (undefined !== args.loginName) ? args.loginName : undefined,
            contentType: 'application/json; charset=utf-8',
            error: function(xhr, textStatus, errorThrown)
            {
                //this === the options for this ajax request
                args.errorMessage = "Error sending a '"+ajopt.type+"' request to ["+ajopt.url+"]: "
                        +"Status text=["+textStatus+"]"
                        +(errorThrown ? ("Error=["+errorThrown+"]") : "")
                    ;
                WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
            },
            success: function(data)
            {
                WhAjaj.Connector.sendHelper.onSendSuccess.apply( whself, [request, data, args] );
            },
            /* Set dataType=text instead of json to keep jQuery from doing our carefully
                written response handling for us.
            */
            dataType: 'text'
        };
        if( undefined !== args.timeout )
        {
            ajopt.timeout = args.timeout;
        }
        try
        {
            return jQuery.ajax(ajopt);
        }
        catch(e)
        {
            args.errorMessage = e.toString();
            WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
            return undefined;
        }
    }/*jQuery()*/,
    /**
        This is a concrete implementation of
        WhAjaj.Connector.prototype.sendImpl() which uses the rhino
        Java API to send requests and fetch the responses.

        Limitations vis-a-vis the interface:

        - timeouts are not supported.

        - asynchronous mode is not supported because implementing it
        requires the ability to kill a running thread (which is deprecated
        in the Java API).

        TODOs:

        - add socket timeouts.

        - support HTTP proxy.

        The Java APIs support this, it just hasn't been added here yet.
    */
    rhino:function(request,args)
    {
        var self = this;
        var data = request || undefined;
        if( data ) {
            if('string'!==typeof data) {
                try {
                    data = JSON.stringify(data);
                }
                catch(e) {
                    WhAjaj.Connector.sendHelper.onSendError.apply( self, [request, args] );
                    return;
                }
            }
        }
        var url;
        var con;
        var IO = new JavaImporter(java.io);
        var wr;
        var rd, ln, json = [];
        function setIncomingCookies(list){
            if(!list || !list.length) return;
            if( !self.cookies ) self.cookies = {};
            var k, v, i;
            for( i = 0; i < list.length; ++i ){
                v = list[i].split('=',2);
                k = decodeURIComponent(v[0])
                v = v[0] ? decodeURIComponent(v[0].split(';',2)[0]) : null;
                //print("RECEIVED COOKIE: "+k+"="+v);
                if(!v) {
                    delete self.cookies[k];
                    continue;
                }else{
                    self.cookies[k] = v;
                }
            }
        };
        function setOutboundCookies(conn){
            if(!self.cookies) return;
            var k, v;
            for( k in self.cookies ){
                if(!self.cookies.hasOwnProperty(k)) continue /*kludge for broken JS libs*/;
                v = self.cookies[k];
                conn.addRequestProperty("Cookie", encodeURIComponent(k)+'='+encodeURIComponent(v));
                //print("SENDING COOKIE: "+k+"="+v);
            }
        };
        try{
            url = new java.net.URL( args.url )
            con = url.openConnection(/*FIXME: add proxy support!*/);
            con.setRequestProperty("Accept-Charset","utf-8");
            setOutboundCookies(con);
            if(data){
                con.setRequestProperty("Content-Type","application/json; charset=utf-8");
                con.setDoOutput( true );
                wr = new IO.OutputStreamWriter(con.getOutputStream())
                wr.write(data);
                wr.flush();
                wr.close();
                wr = null;
                //print("POSTED: "+data);
            }
            rd = new IO.BufferedReader(new IO.InputStreamReader(con.getInputStream()));
            //var skippedHeaders = false;
            while ((line = rd.readLine()) !== null) {
                //print("LINE: "+line);
                //if(!line.length && !skippedHeaders){
                //    skippedHeaders = true;
                // json = [];
                //    continue;
                //}
                json.push(line);
            }
            setIncomingCookies(con.getHeaderFields().get("Set-Cookie"));
        }catch(e){
            args.errorMessage = e.toString();
            WhAjaj.Connector.sendHelper.onSendError.apply( self, [request, args] );
            return undefined;
        }
        try { if(wr) wr.close(); } catch(e) { /*ignore*/}
        try { if(rd) rd.close(); } catch(e) { /*ignore*/}
        json = json.join('');
        //print("READ IN JSON: "+json);
        WhAjaj.Connector.sendHelper.onSendSuccess.apply( self, [request, json, args] );
    }/*rhino*/
};

/**
    An internal function which takes an object containing properties
    for a WhAjaj.Connector network request. This function creates a new
    object containing a superset of the properties from:

    a) opt
    b) this.options
    c) WhAjaj.Connector.options.ajax

    in that order, using the first one it finds.

    All non-function properties are _deeply_ copied via JSON cloning
    in order to prevent accidental "cross-request pollenation" (been
    there, done that). Functions cannot be cloned and are simply
    copied by reference.

    This function throws if JSON-copying one of the options fails
    (e.g. due to cyclic data structures).

    Reminder to self: this function does not "normalize" opt.urlParam
    by encoding it into opt.url, mainly for historical reasons, but
    also because that behaviour was specifically undesirable in this
    code's genetic father.
*/
WhAjaj.Connector.prototype.normalizeAjaxParameters = function (opt)
{
    var rc = {};
    function merge(k,v)
    {
        if( rc.hasOwnProperty(k) ) return;
        else if( WhAjaj.isFunction(v) ) {}
        else if( WhAjaj.isObject(v) ) v = JSON.parse( JSON.stringify(v) );
        rc[k]=v;
    }
    function cp(obj) {
        if( ! WhAjaj.isObject(obj) ) return;
        var k;
        for( k in obj ) {
            if( ! obj.hasOwnProperty(k) ) continue /* i will always hate the Prototype designers for this. */;
            merge(k, obj[k]);
        }
    }
    cp( opt );
    cp( this.options );
    cp( WhAjaj.Connector.options.ajax );
    // no, not here: rc.url = WhAjaj.Connector.sendHelper.normalizeURL(rc);
    return rc;
};

/**
    This is the generic interface for making calls to a back-end
    JSON-producing request handler. It is a simple wrapper around
    WhAjaj.Connector.prototype.sendImpl(), which just normalizes the
    connection options for sendImpl() and makes sure that
    opt.beforeSend() is (possibly) called.

    The request parameter must either be false/null/empty or a
    fully-populated JSON-able request object (which will be sent as
    unencoded application/json text), depending on the type of
    request being made. It is never semantically legal (in this API)
    for request to be a string/number/true/array value. As a rule,
    only POST requests use the request data. GET requests should
    encode their data in opt.url or opt.urlParam (see below).

    opt must contain the network-related parameters for the request.
    Paramters _not_ set in opt are pulled from this.options or
    WhAjaj.Connector.options.ajax (in that order, using the first
    value it finds). Thus the set of connection-level options used
    for the request are a superset of those various sources.

    The "normalized" (or "superimposed") opt object's URL may be
    modified before the request is sent, as follows:

    if opt.urlParam is a string then it is assumed to be properly
    URL-encoded parameters and is appended to the opt.url. If it is
    an Object then it is assumed to be a one-dimensional set of
    key/value pairs with simple values (numbers, strings, booleans,
    null, and NOT objects/arrays). The keys/values are URL-encoded
    and appended to the URL.

    The beforeSend() callback (see below) can modify the options
    object before the request attempt is made.

    The callbacks in the normalized opt object will be triggered as
    follows (if they are set to Function values):

    - beforeSend(request,opt) will be called before any network
    processing starts. If beforeSend() throws then no other
    callbacks are triggered and this function propagates the
    exception. This function is passed normalized connection options
    as its second parameter, and changes this function makes to that
    object _will_ be used for the pending connection attempt.

    - onError(request,opt) will be called if a connection to the
    back-end cannot be established. It will be passed the original
    request object (which might be null, depending on the request
    type) and the normalized options object. In the error case, the
    opt object passed to onError() "should" have a property called
    "errorMessage" which contains a description of the problem.

    - onError(request,opt) will also be called if connection
    succeeds but the response is not JSON data.

    - onResponse(response,request) will be called if the response
    returns JSON data. That data might hold an error response code -
    clients need to check for that. It is passed the response object
    (a plain object) and the original request object.

    - afterSend(request,opt) will be called directly after the
    AJAX request is finished, before onError() or onResonse() are
    called. Possible TODO: we explicitly do NOT pass the response to
    this function in order to keep the line between the responsibilities
    of the various callback clear (otherwise this could be used the same
    as onResponse()). In practice it would sometimes be useful have the
    response passed to this function, mainly for logging/debugging
    purposes.

    The return value from this function is meaningless because
    AJAX operations tend to take place asynchronously.

*/
WhAjaj.Connector.prototype.sendRequest = function(request,opt)
{
    if( !WhAjaj.isFunction(this.sendImpl) )
    {
        throw new Error("This object has no sendImpl() member function! I don't know how to send the request!");
    }
    var ex = false;
    var av = Array.prototype.slice.apply( arguments, [0] );

    /**
        FIXME: how to handle the error, vis-a-vis- the callbacks, if
        normalizeAjaxParameters() throws? It can throw if
        (de)JSON-izing fails.
    */
    var norm = this.normalizeAjaxParameters( WhAjaj.isObject(opt) ? opt : {} );
    norm.url = WhAjaj.Connector.sendHelper.normalizeURL(norm);
    if( ! request ) norm.method = 'GET';
    var cb = this.callbacks || {};
    if( this.callbacks && WhAjaj.isFunction(this.callbacks.beforeSend) ) {
        this.callbacks.beforeSend( request, norm );
    }
    if( WhAjaj.isFunction(norm.beforeSend) ){
        norm.beforeSend( request, norm );
    }
    //alert( WhAjaj.stringify(request)+'\n'+WhAjaj.stringify(norm));
    try { this.sendImpl( request, norm ); }
    catch(e) { ex = e; }
    if(ex) throw ex;
};

/**
    sendImpl() holds a concrete back-end connection implementation. It
    can be replaced with a custom implementation if one follows the rules
    described throughout this API. See WhAjaj.Connector.sendImpls for
    the concrete implementations included with this API.
*/
//WhAjaj.Connector.prototype.sendImpl = WhAjaj.Connector.sendImpls.XMLHttpRequest;
//WhAjaj.Connector.prototype.sendImpl = WhAjaj.Connector.sendImpls.rhino;
//WhAjaj.Connector.prototype.sendImpl = WhAjaj.Connector.sendImpls.jQuery;

if( 'undefined' !== typeof jQuery ){
    WhAjaj.Connector.prototype.sendImpl = WhAjaj.Connector.sendImpls.jQuery;
}
else {
    WhAjaj.Connector.prototype.sendImpl = WhAjaj.Connector.sendImpls.XMLHttpRequest;
}

Added ajax/wiki-editor.html.






























































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <title>Fossil/JSON Wiki Editor Prototype</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/whajaj.js"></script>
    <script type="text/javascript" src="js/fossil-ajaj.js"></script>

<style type='text/css'>
th {
  text-align: left;
  background-color: #ececec;
}

.dangerWillRobinson {
    background-color: yellow;
}

.wikiPageLink {
    text-decoration: underline;
}
</style>

<script type='text/javascript'>
WhAjaj.Connector.options.ajax.url =
/*
    Change this to your CGI/server root path:
*/
     //'http://fjson/cgi-bin/fossil.cgi'
     //'/repos/fossil-sgb/json.cgi'
    '/cgi-bin/fossil-json.cgi'
     ;
var TheApp = {
      response:null,
      sessionID:null,
      jqe:{}/*jqe==jQuery Elements*/,
      ajaxCount:0,
      cgi: new FossilAjaj(),
      pages:{}
};


TheApp.startAjaxNotif = function()
{
    ++this.ajaxCount;
    TheApp.jqe.responseContainer.removeClass('dangerWillRobinson');
    this.jqe.ajaxNotification.attr( 'title', this.ajaxCount+" pending AJAX operation(s)..." );
    if( 1 == this.ajaxCount ) this.jqe.ajaxNotification.fadeIn();
};

TheApp.endAjaxNotif = function()
{
    --this.ajaxCount;
    this.jqe.ajaxNotification.attr( 'title', this.ajaxCount+" pending AJAX operation(s)..." );
    if( 0 == this.ajaxCount ) this.jqe.ajaxNotification.fadeOut();
};

TheApp.responseContainsError = function(resp) {
    if( !resp || resp.resultCode ) {
        //alert("Error response:\n"+JSON.stringify(resp,0,4));
        TheApp.jqe.taResponse.val( "RESPONSE CONTAINS ERROR INFO:\n"+WhAjaj.stringify(resp) );
        //TheApp.jqe.responseContainer.css({backgroundColor:'yellow'});
        //TheApp.jqe.responseContainer.addClass('dangerWillRobinson');
        TheApp.jqe.responseContainer.flash( '255,0,0', 1500 );
        return true;
    }
    return false;
};


TheApp.sendRequest = function() {
    var path = this.jqe.textPath.val();
    var self = this;
    var data = this.jqe.pageListArea.val();
    var doPost = (data && data.length);
    var req;
    if( doPost ) try {
        req = JSON.parse(data);
    }
    catch(e) {
        TheApp.jqe.taResponse.val("Request is not valid JSON.\n"+e);
        return;
    }
    if( req ) {
        req.requestId = this.cgi.generateRequestId();
    }
    var self = this;
    var opt = {
        url: WhAjaj.Connector.options.ajax.url + path,
        method: doPost ? 'POST' : 'GET'
    };
    this.cgi.sendRequest( req, opt );
};
jQuery.fn.animateHighlight = function(highlightColor, duration) {
    var highlightBg = highlightColor || "#FFFF9C";
    var animateMs = duration || 1500;
    var originalBg = this.css("backgroundColor");
    this.stop().css("background-color", highlightBg).animate({backgroundColor: originalBg}, animateMs);
};
jQuery.fn.flash = function( color, duration )
{
    var current = this.css( 'color' );
    this.animate( { color: 'rgb(' + color + ')' }, duration / 2);
    this.animate( { color: current }, duration / 2 );
};

jQuery(document).ready(function(){
    var ids = [
        'btnSend',
        'ajaxNotification',
        'currentAuthToken',
        'responseContainer',
        'spanPageName',
        'pageListArea',
        'taPageContent',
        'taResponse',
        'textPath', // list of HTML element IDs we use often.
        'timer'
    ];
    var i, k;
    for( i = 0; i < ids.length; ++i ) {
        k = ids[i];
        TheApp.jqe[k] = jQuery('#'+k);
    }
    TheApp.jqe.textPath.
        keyup(function(event){
            if(event.keyCode == 13){
                TheApp.sendRequest();
            }
        });
    TheApp.timer = {
        _tstart:0,_tend:0,duration:0,
        start:function(){
            this._tstart = (new Date()).getTime();
        },
        end:function(){
            this._tend = (new Date()).getTime();
            return this.duration = this._tend - this._tstart;
        }
    };
    var ajcb = TheApp.cgi.ajaj.callbacks;
    ajcb.beforeSend = TheApp.beforeSend = function(req,opt) {
        TheApp.timer.start();
        var val =
            req ?
            (('string'===typeof req) ? req : WhAjaj.stringify(req))
            : '';
        TheApp.jqe.taResponse.val('');
        TheApp.startAjaxNotif();
    };
    ajcb.afterSend = TheApp.afterSend = function(req,opt) {
        TheApp.timer.end();
        TheApp.endAjaxNotif();
        TheApp.jqe.timer.text( "(Round-trip time: "+TheApp.timer.duration+'ms)' );
    };
    ajcb.onResponse = TheApp.onResponse = function(resp,req) {
        var val;
        try {
            val = WhAjaj.stringify(resp);
        }
        catch(e) {
            val = WhAjaj.stringify(e)
        }
        if(resp.resultCode){
            alert("Response contains error info:\n"+val);
        }
        TheApp.jqe.taResponse.val( val );
    };
    ajcb.onError = function(req,opt) {
        TheApp.jqe.taResponse.val( "ERROR SENDING REQUEST:\n"+WhAjaj.stringify(opt) );
    };

    TheApp.jqe.taPageContent.blur(function(){
        var p = TheApp.currentPage;
        if(! p ) return;
        p.content = TheApp.jqe.taPageContent.val();
    });

    TheApp.cgi.onLogin = function(){
      TheApp.jqe.taResponse.val( "Logged in: "+WhAjaj.stringify(this.auth));
      TheApp.jqe.currentAuthToken.text("Logged in: "+WhAjaj.stringify(this.auth));
    };
    TheApp.cgi.onLogout = function(){
      TheApp.jqe.taResponse.val( "Logged out!" );
      TheApp.jqe.currentAuthToken.text("");
    };

    TheApp.showPage = function(name){
        function doShow(page){
            TheApp.currentPage = page;
            TheApp.jqe.spanPageName.text('('+page.name+')');
            TheApp.jqe.taPageContent.val(page.content);
        }
        var p = ('object' === typeof name) ? name : TheApp.pages[name];
        if(('object' === typeof p) && p.content) {
            doShow(p);
            return;
        }
        TheApp.cgi.sendCommand('/json/wiki/get',{
            name:name
        },{
            onResponse:function(resp,req){
                TheApp.onResponse(resp,req);
                if(resp.resultCode) return;
                var p = resp.payload;
                doShow( TheApp.pages[p.name] = p );
            }
        });
    };
    TheApp.refreshPageListView = function(){
        var list = (function(){
            var k, v, li = [];
            for( k in TheApp.pages ){
                if(!TheApp.pages.hasOwnProperty(k)) continue;
                li.push(k);
            }
            return li;
        })();
        var i, p, a, tgt = TheApp.jqe.pageListArea;
        tgt.text('');
        function makeLink(name){
            var link = jQuery('<span></span>');
            link.text(name);
            link.addClass('wikiPageLink');
            link.click(function(e){
                TheApp.showPage(name);
                e.preventDefault();
                return false;
            });
            return link;
        }
        list.sort();
        for( i = 0; i < list.length; ++i ){
            tgt.append(makeLink(list[i]));
            tgt.append('<br/>');
        }
    };

    TheApp.loadPageList = function(){
        TheApp.cgi.sendCommand('/json/wiki/list',null,{
            onResponse:function(resp,req){
                TheApp.onResponse(resp,req);
                if(resp.resultCode) return;
                var i, v, p, ar = resp.payload;
                for( i = 0; i < ar.length; ++i ){
                    v = ar[i];
                    p = TheApp.pages[v];
                    if( !p ) TheApp.pages[v] = {name:v};
                }
                TheApp.refreshPageListView();
            }
        });
        return false /*for click handlers*/;
    }

    TheApp.savePage = function(p){
        p = p || TheApp.currentPage;
        if( 'object' !== typeof p ){
            p = TheApp.pages[p];
        }
        if('object' !== typeof p){
            alert("savePage() argument is not a page object or known page name.");
        }
        TheApp.pages[p.name] = p;
        p.content = TheApp.jqe.taPageContent.val();
        var req = {
            name:p.name,
            content:p.content
        };
        if(! confirm("Really save wiki page ["+p.name+"]?") ) return;
        TheApp.cgi.sendCommand('/json/wiki/'+(p.isNew?'create':'save'),req,{
            onResponse:function(resp,req){
                TheApp.onResponse(resp,req);
                if(resp.resultCode) return;
                delete p.isNew;
                p.timestamp = resp.payload.timestamp;
            }
        });

    };

    TheApp.createNewPage = function(){
        var name = prompt("New page name?");
        if(!name) return;
        var p = {
            name:name,
            content:"New, empty page.",
            isNew:true
        };
        TheApp.pages[name] = p;
        TheApp.refreshPageListView();
        TheApp.showPage(p);
/*
        if(! confirm("Really create new wiki page ["+name+"]?") ) return;
        TheApp.cgi.sendCommand('/json/wiki/create',req,{
            onResponse:function(resp,req){
                TheApp.onResponse(resp,req);
                if(resp.resultCode) return;
                TheApp.pages[p.name] = p;
                TheApp.refreshPageListView();
            }
        });
*/
    };

    TheApp.cgi.whoami();

});

</script>

</head>

<body>
<span id='ajaxNotification'></span>
<h1>PROTOTYPE JSON-based Fossil Wiki Editor</h1>

See also: <a href='index.html'>main test page</a>.

<br>
<b>Login:</b>
<br/>
<input type='button' value='Anon. Login' onclick='TheApp.cgi.login()' />
or:
name:<input type='text' id='textUser' value='json-demo' size='12'/>
pw:<input type='password' id='textPassword' value='json-demo' size='12'/>
<input type='button' value='login' onclick='TheApp.cgi.login(jQuery("#textUser").val(),jQuery("#textPassword").val(),{onResponse:TheApp.onLogin})' />
<input type='button' value='logout' onclick='TheApp.cgi.logout()' />

<br/>
<span id='currentAuthToken' style='font-family:monospaced'></span>

<hr/>
<strong>Quick-posts:</strong><br/>
<input type='button' value='HAI' onclick='TheApp.cgi.HAI()' />
<input type='button' value='stat' onclick='TheApp.cgi.sendCommand("/json/stat")' />
<input type='button' value='whoami' onclick='TheApp.cgi.whoami()' />
<input type='button' value='wiki/list' onclick='TheApp.loadPageList()' />
<!--
<input type='button' value='timeline/ci' onclick='TheApp.cgi.sendCommand("/json/timeline/ci")' />
-->

<!--
<input type='button' value='get whiki' onclick='TheApp.cgi.getPages("whiki")' />
<input type='button' value='get more' onclick='TheApp.cgi.getPages("HelloWorld/WhikiNews")' />
<input type='button' value='get client data' onclick='TheApp.cgi.getPageClientData("HelloWorld/whiki/WhikiCommands")' />
<input type='button' value='save client data' onclick='TheApp.cgi.savePageClientData({"HelloWorld":[1,3,5]})' />
-->
<hr/>

<table>
    <tr>
        <th>Page List</th>
        <th>Content <span id='spanPageName'></span></th>
    </tr>
    <tr>
        <td width='25%' valign='top'>
            <input type='button' value='Create new...' onclick='TheApp.createNewPage()' /><br/>
            <div id='pageListArea'></div>
        </td>
        <td width='75%' valign='top'>
            <input type='button' value='Save' onclick='TheApp.savePage()' /><br/>
            <textarea id='taPageContent' rows='20' cols='60'></textarea>
        </td>
    </tr>
    <tr>
        <th colspan='2'>Response <span id='timer'></span></th>
    </tr>
    <tr>
        <td colspan='2' id='responseContainer'>
            <textarea id='taResponse' rows='20' cols='80' readonly></textarea>
        </td>
    </tr>
</table>
<div></div>
<div></div>
<div></div>

</body></html>

Added art/CollRev1.dia.


























































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="15,13"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.95,12.95;20.05,15.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="15,13"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="5"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="16.2733,14.064"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="16.2733,13.5215;18.7096,14.4615"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="16.2733,14.064"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="15,7"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.95,6.95;20.05,9.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="15,7"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="5"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="17.0039,8.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="17.0039,7.52147;17.979,8.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#File#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="17.0039,8.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O4">
          <dia:attribute name="obj_pos">
            <dia:point val="15,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.95,0.95;20.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="15,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="5"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O5">
          <dia:attribute name="obj_pos">
            <dia:point val="16.4942,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="16.4942,1.52147;18.4887,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Project#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="16.4942,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - ZigZagLine" version="1" id="O6">
        <dia:attribute name="obj_pos">
          <dia:point val="17.5,13"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="17.45,8.92929;17.55,13"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="17.5,13"/>
          <dia:point val="17.5,13"/>
          <dia:point val="17.5,9"/>
          <dia:point val="17.5,9"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="0"/>
          <dia:enum val="1"/>
          <dia:enum val="0"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - ZigZagLine" version="1" id="O7">
        <dia:attribute name="obj_pos">
          <dia:point val="17.5,7"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="17.45,2.92929;17.55,7"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="17.5,7"/>
          <dia:point val="17.5,7"/>
          <dia:point val="17.5,3"/>
          <dia:point val="17.5,3"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="0"/>
          <dia:enum val="1"/>
          <dia:enum val="0"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O8">
          <dia:attribute name="obj_pos">
            <dia:point val="15,19"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.95,18.95;20.05,21.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="15,19"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="5"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O9">
          <dia:attribute name="obj_pos">
            <dia:point val="16.7775,20.064"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="16.7775,19.5215;18.2225,20.4615"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Meta#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="16.7775,20.064"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - PolyLine" version="0" id="O10">
        <dia:attribute name="obj_pos">
          <dia:point val="15,20"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="7.5,14.95;15.05,20.05"/>
        </dia:attribute>
        <dia:attribute name="poly_points">
          <dia:point val="15,20"/>
          <dia:point val="8,20"/>
          <dia:point val="8,15"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O11">
        <dia:attribute name="obj_pos">
          <dia:point val="15,14"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="10.95,13.5;15.05,14.5"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="15,14"/>
          <dia:point val="11,14"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - ZigZagLine" version="1" id="O12">
        <dia:attribute name="obj_pos">
          <dia:point val="20,20"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="19.95,1.5;27.05,20.05"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="20,20"/>
          <dia:point val="27,20"/>
          <dia:point val="27,2"/>
          <dia:point val="20,2"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="0"/>
          <dia:enum val="1"/>
          <dia:enum val="0"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="false"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O13">
        <dia:attribute name="obj_pos">
          <dia:point val="17.5,15"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="17,14.95;18,19.05"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="17.5,15"/>
          <dia:point val="17.5,19"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - PolyLine" version="0" id="O14">
        <dia:attribute name="obj_pos">
          <dia:point val="8,13"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="7.95,1.5;15.05,13.05"/>
        </dia:attribute>
        <dia:attribute name="poly_points">
          <dia:point val="8,13"/>
          <dia:point val="8,2"/>
          <dia:point val="15,2"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O15">
          <dia:attribute name="obj_pos">
            <dia:point val="5,13"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,12.95;11.05,15.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="5,13"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O16">
          <dia:attribute name="obj_pos">
            <dia:point val="6.91375,14.0725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="6.91375,13.53;9.08625,14.47"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Symbol#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="6.91375,14.0725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - Text" version="1" id="O17">
        <dia:attribute name="obj_pos">
          <dia:point val="18,12"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18,11.4575;21.06,12.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="18,12"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O18">
        <dia:attribute name="obj_pos">
          <dia:point val="18,6"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18,5.4575;21.06,6.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="18,6"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O19">
        <dia:attribute name="obj_pos">
          <dia:point val="18,16"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18,15.4575;19.03,16.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#has#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="18,16"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O20">
        <dia:attribute name="obj_pos">
          <dia:point val="21,20"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="21,19.4575;24.06,20.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="21,20"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O21">
        <dia:attribute name="obj_pos">
          <dia:point val="11,20"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="11,19.4575;14.06,20.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="11,20"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O22">
        <dia:attribute name="obj_pos">
          <dia:point val="12,15"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="12,14.4575;15.06,15.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="12,15"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O23">
        <dia:attribute name="obj_pos">
          <dia:point val="9,12"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="9,11.4575;12.06,12.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="9,12"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O24">
        <dia:attribute name="obj_pos">
          <dia:point val="1,13"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="1,12.4575;10.5175,13.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#(Line of Development  /  Branch)#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="1,13"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/CollRev2.dia.

































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="13,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="12.95,0.95;20.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="13,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="7"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="15.2818,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="15.2818,1.52147;17.7182,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="15.2818,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="13,7"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="12.95,6.95;20.05,9.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="13,7"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="7"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="14.1456,8.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.1456,7.52147;18.8544,8.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision' (Child)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="14.1456,8.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O4">
          <dia:attribute name="obj_pos">
            <dia:point val="2,2"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="1.95,1.95;9.05,4.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="2,2"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="7"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O5">
          <dia:attribute name="obj_pos">
            <dia:point val="5.00393,3.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5.00393,2.52147;5.97901,3.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#File#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="5.00393,3.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - Line" version="0" id="O6">
        <dia:attribute name="obj_pos">
          <dia:point val="13,8"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="8.83023,6.5028;13.0606,8.06063"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="13,8"/>
          <dia:point val="9,7"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O7">
        <dia:attribute name="obj_pos">
          <dia:point val="13,2"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="8.83023,1.93937;13.0606,3.4972"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="13,2"/>
          <dia:point val="9,3"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O8">
        <dia:attribute name="obj_pos">
          <dia:point val="13,2"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="8.57833,1.92972;13.0703,7.35139"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="13,2"/>
          <dia:point val="9,7"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O9">
        <dia:attribute name="obj_pos">
          <dia:point val="13,8"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="8.57833,2.64861;13.0703,8.07028"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="13,8"/>
          <dia:point val="9,3"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O10">
          <dia:attribute name="obj_pos">
            <dia:point val="2,6"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="1.95,5.95;9.05,8.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="2,6"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="7"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O11">
          <dia:attribute name="obj_pos">
            <dia:point val="3.53147,6.6725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="3.53147,6.13;7.45147,7.87"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Line of
Development#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="3.53147,6.6725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - Text" version="1" id="O12">
        <dia:attribute name="obj_pos">
          <dia:point val="18,6"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18,5.4575;20.0947,6.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string># parent#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="18,6"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O13">
        <dia:attribute name="obj_pos">
          <dia:point val="18,7"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="17.5,2.95;18.5,7.05"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="18,7"/>
          <dia:point val="18,3"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:group>
        <dia:object type="Standard - Text" version="1" id="O14">
          <dia:attribute name="obj_pos">
            <dia:point val="22,7"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="22,6.4575;28.4122,8.1975"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#branch parent symbol
       (NULL)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="22,7"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Line" version="0" id="O15">
          <dia:attribute name="obj_pos">
            <dia:point val="20,8"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="19.95,7.5;22.05,8.5"/>
          </dia:attribute>
          <dia:attribute name="conn_endpoints">
            <dia:point val="20,8"/>
            <dia:point val="22,8"/>
          </dia:attribute>
          <dia:attribute name="numcp">
            <dia:int val="1"/>
          </dia:attribute>
          <dia:attribute name="end_arrow">
            <dia:enum val="22"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_length">
            <dia:real val="0.5"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_width">
            <dia:real val="0.5"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Polygon" version="0" id="O16">
          <dia:attribute name="obj_pos">
            <dia:point val="23,7"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="21.9293,6.87929;23.05,9.12071"/>
          </dia:attribute>
          <dia:attribute name="poly_points">
            <dia:point val="23,7"/>
            <dia:point val="22,8"/>
            <dia:point val="23,9"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - Text" version="1" id="O17">
        <dia:attribute name="obj_pos">
          <dia:point val="15,4"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="15,3.4575;16.57,4.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string># child#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="15,4"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O18">
        <dia:attribute name="obj_pos">
          <dia:point val="15,3"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="14.5,2.95;15.5,7.05"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="15,3"/>
          <dia:point val="15,7"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/CollRev3.dia.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:object type="Standard - Text" version="1" id="O0">
        <dia:attribute name="obj_pos">
          <dia:point val="7,15"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="7,14.6;7,15.8"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>##</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="7,15"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="13,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="12.95,0.95;19.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="13,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="14.04,1.66397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.04,1.12147;17.96,2.86147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Line of
Development#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="14.04,1.66397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="3,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2.95,0.95;9.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="3,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O4">
          <dia:attribute name="obj_pos">
            <dia:point val="4.04,1.66397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.04,1.12147;7.96,2.86147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Line' of
Development#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="4.04,1.66397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O5">
          <dia:attribute name="obj_pos">
            <dia:point val="3,13"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2.95,12.95;9.05,15.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="3,13"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O6">
          <dia:attribute name="obj_pos">
            <dia:point val="3.94,13.664"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="3.94,13.1215;8.06,14.8615"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision''
(Branch Start)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="3.94,13.664"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O7">
          <dia:attribute name="obj_pos">
            <dia:point val="13,7"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="12.95,6.95;19.05,9.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="13,7"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O8">
          <dia:attribute name="obj_pos">
            <dia:point val="14.7733,8.0725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.7733,7.53;17.2096,8.47"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="14.7733,8.0725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O9">
          <dia:attribute name="obj_pos">
            <dia:point val="23,13"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="22.95,12.95;29.05,15.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="23,13"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O10">
          <dia:attribute name="obj_pos">
            <dia:point val="25.5039,14.0725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="25.5039,13.53;26.479,14.47"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#File#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="25.5039,14.0725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O11">
          <dia:attribute name="obj_pos">
            <dia:point val="13,13"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="12.95,12.95;19.05,15.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="13,13"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O12">
          <dia:attribute name="obj_pos">
            <dia:point val="14.6933,13.6725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.6933,13.13;17.2896,14.87"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision'
(Child)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="14.6933,13.6725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - Line" version="0" id="O13">
        <dia:attribute name="obj_pos">
          <dia:point val="19,14"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18.95,13.5;23.05,14.5"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="19,14"/>
          <dia:point val="23,14"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O14">
        <dia:attribute name="obj_pos">
          <dia:point val="6,13"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="5.5,2.95;6.5,13.05"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="6,13"/>
          <dia:point val="6,3"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O15">
        <dia:attribute name="obj_pos">
          <dia:point val="18,9"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="17.5,8.95;18.5,13.05"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="18,9"/>
          <dia:point val="18,13"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O16">
        <dia:attribute name="obj_pos">
          <dia:point val="16,7"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="15.5,2.95;16.5,7.05"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="16,7"/>
          <dia:point val="16,3"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O17">
        <dia:attribute name="obj_pos">
          <dia:point val="14,13"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="13.5,8.95;14.5,13.05"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="14,13"/>
          <dia:point val="14,9"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - ZigZagLine" version="1" id="O18">
        <dia:attribute name="obj_pos">
          <dia:point val="9,14"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="8.95,7.5;13.05,14.05"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="9,14"/>
          <dia:point val="11,14"/>
          <dia:point val="11,8"/>
          <dia:point val="13,8"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="0"/>
          <dia:enum val="1"/>
          <dia:enum val="0"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - ZigZagLine" version="1" id="O19">
        <dia:attribute name="obj_pos">
          <dia:point val="6,15"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="5.95,14.95;26.5,17.05"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="6,15"/>
          <dia:point val="6,17"/>
          <dia:point val="26,17"/>
          <dia:point val="26,15"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="1"/>
          <dia:enum val="0"/>
          <dia:enum val="1"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="false"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - ZigZagLine" version="1" id="O20">
        <dia:attribute name="obj_pos">
          <dia:point val="19,8"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18.95,7.95;26.5,13.05"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="19,8"/>
          <dia:point val="26,8"/>
          <dia:point val="26,13"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="0"/>
          <dia:enum val="1"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O21">
        <dia:attribute name="obj_pos">
          <dia:point val="6,12"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="6,11.4575;8.2125,13.1975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string># branch
 parent#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="6,12"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O22">
        <dia:attribute name="obj_pos">
          <dia:point val="14,12"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="14,11.4575;16.0947,12.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string># parent#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="14,12"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O23">
        <dia:attribute name="obj_pos">
          <dia:point val="18,10"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18,9.4575;19.57,10.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string># child#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="18,10"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O24">
        <dia:attribute name="obj_pos">
          <dia:point val="19,7"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="19,6.52875;22.245,8.39875"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
 belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="19,7"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O25">
        <dia:attribute name="obj_pos">
          <dia:point val="6,15"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="6,14.4575;9.245,16.1975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
 belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="6,15"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O26">
        <dia:attribute name="obj_pos">
          <dia:point val="19,13"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="19,12.5288;22.245,14.3987"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
 belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="19,13"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O27">
        <dia:attribute name="obj_pos">
          <dia:point val="9,14"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="9,13.5288;11.0947,15.3987"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
 parent#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="9,14"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - ZigZagLine" version="1" id="O28">
        <dia:attribute name="obj_pos">
          <dia:point val="3,14"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="0.95,1.5;3.05,14.05"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="3,14"/>
          <dia:point val="1,14"/>
          <dia:point val="1,2"/>
          <dia:point val="3,2"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="0"/>
          <dia:enum val="1"/>
          <dia:enum val="0"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="false"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O29">
        <dia:attribute name="obj_pos">
          <dia:point val="1,12"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="1,11.4575;4.245,12.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string># belongs to#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="1,12"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O30">
        <dia:attribute name="obj_pos">
          <dia:point val="10,2.12153"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="10,1.10403;12.205,2.86403"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#=/=#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="1.5"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="10,2.12153"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/CollRev4.dia.

































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="3,8"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2.95,7.95;9.05,10.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="3,8"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="4.11647,8.66397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.11647,8.12147;7.86647,9.86147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision'
(Child NTDB)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="4.11647,8.66397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,0.95;11.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="6.78184,1.6725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="6.78184,1.13;9.21816,2.87"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision
(NTDB)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="6.78184,1.6725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O4">
          <dia:attribute name="obj_pos">
            <dia:point val="1,15"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="0.95,14.95;7.05,17.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="1,15"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O5">
          <dia:attribute name="obj_pos">
            <dia:point val="2.11647,15.664"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2.11647,15.1215;5.86647,16.8615"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision''
(Child NTDB)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="2.11647,15.664"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O6">
          <dia:attribute name="obj_pos">
            <dia:point val="13,13"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="12.95,12.95;19.05,15.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="13,13"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O7">
          <dia:attribute name="obj_pos">
            <dia:point val="14.2915,13.664"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14.2915,13.1215;17.6915,14.8615"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Revision""
(non-NTDB)#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="14.2915,13.664"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - Line" version="0" id="O8">
        <dia:attribute name="obj_pos">
          <dia:point val="8,8"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="7.93501,2.76788;10.4828,8.06499"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="8,8"/>
          <dia:point val="10,3"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O9">
        <dia:attribute name="obj_pos">
          <dia:point val="6,3"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="3.51719,2.93501;6.06499,8.23212"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="6,3"/>
          <dia:point val="4,8"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O10">
        <dia:attribute name="obj_pos">
          <dia:point val="4,10"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="1.51719,9.93501;4.06499,15.2321"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="4,10"/>
          <dia:point val="2,15"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O11">
        <dia:attribute name="obj_pos">
          <dia:point val="6,15"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="5.93501,9.76788;8.48281,15.065"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="6,15"/>
          <dia:point val="8,10"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O12">
        <dia:attribute name="obj_pos">
          <dia:point val="16,13"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="8.70852,8.54107;16.0682,13.0682"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="16,13"/>
          <dia:point val="9,9"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Line" version="0" id="O13">
        <dia:attribute name="obj_pos">
          <dia:point val="6,10"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="5.93178,9.93178;13.2915,14.4589"/>
        </dia:attribute>
        <dia:attribute name="conn_endpoints">
          <dia:point val="6,10"/>
          <dia:point val="13,14"/>
        </dia:attribute>
        <dia:attribute name="numcp">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O14">
        <dia:attribute name="obj_pos">
          <dia:point val="6,14"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="6,13.5288;8.27969,15.3987"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
  parent#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="6,14"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O15">
        <dia:attribute name="obj_pos">
          <dia:point val="6,3"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="6,2.4575;7.385,4.1975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
child#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="6,3"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O16">
        <dia:attribute name="obj_pos">
          <dia:point val="4,10"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="4,9.4575;5.385,11.1975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
child#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="4,10"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O17">
        <dia:attribute name="obj_pos">
          <dia:point val="15,12"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="15,11.5288;18.3897,13.3987"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
    dbparent#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="15,12"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O18">
        <dia:attribute name="obj_pos">
          <dia:point val="9,12"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="9,11.4575;11.865,12.3975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#    dbchild#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="9,12"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O19">
        <dia:attribute name="obj_pos">
          <dia:point val="8,7"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="8,6.4575;10.2797,8.1975"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#
  parent#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="0.80000000000000004"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="8,7"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/branching.odp.

cannot compute difference between binary files

Added art/concept1.dia.

cannot compute difference between binary files

Added art/concept2.dia.

cannot compute difference between binary files

Added art/delta1.dia.











































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="0.95,0.95;5.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="2,2"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2,1.4575;4.12,2.3975"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Header#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="2,2"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,0.95;9.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="5.53022,2"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5.53022,1.4575;8.45272,2.3975"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Segments#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="5.53022,2"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O4">
          <dia:attribute name="obj_pos">
            <dia:point val="9,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="8.95,0.95;13.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="9,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O5">
          <dia:attribute name="obj_pos">
            <dia:point val="10,2"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="10,1.4575;11.7893,2.3975"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Trailer#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="10,2"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/delta2.dia.

































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="4,7"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="3.95,6.95;9.05,9.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="4,7"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="5"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="4.73538,8.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.73538,7.52147;8.24757,8.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Copy Range#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="4.73538,8.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="4,4"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="3.95,3.95;9.05,6.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="4,4"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="5"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="4.64772,5.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.64772,4.52147;8.33522,5.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Insert Literal#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="4.64772,5.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - ZigZagLine" version="1" id="O4">
        <dia:attribute name="obj_pos">
          <dia:point val="2.5,3"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="2.45,2.95;4.05,5.5"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="2.5,3"/>
          <dia:point val="2.5,5"/>
          <dia:point val="4,5"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="1"/>
          <dia:enum val="0"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - ZigZagLine" version="1" id="O5">
        <dia:attribute name="obj_pos">
          <dia:point val="2.5,3"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="2.45,2.95;4.05,8.5"/>
        </dia:attribute>
        <dia:attribute name="orth_points">
          <dia:point val="2.5,3"/>
          <dia:point val="2.5,8"/>
          <dia:point val="4,8"/>
        </dia:attribute>
        <dia:attribute name="orth_orient">
          <dia:enum val="1"/>
          <dia:enum val="0"/>
        </dia:attribute>
        <dia:attribute name="autorouting">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="end_arrow">
          <dia:enum val="22"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_length">
          <dia:real val="0.5"/>
        </dia:attribute>
        <dia:attribute name="end_arrow_width">
          <dia:real val="0.5"/>
        </dia:attribute>
      </dia:object>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O6">
          <dia:attribute name="obj_pos">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="0.95,0.95;2.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="1"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Box" version="0" id="O7">
          <dia:attribute name="obj_pos">
            <dia:point val="2,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="1.95,0.95;3.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="2,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="1"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Box" version="0" id="O8">
          <dia:attribute name="obj_pos">
            <dia:point val="3,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2.95,0.95;4.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="3,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="1"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Box" version="0" id="O9">
          <dia:attribute name="obj_pos">
            <dia:point val="7,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="6.95,0.95;8.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="7,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="1"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O10">
          <dia:attribute name="obj_pos">
            <dia:point val="5,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5,1.52147;5.8775,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#***#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="5,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/delta3.dia.


































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="0.95,0.95;5.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="1.98659,2.0725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="1.98659,1.53;3.99635,2.47"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Length#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="1.98659,2.0725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,0.95;7.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="5.43272,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5.43272,1.52147;6.55022,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#"@"#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="5.43272,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O4">
          <dia:attribute name="obj_pos">
            <dia:point val="7,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="6.95,0.95;11.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="7,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O5">
          <dia:attribute name="obj_pos">
            <dia:point val="8.12625,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="8.12625,1.52147;9.87375,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Offset#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="8.12625,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O6">
          <dia:attribute name="obj_pos">
            <dia:point val="11,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="10.95,0.95;13.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="11,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O7">
          <dia:attribute name="obj_pos">
            <dia:point val="11.64,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="11.64,1.52147;12.36,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#","#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="11.64,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/delta4.dia.











































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="0.95,0.95;5.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="1.98659,2.0725"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="1.98659,1.53;3.99636,2.47"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Length#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="1.98659,2.0725"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="7,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="6.95,0.95;11.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="7,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="8.18375,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="8.18375,1.52147;9.81625,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Bytes#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="8.18375,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O4">
          <dia:attribute name="obj_pos">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,0.95;7.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O5">
          <dia:attribute name="obj_pos">
            <dia:point val="5.63375,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5.63375,1.52147;6.36625,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#":"#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="5.63375,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/delta5.dia.




















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,0.95;7.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="5.62522,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5.62522,1.52147;6.35772,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#";"#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="5.62522,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="0.95,0.95;5.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="1.47522,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="1.47522,1.52147;4.50772,2.46147"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Checksum#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="1.47522,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/delta6.dia.




















































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="0.95,0.95;5.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="1,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="4"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O1">
          <dia:attribute name="obj_pos">
            <dia:point val="2.39397,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2.39397,1.50441;3.60603,2.49559"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Size#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="2.39397,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O2">
          <dia:attribute name="obj_pos">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,0.95;7.05,3.05"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="5,1"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="2"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Text" version="1" id="O3">
          <dia:attribute name="obj_pos">
            <dia:point val="5.44022,2.06397"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5.44022,1.50441;6.55978,2.49559"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#"\n"#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="5.44022,2.06397"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/encode1.tex.



1
2
+
+
\LARGE A = (\sum_{i=0}^{NHASH-1} z_i) \bmod 2^{16}

Added art/encode10.dia.


















































































































































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<?xml version="1.0" encoding="UTF-8"?>
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute name="background">
      <dia:color val="#ffffff"/>
    </dia:attribute>
    <dia:attribute name="pagebreak">
      <dia:color val="#000099"/>
    </dia:attribute>
    <dia:attribute name="paper">
      <dia:composite type="paper">
        <dia:attribute name="name">
          <dia:string>#Letter#</dia:string>
        </dia:attribute>
        <dia:attribute name="tmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="bmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="lmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="rmargin">
          <dia:real val="2.5399999618530273"/>
        </dia:attribute>
        <dia:attribute name="is_portrait">
          <dia:boolean val="true"/>
        </dia:attribute>
        <dia:attribute name="scaling">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="fitto">
          <dia:boolean val="false"/>
        </dia:attribute>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="grid">
      <dia:composite type="grid">
        <dia:attribute name="width_x">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="width_y">
          <dia:real val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_x">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:attribute name="visible_y">
          <dia:int val="1"/>
        </dia:attribute>
        <dia:composite type="color"/>
      </dia:composite>
    </dia:attribute>
    <dia:attribute name="color">
      <dia:color val="#d8e5e5"/>
    </dia:attribute>
    <dia:attribute name="guides">
      <dia:composite type="guides">
        <dia:attribute name="hguides"/>
        <dia:attribute name="vguides"/>
      </dia:composite>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer name="Background" visible="true">
    <dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O0">
          <dia:attribute name="obj_pos">
            <dia:point val="6,2"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="5.975,1.975;12.025,22.025"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="6,2"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="20"/>
          </dia:attribute>
          <dia:attribute name="border_width">
            <dia:real val="0.050000000000000003"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
          <dia:attribute name="corner_radius">
            <dia:real val="1.1754943508222875e-38"/>
          </dia:attribute>
        </dia:object>
        <dia:group>
          <dia:object type="Standard - Box" version="0" id="O1">
            <dia:attribute name="obj_pos">
              <dia:point val="6,8"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="5.975,7.975;12.025,9.025"/>
            </dia:attribute>
            <dia:attribute name="elem_corner">
              <dia:point val="6,8"/>
            </dia:attribute>
            <dia:attribute name="elem_width">
              <dia:real val="6"/>
            </dia:attribute>
            <dia:attribute name="elem_height">
              <dia:real val="1"/>
            </dia:attribute>
            <dia:attribute name="border_width">
              <dia:real val="0.050000000000000003"/>
            </dia:attribute>
            <dia:attribute name="inner_color">
              <dia:color val="#ffff00"/>
            </dia:attribute>
            <dia:attribute name="show_background">
              <dia:boolean val="true"/>
            </dia:attribute>
            <dia:attribute name="corner_radius">
              <dia:real val="1.1754943508222875e-38"/>
            </dia:attribute>
          </dia:object>
          <dia:object type="Standard - Text" version="1" id="O2">
            <dia:attribute name="obj_pos">
              <dia:point val="5.95,8.4925"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="5.95,7.95;10.145,8.89"/>
            </dia:attribute>
            <dia:attribute name="text">
              <dia:composite type="text">
                <dia:attribute name="string">
                  <dia:string>#Gap =&gt; Insert#</dia:string>
                </dia:attribute>
                <dia:attribute name="font">
                  <dia:font family="sans" style="0" name="Helvetica"/>
                </dia:attribute>
                <dia:attribute name="height">
                  <dia:real val="0.80000000000000004"/>
                </dia:attribute>
                <dia:attribute name="pos">
                  <dia:point val="5.95,8.4925"/>
                </dia:attribute>
                <dia:attribute name="color">
                  <dia:color val="#000000"/>
                </dia:attribute>
                <dia:attribute name="alignment">
                  <dia:enum val="0"/>
                </dia:attribute>
              </dia:composite>
            </dia:attribute>
            <dia:attribute name="valign">
              <dia:enum val="3"/>
            </dia:attribute>
          </dia:object>
        </dia:group>
        <dia:group>
          <dia:object type="Standard - Box" version="0" id="O3">
            <dia:attribute name="obj_pos">
              <dia:point val="6,2"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="5.975,1.975;12.025,8.025"/>
            </dia:attribute>
            <dia:attribute name="elem_corner">
              <dia:point val="6,2"/>
            </dia:attribute>
            <dia:attribute name="elem_width">
              <dia:real val="6"/>
            </dia:attribute>
            <dia:attribute name="elem_height">
              <dia:real val="6"/>
            </dia:attribute>
            <dia:attribute name="border_width">
              <dia:real val="0.050000000000000003"/>
            </dia:attribute>
            <dia:attribute name="inner_color">
              <dia:color val="#90ee90"/>
            </dia:attribute>
            <dia:attribute name="show_background">
              <dia:boolean val="true"/>
            </dia:attribute>
            <dia:attribute name="corner_radius">
              <dia:real val="1.1754943508222875e-38"/>
            </dia:attribute>
          </dia:object>
          <dia:object type="Standard - Text" version="1" id="O4">
            <dia:attribute name="obj_pos">
              <dia:point val="5.975,2.53456"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="5.975,1.99206;8.91195,2.93206"/>
            </dia:attribute>
            <dia:attribute name="text">
              <dia:composite type="text">
                <dia:attribute name="string">
                  <dia:string>#Processed#</dia:string>
                </dia:attribute>
                <dia:attribute name="font">
                  <dia:font family="sans" style="0" name="Helvetica"/>
                </dia:attribute>
                <dia:attribute name="height">
                  <dia:real val="0.80000000000000004"/>
                </dia:attribute>
                <dia:attribute name="pos">
                  <dia:point val="5.975,2.53456"/>
                </dia:attribute>
                <dia:attribute name="color">
                  <dia:color val="#000000"/>
                </dia:attribute>
                <dia:attribute name="alignment">
                  <dia:enum val="0"/>
                </dia:attribute>
              </dia:composite>
            </dia:attribute>
            <dia:attribute name="valign">
              <dia:enum val="3"/>
            </dia:attribute>
          </dia:object>
        </dia:group>
        <dia:group>
          <dia:object type="Standard - Box" version="0" id="O5">
            <dia:attribute name="obj_pos">
              <dia:point val="6,9"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="5.975,8.975;12.025,18.025"/>
            </dia:attribute>
            <dia:attribute name="elem_corner">
              <dia:point val="6,9"/>
            </dia:attribute>
            <dia:attribute name="elem_width">
              <dia:real val="6"/>
            </dia:attribute>
            <dia:attribute name="elem_height">
              <dia:real val="9"/>
            </dia:attribute>
            <dia:attribute name="border_width">
              <dia:real val="0.050000000000000003"/>
            </dia:attribute>
            <dia:attribute name="inner_color">
              <dia:color val="#ffa500"/>
            </dia:attribute>
            <dia:attribute name="show_background">
              <dia:boolean val="true"/>
            </dia:attribute>
            <dia:attribute name="corner_radius">
              <dia:real val="1.1754943508222875e-38"/>
            </dia:attribute>
          </dia:object>
          <dia:object type="Standard - Text" version="1" id="O6">
            <dia:attribute name="obj_pos">
              <dia:point val="5.975,9.53456"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="5.975,8.99206;11.4275,9.93206"/>
            </dia:attribute>
            <dia:attribute name="text">
              <dia:composite type="text">
                <dia:attribute name="string">
                  <dia:string>#Common =&gt; Copy#</dia:string>
                </dia:attribute>
                <dia:attribute name="font">
                  <dia:font family="sans" style="0" name="Helvetica"/>
                </dia:attribute>
                <dia:attribute name="height">
                  <dia:real val="0.80000000000000004"/>
                </dia:attribute>
                <dia:attribute name="pos">
                  <dia:point val="5.975,9.53456"/>
                </dia:attribute>
                <dia:attribute name="color">
                  <dia:color val="#000000"/>
                </dia:attribute>
                <dia:attribute name="alignment">
                  <dia:enum val="0"/>
                </dia:attribute>
              </dia:composite>
            </dia:attribute>
            <dia:attribute name="valign">
              <dia:enum val="3"/>
            </dia:attribute>
          </dia:object>
        </dia:group>
        <dia:group>
          <dia:object type="Standard - Box" version="0" id="O7">
            <dia:attribute name="obj_pos">
              <dia:point val="5,11"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="4.95,10.95;13.05,15.05"/>
            </dia:attribute>
            <dia:attribute name="elem_corner">
              <dia:point val="5,11"/>
            </dia:attribute>
            <dia:attribute name="elem_width">
              <dia:real val="8"/>
            </dia:attribute>
            <dia:attribute name="elem_height">
              <dia:real val="4"/>
            </dia:attribute>
            <dia:attribute name="inner_color">
              <dia:color val="#bfbfbf"/>
            </dia:attribute>
            <dia:attribute name="show_background">
              <dia:boolean val="true"/>
            </dia:attribute>
            <dia:attribute name="corner_radius">
              <dia:real val="1.1754943508222875e-38"/>
            </dia:attribute>
          </dia:object>
          <dia:object type="Standard - Text" version="1" id="O8">
            <dia:attribute name="obj_pos">
              <dia:point val="4.95,11.9675"/>
            </dia:attribute>
            <dia:attribute name="obj_bb">
              <dia:rectangle val="4.95,10.95;9.26848,12.71"/>
            </dia:attribute>
            <dia:attribute name="text">
              <dia:composite type="text">
                <dia:attribute name="string">
                  <dia:string>#Window#</dia:string>
                </dia:attribute>
                <dia:attribute name="font">
                  <dia:font family="sans" style="0" name="Helvetica"/>
                </dia:attribute>
                <dia:attribute name="height">
                  <dia:real val="1.5"/>
                </dia:attribute>
                <dia:attribute name="pos">
                  <dia:point val="4.95,11.9675"/>
                </dia:attribute>
                <dia:attribute name="color">
                  <dia:color val="#000000"/>
                </dia:attribute>
                <dia:attribute name="alignment">
                  <dia:enum val="0"/>
                </dia:attribute>
              </dia:composite>
            </dia:attribute>
            <dia:attribute name="valign">
              <dia:enum val="3"/>
            </dia:attribute>
          </dia:object>
        </dia:group>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Box" version="0" id="O9">
          <dia:attribute name="obj_pos">
            <dia:point val="18,2"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="17.975,1.975;24.025,24.025"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="18,2"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="22"/>
          </dia:attribute>
          <dia:attribute name="border_width">
            <dia:real val="0.050000000000000003"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
          <dia:attribute name="corner_radius">
            <dia:real val="1.1754943508222875e-38"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Box" version="0" id="O10">
          <dia:attribute name="obj_pos">
            <dia:point val="18,5"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="17.975,4.975;24.025,14.025"/>
          </dia:attribute>
          <dia:attribute name="elem_corner">
            <dia:point val="18,5"/>
          </dia:attribute>
          <dia:attribute name="elem_width">
            <dia:real val="6"/>
          </dia:attribute>
          <dia:attribute name="elem_height">
            <dia:real val="9"/>
          </dia:attribute>
          <dia:attribute name="border_width">
            <dia:real val="0.050000000000000003"/>
          </dia:attribute>
          <dia:attribute name="inner_color">
            <dia:color val="#ffa500"/>
          </dia:attribute>
          <dia:attribute name="show_background">
            <dia:boolean val="true"/>
          </dia:attribute>
          <dia:attribute name="corner_radius">
            <dia:real val="1.1754943508222875e-38"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Text" version="1" id="O11">
          <dia:attribute name="obj_pos">
            <dia:point val="14,9"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="14,8.4575;16.8122,9.3975"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Signature#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="0.80000000000000004"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="14,9"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - ZigZagLine" version="1" id="O12">
          <dia:attribute name="obj_pos">
            <dia:point val="12,13"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="11.95,9;18.05,13.05"/>
          </dia:attribute>
          <dia:attribute name="orth_points">
            <dia:point val="12,13"/>
            <dia:point val="15,13"/>
            <dia:point val="15,9.5"/>
            <dia:point val="18,9.5"/>
          </dia:attribute>
          <dia:attribute name="orth_orient">
            <dia:enum val="0"/>
            <dia:enum val="1"/>
            <dia:enum val="0"/>
          </dia:attribute>
          <dia:attribute name="autorouting">
            <dia:boolean val="true"/>
          </dia:attribute>
          <dia:attribute name="end_arrow">
            <dia:enum val="22"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_length">
            <dia:real val="0.5"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_width">
            <dia:real val="0.5"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Text" version="1" id="O13">
          <dia:attribute name="obj_pos">
            <dia:point val="2,8"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="2,6.9825;4.6625,8.7425"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Base#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="1.5"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="2,8"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Line" version="0" id="O14">
          <dia:attribute name="obj_pos">
            <dia:point val="5,8"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="4.95,7.5;6.05,8.5"/>
          </dia:attribute>
          <dia:attribute name="conn_endpoints">
            <dia:point val="5,8"/>
            <dia:point val="6,8"/>
          </dia:attribute>
          <dia:attribute name="numcp">
            <dia:int val="1"/>
          </dia:attribute>
          <dia:attribute name="end_arrow">
            <dia:enum val="22"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_length">
            <dia:real val="0.5"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_width">
            <dia:real val="0.5"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:group>
        <dia:object type="Standard - Text" version="1" id="O15">
          <dia:attribute name="obj_pos">
            <dia:point val="1,11"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="1,9.9825;3.6725,11.7425"/>
          </dia:attribute>
          <dia:attribute name="text">
            <dia:composite type="text">
              <dia:attribute name="string">
                <dia:string>#Slide#</dia:string>
              </dia:attribute>
              <dia:attribute name="font">
                <dia:font family="sans" style="0" name="Helvetica"/>
              </dia:attribute>
              <dia:attribute name="height">
                <dia:real val="1.5"/>
              </dia:attribute>
              <dia:attribute name="pos">
                <dia:point val="1,11"/>
              </dia:attribute>
              <dia:attribute name="color">
                <dia:color val="#000000"/>
              </dia:attribute>
              <dia:attribute name="alignment">
                <dia:enum val="0"/>
              </dia:attribute>
            </dia:composite>
          </dia:attribute>
          <dia:attribute name="valign">
            <dia:enum val="3"/>
          </dia:attribute>
        </dia:object>
        <dia:object type="Standard - Line" version="0" id="O16">
          <dia:attribute name="obj_pos">
            <dia:point val="4,11"/>
          </dia:attribute>
          <dia:attribute name="obj_bb">
            <dia:rectangle val="3.95,10.5;5.05,11.5"/>
          </dia:attribute>
          <dia:attribute name="conn_endpoints">
            <dia:point val="4,11"/>
            <dia:point val="5,11"/>
          </dia:attribute>
          <dia:attribute name="numcp">
            <dia:int val="1"/>
          </dia:attribute>
          <dia:attribute name="end_arrow">
            <dia:enum val="22"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_length">
            <dia:real val="0.5"/>
          </dia:attribute>
          <dia:attribute name="end_arrow_width">
            <dia:real val="0.5"/>
          </dia:attribute>
        </dia:object>
      </dia:group>
      <dia:object type="Standard - Text" version="1" id="O17">
        <dia:attribute name="obj_pos">
          <dia:point val="6,2"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="6,0.9825;9.38727,2.7425"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#Target#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="1.5"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="6,2"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
      <dia:object type="Standard - Text" version="1" id="O18">
        <dia:attribute name="obj_pos">
          <dia:point val="18,2"/>
        </dia:attribute>
        <dia:attribute name="obj_bb">
          <dia:rectangle val="18,0.9825;21.3125,2.7425"/>
        </dia:attribute>
        <dia:attribute name="text">
          <dia:composite type="text">
            <dia:attribute name="string">
              <dia:string>#Origin#</dia:string>
            </dia:attribute>
            <dia:attribute name="font">
              <dia:font family="sans" style="0" name="Helvetica"/>
            </dia:attribute>
            <dia:attribute name="height">
              <dia:real val="1.5"/>
            </dia:attribute>
            <dia:attribute name="pos">
              <dia:point val="18,2"/>
            </dia:attribute>
            <dia:attribute name="color">
              <dia:color val="#000000"/>
            </dia:attribute>
            <dia:attribute name="alignment">
              <dia:enum val="0"/>
            </dia:attribute>
          </dia:composite>
        </dia:attribute>
        <dia:attribute name="valign">
          <dia:enum val="3"/>
        </dia:attribute>
      </dia:object>
    </dia:group>
  </dia:layer>
</dia:diagram>

Added art/encode2.tex.


1
+
\LARGE B = (\sum_{i=0}^{NHASH-1} (NHASH-i)z_i) \bmod 2^{16}

Added art/encode3.tex.


1
+
\LARGE V = 2^{16}B + A

Added art/encode4.tex.


1
+
\LARGE z_0

Added art/encode5.tex.


1
+
\LARGE z_{new}

Added art/encode6.tex.


1
+
\LARGE A_{new} = (A - z_0 + z_{new}) \bmod 2^{16}

Added art/encode7.tex.


1
+
\LARGE B_{new} = (B - z_0 NHASH + A_{new}) \bmod 2^{16}

Added art/encode8.tex.


1
+
\LARGE V_{new} = 2^{16}B_{new} + A_{new}

Added art/encode9.tex.


1
+
\LARGE A_{new}

Changes to auto.def.

1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
1
2


3
4
5
6
7
8
9
10


11
12

13
14
15
16
17
18
19
20
21


22
23
24
25
26
27





















28
29
30
31
32
33
34
35
36
37







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62


-
-





+


-
-


-
+








-
-






-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-










-
-
-
-
-
-
-

















-
+







# System autoconfiguration. Try: ./configure --help

# This must be above "options" below because it implicitly brings in the
# default Autosetup options, things like --prefix.
use cc cc-lib

options {
    with-openssl:path|auto|tree|none
                         => {Look for OpenSSL in the given path, automatically, in the source tree, or none}
    with-miniz=0         => {Use miniz from the source tree}
    with-zlib:path|auto|tree
                         => {Look for zlib in the given path, automatically, or in the source tree}
    with-sqlite:path|auto|tree
                         => {Look for sqlite in the given path, automatically, or in the source tree.}
    with-exec-rel-paths=0
                         => {Enable relative paths for external diff/gdiff}
    with-sanitizer:      => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined}
    with-legacy-mv-rm=1  => {Enable legacy behavior for mv/rm (skip checkout files)}
    with-th1-docs=0      => {Enable TH1 for embedded documentation pages}
    with-th1-hooks=0     => {Enable TH1 hooks for commands and web pages}
    with-tcl:path        => {Enable Tcl integration, with Tcl in the specified path}
    with-tcl-stubs=0     => {Enable Tcl integration via stubs library mechanism}
    with-tcl-private-stubs=0
                         => {Enable Tcl integration via private stubs mechanism}
    with-mman=0          => {Enable use of POSIX memory APIs from "sys/mman.h"}
    with-see=0           => {Enable the SQLite Encryption Extension (SEE)}
    print-minimum-sqlite-version=0
                         => {print the minimum SQLite version number required, and exit}
    internal-sqlite=1    => {Don't use the internal SQLite, use the system one}
    static=0             => {Link a static executable}
    fusefs=1             => {Disable the Fuse Filesystem}
    fossil-debug=0       => {Build with fossil debugging enabled}
    no-opt=0             => {Build without optimization}
    json=0               => {Build with fossil JSON API enabled}
    with-emsdk:path      => {Directory containing the Emscripten SDK}
    compile-commands=0 =>
      "Check for compile_commands.json support."
}

# Update the minimum required SQLite version number here, and also
# in src/main.c near the sqlite3_libversion_number() call.  Take care
# that both places agree!
define MINIMUM_SQLITE_VERSION "3.43.0"

# This is useful for people wanting Fossil to use an external SQLite library
# to compare the one they have against the minimum required
if {[opt-bool print-minimum-sqlite-version]} {
    puts [get-define MINIMUM_SQLITE_VERSION]
    exit 0
}

set outOfTreeBuild 0
if {![file exists fossil.1]} {
  puts "This appears to be an out-of-tree build."
  set outOfTreeBuild 1
}

# sqlite wants these types if possible
cc-with {-includes {stdint.h inttypes.h}} {
    cc-check-types uint32_t uint16_t int16_t uint8_t
}

# Use pread/pwrite system calls in place of seek + read/write if possible
define USE_PREAD [cc-check-functions pread]

# If we have cscope here, we'll use it in the "tags" target
if {[cc-check-progs cscope]} {
    define COLLECT_CSCOPE_DATA "cscope -bR $::autosetup(srcdir)/src/*.\[ch\]"
} else {
    define COLLECT_CSCOPE_DATA ""
}

# Find tclsh for the test suite.
#
# We can't use jimsh for this: the test suite uses features of Tcl that
# Jim doesn't support, either statically or due to the way it's built by
# autosetup.  For example, Jim supports `file normalize`, but only if
# you build it with HAVE_REALPATH, which won't ever be defined in this
# context because autosetup doesn't try to discover platform-specific
# details like that before it decides to build jimsh0.  Besides which,
# autosetup won't build jimsh0 at all if it can find tclsh itself.
# Ironically, this means we may right now be running under either jimsh0
# or a version of tclsh that we find unsuitable below!
cc-check-progs tclsh
set hbtd /usr/local/Cellar/tcl-tk
if {[string equal false [get-define TCLSH]]} {
    msg-result "WARNING: 'make test' will not run here."
} else {
    set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"]
    if {[expr {$v >= 8.6}]} {
    if {[expr $v >= 8.6]} {
        msg-result "Found Tclsh version $v in the PATH."
        define TCLSH tclsh
    } elseif {[file isdirectory $hbtd]} {
        # This is a macOS system with the Homebrew version of Tcl/Tk
        # installed.  Select the newest version.  It won't normally be
        # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
        # were in the PATH, it's bad practice to put /usr/local/bin (the
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
73
74
75
76
77
78
79
80
81
82









83
84
85
86
87
88
89







+


-
-
-
-
-
-
-
-
-







    }
}

define EXTRA_CFLAGS "-Wall"
define EXTRA_LDFLAGS ""
define USE_SYSTEM_SQLITE 0
define USE_LINENOISE 0
define FOSSIL_ENABLE_MINIZ 0
define USE_MMAN_H 0
define USE_SEE 0
define SQLITE3_ORIGIN 0
# SQLITE3_ORIGIN 0 = src/sqlite3, 1=src/sqlite3-see.c, 2=client-provided

# Maintain the C89/C90-style order of variable declarations before statements.
# Check if the compiler supports the respective warning flag.
if {[cctest -cflags -Wdeclaration-after-statement]} {
    define-append EXTRA_CFLAGS -Wdeclaration-after-statement
}


# This procedure is a customized version of "cc-check-function-in-lib",
# that does not modify the LIBS variable.  Its use prevents prematurely
# pulling in libraries that will be added later anyhow (e.g. "-ldl").
proc check-function-in-lib {function libs {otherlibs {}}} {
    if {[string length $otherlibs]} {
        msg-checking "Checking for $function in $libs with $otherlibs..."
155
156
157
158
159
160
161
162

163
164
165
166
167
168
169
170
171
172
173


174
175
176




177
178
179
180
181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247

248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285






286
287
288
289
290
291
292
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
129
130


131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150


151







































152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

170
171
172
173
174
175
176
177
178
179
180
181



182
183
184
185
186
187
188
189
190
191
192

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217







-
+









-
-
+
+



+
+
+
+











-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


















-
+











-
-
-











-












+
+
+
+
+
+







    } else {
        msg-result "no"
    }
    return $found
}

if {![opt-bool internal-sqlite]} {
  proc find_system_sqlite {} {
  proc find_internal_sqlite {} {

    # On some systems (slackware), libsqlite3 requires -ldl to link. So
    # search for the system SQLite once with -ldl, and once without. If
    # the library can only be found with $extralibs set to -ldl, then
    # the code below will append -ldl to LIBS.
    #
    foreach extralibs {{} {-ldl}} {

      # Locate the system SQLite by searching for sqlite3_open(). Then check
      # if sqlite3_stmt_isexplain can be found as well. If we can find open() but
      # not stmt_isexplain(), then the system SQLite is too old to link against
      # if sqlite3_create_window_function can be found as well. If we can find open() but
      # not create_window_function(), then the system SQLite is too old to link against
      # fossil.
      #
      if {[check-function-in-lib sqlite3_open sqlite3 $extralibs]} {
        if {![check-function-in-lib sqlite3_create_window_function sqlite3 $extralibs]} {
          user-error "system sqlite3 too old (require >= 3.25.0)"
        }

        # Success. Update symbols and return.
        #
        define USE_SYSTEM_SQLITE 1
        define-append LIBS -lsqlite3
        define-append LIBS $extralibs
        return
      }
    }
    user-error "system sqlite3 not found"
  }

  find_system_sqlite

  find_internal_sqlite
  proc test_system_sqlite {} {
    # Check compatibility of the system SQLite library by running the
    # sqlcompttest.c program in the source tree passes
    # MINIMUM_SQLITE_VERSION set at the top of this file to
    # sqlcompttest.c
    #
    set cmdline {}
    lappend cmdline {*}[get-define CCACHE]
    lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
    lappend cmdline $::autosetup(dir)/../tools/sqlcompattest.c -o conftest__
    lappend cmdline {*}[get-define LDFLAGS]
    lappend cmdline {*}[get-define LIBS]
    set sqlite-version [string cat "-D MINIMUM_SQLITE_VERSION=" [get-define MINIMUM_SQLITE_VERSION]]
    lappend cmdline {*}[set sqlite-version]
    set ok 1
    set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
    if {$err} {
       configlog "Failed: [join $cmdline]"
       if {[string length $result]>0} {configlog $result}
       configlog "============"
       set ok 0
    } elseif {$::autosetup(debug)} {
       configlog "Compiled OK: [join $cmdline]"
       configlog "============"
    }
    if {!$ok} {
      user-error "unable to compile SQLite compatibility test program"
    }
    set err [catch {exec-with-stderr ./conftest__} result errinfo]
    if {[get-define build] eq [get-define host]} {
      set err [catch {exec-with-stderr ./conftest__} result errinfo]
      if {$err} {
        user-error $result
      }
    }
    file delete ./conftest__
  }
  test_system_sqlite

}

proc is_mingw {} {
    return [string match *mingw* [get-define host]]
}

if {[is_mingw]} {
    define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
    define-append LIBS -lkernel32 -lws2_32
} else {
    #
    # NOTE: All platforms except MinGW should use the linenoise
    #       package.  It is currently unsupported on Win32.
    #
    define USE_LINENOISE 1
}

if {[string match *-solaris* [get-define host]]} {
    define-append EXTRA_CFLAGS {-D__EXTENSIONS__}
    define-append EXTRA_CFLAGS {-D_XOPEN_SOURCE=500 -D__EXTENSIONS__}
}

if {[opt-bool fossil-debug]} {
    define CFLAGS {-g -O0 -Wall}
    define-append CFLAGS -DFOSSIL_DEBUG
    msg-result "Debugging support enabled"
}

if {[opt-bool no-opt]} {
    define CFLAGS {-g -O0 -Wall}
    msg-result "Builting without compiler optimization"
    if {[opt-bool fossil-debug]} {
        define-append CFLAGS -DFOSSIL_DEBUG
    }
}

if {[opt-bool with-mman]} {
    define-append EXTRA_CFLAGS -DUSE_MMAN_H
    define USE_MMAN_H 1
    msg-result "Enabling \"sys/mman.h\" support"
}

if {[opt-bool with-see]} {
    define-append EXTRA_CFLAGS -DUSE_SEE
    define USE_SEE 1
    define SQLITE3_ORIGIN 1
    msg-result "Enabling encryption support"
}

if {[opt-bool json]} {
    # Reminder/FIXME (stephan): FOSSIL_ENABLE_JSON
    # is required in the CFLAGS because json*.c
    # have #ifdef guards around the whole file without
    # reading config.h first.
    define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON
    define FOSSIL_ENABLE_JSON
    msg-result "JSON support enabled"
}

if {[opt-bool with-legacy-mv-rm]} {
    define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_LEGACY_MV_RM=1
    define FOSSIL_ENABLE_LEGACY_MV_RM
    msg-result "Legacy mv/rm support enabled"
}

if {[opt-bool with-exec-rel-paths]} {
    define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_EXEC_REL_PATHS
    define FOSSIL_ENABLE_EXEC_REL_PATHS
    msg-result "Relative paths in external diff/gdiff enabled"
}

316
317
318
319
320
321
322
323

324
325
326
327
328
329
330
241
242
243
244
245
246
247

248
249
250
251
252
253
254
255







-
+







    define FOSSIL_DYNAMIC_BUILD
}

# Check for libraries that need to be sorted out early
cc-check-function-in-lib iconv iconv

# Helper for OpenSSL checking
proc check-for-openssl {msg {cflags {}} {libs {-lssl -lcrypto -lpthread}}} {
proc check-for-openssl {msg {cflags {}} {libs {-lssl -lcrypto}}} {
    msg-checking "Checking for $msg..."
    set rc 0
    if {[is_mingw]} {
        lappend libs -lgdi32 -lwsock32 -lcrypt32
    }
    if {[info exists ::zlib_lib]} {
        lappend libs $::zlib_lib
350
351
352
353
354
355
356




357
358
359
360
361
362






363
364
365
366
367
368
369
370
371







372
373
374

375
376
377
378
379
380
381
382
383
384

385
386
387
388

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405



406
407



408
409


410
411
412
413



414
415
416
417
418
419
420
421
422
423

424
425
426
427
428
429
430
431
432
433
434

435
436
437
438
439
440
441
442
275
276
277
278
279
280
281
282
283
284
285






286
287
288
289
290
291









292
293
294
295
296
297
298



299










300




301

















302
303
304


305
306
307


308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

326
327
328
329
330
331
332
333
334
335
336

337

338
339
340
341
342
343
344







+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
-
-
+
+




+
+
+









-
+










-
+
-







        return 1
    } else {
        msg-result "no"
        return 0
    }
}

if {[opt-bool with-miniz]} {
    define FOSSIL_ENABLE_MINIZ 1
    msg-result "Using miniz for compression"
} else {
# Check for zlib, using the given location if specified
set zlibpath [opt-val with-zlib]
if {$zlibpath eq "tree"} {
  set zlibdir [file dirname $autosetup(dir)]/compat/zlib
  if {![file isdirectory $zlibdir]} {
    user-error "The zlib in source tree directory does not exist"
    # Check for zlib, using the given location if specified
    set zlibpath [opt-val with-zlib]
    if {$zlibpath eq "tree"} {
        set zlibdir [file dirname $autosetup(dir)]/compat/zlib
        if {![file isdirectory $zlibdir]} {
            user-error "The zlib in source tree directory does not exist"
  } elseif { ([llength [glob -nocomplain -directory $zlibdir libz*]] == 0) } {
    user-error "With --with-zlib=tree, $zlibdir must be configured and built first."
  }
  cc-with [list -cflags "-I$zlibdir -L$zlibdir"]
  define-append EXTRA_CFLAGS -I$zlibdir
  define-append LIBS $zlibdir/libz.a
  set ::zlib_lib $zlibdir/libz.a
  msg-result "Using zlib in source tree"
} else {
        }
        cc-with [list -cflags "-I$zlibdir -L$zlibdir"]
        define-append EXTRA_CFLAGS -I$zlibdir
        define-append LIBS $zlibdir/libz.a
        set ::zlib_lib $zlibdir/libz.a
        msg-result "Using zlib in source tree"
    } else {
  set cftry {""}
  set ldtry {""}
  if {$zlibpath ni {auto ""}} {
        if {$zlibpath ni {auto ""}} {
    lappend cftry "-I$zlibpath"
    lappend cftry "-I$zlibpath/include"
    lappend ldtry "-L$zlibpath"
    lappend ldtry "-L$zlibpath/lib"
  }

  # Reverse the list of tests so we check most-specific to least, else
  # platform devel files will shadow local --with-zlib overrides.
  foreach c [lreverse $cftry] {
    if {[cc-with [list -cflags $c] {cc-check-includes zlib.h}]} {
            cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
      if {$c eq ""} {
        msg-result "Found zlib.h in default include path"
      } else {
        define-append EXTRA_CFLAGS "$c"
            define-append EXTRA_CFLAGS -I$zlibpath
        msg-result "Found zlib.h via $c"
      }
      set cfound $c
      break
    }
  }
  if {![info exists cfound]} {
    user-error "zlib.h not found; either install it or specify its location via --with-zlib"
  }
  foreach lcheck [lreverse $ldtry] {
    if {[cc-with [list -cflags "$cfound $lcheck"] {check-function-in-lib inflateEnd z}]} {
      if {$lcheck eq ""} {
        msg-result "Linked to zlib via default library path"
      } else {
        define-append EXTRA_LDFLAGS "$lcheck"
        msg-result "Linked to zlib via $lcheck"
      }
            define-append EXTRA_LDFLAGS -L$zlibpath
            msg-result "Using zlib from $zlibpath"
        }
      break
    }
        if {![cc-check-includes zlib.h] || ![check-function-in-lib inflateEnd z]} {
            user-error "zlib not found please install it or specify the location with --with-zlib"
        }
  }
  set ::zlib_lib -lz
        set ::zlib_lib -lz
    }
}

set ssldirs [opt-val with-openssl]
if {$ssldirs ne "none"} {
    if {[opt-bool with-miniz]} {
        user-error "The --with-miniz option is incompatible with OpenSSL"
    }
    set found 0
    if {$ssldirs eq "tree"} {
        set ssldir [file dirname $autosetup(dir)]/compat/openssl
        if {![file isdirectory $ssldir]} {
            user-error "The OpenSSL in source tree directory does not exist"
        }
        set msg "ssl in $ssldir"
        set cflags "-I$ssldir/include"
        set ldflags "-L$ssldir"
        set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a -lpthread"
        set ssllibs "$ssldir/libssl.a $ssldir/libcrypto.a"
        set found [check-for-openssl "ssl in source tree" "$cflags $ldflags" $ssllibs]
    } else {
        if {$ssldirs in {auto ""}} {
            catch {
                set cflags [exec pkg-config openssl --cflags-only-I]
                set ldflags [exec pkg-config openssl --libs-only-L]
                set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
            } msg
            if {!$found} {
                set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl \
                             /usr/pkg /usr/local /usr /usr/local/opt/openssl \
                             /usr/pkg /usr/local /usr /usr/local/opt/openssl"
                             /opt/homebrew/opt/openssl"
            }
        }
        if {!$found} {
            foreach dir $ssldirs {
                if {$dir eq ""} {
                    set msg "system ssl"
                    set cflags ""
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
383
384
385
386
387
388
389






































































390
391
392
393
394
395
396







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







    }
} else {
    if {[info exists ::zlib_lib]} {
        define-append LIBS $::zlib_lib
    }
}



########################################################################
# --with-sqlite=PATH checks for the first it finds of the following...
# - PATH/sqlite3.c and PATH/sqlite3.h
# - PATH/sqlite3.o (and assumes sqlite3.h is with it)
# - PATH/lib/libsqlite3* and PATH/include/sqlite3.h
define CFLAGS_INCLUDE {}
# ^^^ CFLAGS_INCLUDE is ONLY for -I... flags and their order is
# significant so that --with-sqlite=PATH's header can shadow our
# own. One caveat with this is that we cannot point --with-sqlite=PATH
# to the root of sqlite3's own build tree because that dir has a
# config.h which ends up shadowing src/config.h, breaking our build.
set sq3path [opt-val with-sqlite]
define SQLITE3_SRC.2 {}
define SQLITE3_OBJ.2 {}
define SQLITE3_SHELL_SRC.2 {$(SQLITE3_SHELL_SRC.0)}
if {$sq3path in {tree ""}} {
  msg-result "Using sqlite3.c from this source tree."
} else {
  # SQLITE3_ORIGIN:
  #   0 = local source tree
  #   1 = use external lib or sqlite3.o
  #   2 = use external sqlite3.c and (if found) shell.c
  define USE_SYSTEM_SQLITE 1
  define SQLITE3_ORIGIN 2
  if {$sq3path != "auto"} {
    if {([file exists $sq3path/sqlite3.c]) && \
        ([file exists $sq3path/sqlite3.h]) } {
      # Prefer sqlite3.[ch] if found.
      define SQLITE3_SRC.2 $sq3path/sqlite3.c
      define SQLITE3_OBJ.2 {$(SQLITE3_OBJ.0)}
      define USE_SYSTEM_SQLITE 2
      define SQLITE3_ORIGIN 2
      if {[file exists $sq3path/shell.c]} {
        define SQLITE3_SHELL_SRC.2 $sq3path/shell.c
      }
      define-append CFLAGS_INCLUDE -I$sq3path
      define-append EXTRA_LDFLAGS -lpthread
      # ^^^ additional -lXXX flags are conservative estimates
      msg-result "Using sqlite3.c and sqlite3.h from $sq3path"
    } elseif {[file exists $sq3path/sqlite3.o]} {
      # Use sqlite3.o if found.
      define SQLITE3_OBJ.2 $sq3path/sqlite3.o
      define-append CFLAGS_INCLUDE -I$sq3path
      define-append EXTRA_LDFLAGS $sq3path/sqlite3.o -lpthread
      # ^^^ additional -lXXX flags are conservative estimates
      msg-result "Using sqlite3.o from $sq3path"
    } elseif { ([llength [glob -nocomplain -directory $sq3path/lib libsqlite3*]] != 0) \
                 && ([file exists $sq3path/include/sqlite3.h]) } {
      # e.g. --with-sqlite=/usr/local. Try $sq3path/lib/libsqlite3*
      # and $sq3path/include/sqlite3.h
      define-append CFLAGS_INCLUDE -I$sq3path/include
      define-append EXTRA_LDFLAGS -L$sq3path/lib -lsqlite3 -lpthread
      # ^^^ additional -lXXX flags are conservative estimates
      msg-result "Using -lsqlite3 from $sq3path"
    } else {
      # Assume $sq3path holds both the lib and header
      cc-with [list -cflags "-I$sq3path -L$sq3path"]
      define-append CFLAGS_INCLUDE -I$sq3path
      define-append EXTRA_LDFLAGS -L$sq3path -lsqlite3 -lpthread
      # ^^^ additional -lXXX flags are conservative estimates
      msg-result "Using -lsqlite3 from $sq3path"
    }
  } elseif {![cc-check-includes sqlite3.h] || ![check-function-in-lib sqlite3_open_v2 sqlite3]} {
    user-error "libsqlite3 not found please install it or specify the location with --with-sqlite"
  }
}
define-append CFLAGS_INCLUDE {-I. -I$(SRCDIR) -I$(SRCDIR_extsrc)}

set tclpath [opt-val with-tcl]
if {$tclpath ne ""} {
    set tclprivatestubs [opt-bool with-tcl-private-stubs]
    # Note parse-tclconfig-sh is in autosetup/local.tcl
    if {$tclpath eq "1"} {
        set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6
        if {$tclprivatestubs} {
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
503
504
505
506
507
508
509



























510
511
512
513
514
515
516







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







    #
    set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
        $tclconfig(TCL_LD_FLAGS)]
    define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
    define FOSSIL_ENABLE_TCL
}

# Emscripten is a purely optional component used only for doing
# in-tree builds of WASM stuff, as opposed to WASM binaries we import
# from other places. This is only set up for Unix-style OSes and is
# untested anywhere but Linux.
set emsdkHome [opt-val with-emsdk]
define EMSDK_HOME ""
define EMSDK_ENV ""
define EMCC_OPT "-Oz"
if {$emsdkHome eq "" && [info exists ::env(EMSDK)]} {
  # Fall back to checking the environment. $EMSDK gets set
  # by sourcing emsdk_env.sh.
  set emsdkHome $::env(EMSDK)
}
if {$emsdkHome ne ""} {
  define EMSDK_HOME $emsdkHome
  set emsdkEnv "$emsdkHome/emsdk_env.sh"
  if {[file exists $emsdkEnv]} {
    puts "Using Emscripten SDK environment from $emsdkEnv."
    define EMSDK_ENV $emsdkEnv
    if {[info exists ::env(EMCC_OPT)]} {
      define EMCC_OPT $::env(EMCC_OPT)
    }
  } else {
    puts "emsdk_env.sh not found. Assuming emcc is in the PATH."
  }
}

# Network functions require libraries on some systems
cc-check-function-in-lib gethostbyname nsl
if {![cc-check-function-in-lib socket {socket network}]} {
    # Last resort, may be Windows
    if {[is_mingw]} {
        define-append LIBS -lwsock32
    }
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763

764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790

791
792
793
794
795
796
797
798
799
800
801
802
803

804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
536
537
538
539
540
541
542








543
544
545
546
547
548
549
550
551
552
553
554
555
556
557



558
559
560
561
562
563
564
565




















566













567
















568
569
570
571
572























573
574
575







-
-
-
-
-
-
-
-















-
-
-
+







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-





-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-



# Other nonstandard function checks
cc-check-functions utime
cc-check-functions usleep
cc-check-functions strchrnul
cc-check-functions pledge
cc-check-functions backtrace

# Termux on Android adds "getpass(char *)" to unistd.h, so check this so we
# guard against including it again; use cctest as cc-check-functions and 
# cctest_function check for "getpass()" with no args and fail
if {[cctest -link 1 -includes {unistd.h} -code "getpass(0);"]} {
    define FOSSIL_HAVE_GETPASS 1
    msg-result "Found getpass() with unistd.h"
}

# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
if {![cc-check-functions getloadavg]} {
  define FOSSIL_OMIT_LOAD_AVERAGE 1
  msg-result "Load average support unavailable"
}

# Check for getpassphrase() for Solaris 10 where getpass() truncates to 10 chars
if {![cc-check-functions getpassphrase]} {
    # Haiku needs this
    cc-check-function-in-lib getpass bsd
}
cc-check-function-in-lib sin m

# Check for the FuseFS library
if {[opt-bool fusefs]} {
  if {[opt-bool static]} {
     msg-result "FuseFS support disabled due to -static"
  } elseif {[cc-check-function-in-lib fuse_mount fuse]} {
  if {[cc-check-function-in-lib fuse_mount fuse]} {
     define-append EXTRA_CFLAGS -DFOSSIL_HAVE_FUSEFS
     define FOSSIL_HAVE_FUSEFS 1
     define-append LIBS -lfuse
     msg-result "FuseFS support enabled"
  }
}

########################################################################
# Checks the compiler for compile_commands.json support.
#
# Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
# if supported, "no" if not.
proc check-compile-commands {} {
    msg-checking "compile_commands.json support... "
    if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
        # This test reportedly incorrectly succeeds on one of
        # Martin G.'s older systems.
        msg-result "compiler supports compile_commands.json"
        define MAKE_COMPILATION_DB yes
        return 1
    } else {
        msg-result "compiler does not support compile_commands.json"
        define MAKE_COMPILATION_DB no
        return 0
    }
}

# Finally, append -ldl to make sure it's the last in the list.
define MAKE_COMPILATION_DB no
if {!$outOfTreeBuild} {
  if {[opt-bool compile-commands]} {
    check-compile-commands
  } else {
    puts "Use --compile-commands to enable check for compile-commands-capable compiler."
  }
} else {
  puts "Disabling compile_commands.json check for out-of-tree build."
  # This is an attempt to resolve the problem reported at
  # https://fossil-scm.org/forum/forumpost/d19061d09a8179d0
}

# The library order matters in case of static linking.
# Add -fsanitize compile and link options late: we don't want the C
# checks above to run with those sanitizers enabled.  It can not only
# be pointless, it can actually break correct tests.
set fsan [opt-val with-sanitizer]
if {[string length $fsan]} {
    define-append  EXTRA_CFLAGS -fsanitize=$fsan
    define-append EXTRA_LDFLAGS -fsanitize=$fsan
    if {[string first "undefined" $fsan] != -1} {
        # We need to link with libubsan if we're compiling under
        # GCC with -fsanitize=undefined.
        cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
    }
}

# Finally, append libraries that must be last. This matters more on some
# OSes than others, but is most broadly required for static linking.
if {[check-function-in-lib dlopen dl]} {
    # Some platforms (*BSD) have the dl functions already in libc and no libdl.
    # In such case we can link directly without -ldl.
    define-append LIBS [get-define lib_dlopen]
}
if {[opt-bool static]} {
    # Linux can only infer the dependency on pthread from OpenSSL when
    # doing dynamic linkage.
    define-append LIBS -lpthread
}

if {[get-define EMSDK_HOME] ne ""} {
  define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh
  make-template tools/emcc.sh.in
  catch {exec chmod u+x tools/emcc.sh}
} else {
  define EMCC_WRAPPER ""
  catch {exec rm -f tools/emcc.sh}
}

# Tag container builds with a prefix of the checkin ID of the version
# of Fossil each one contains.  This not only allows multiple images
# to coexist and multiple containers to be created unamgiguosly from
# them, it also changes the URL we fetch the source tarball from, so
# repeated builds of a given version generate and fetch the source
# tarball once only, keeping it in the local Docker/Podman cache.
set ci [readfile "$::autosetup(srcdir)/manifest.uuid"]
define FOSSIL_CI_PFX [string range $ci 0 11]

make-template Makefile.in
make-config-header autoconfig.h -auto {USE_* FOSSIL_*}

Changes to autosetup/README.autosetup.

1
2
3
4
5
6
7
8
9
10
11












1
-
-
-
-
-
-
-
-
-
-
-
+
README.autosetup created by autosetup v0.6.9

This is the autosetup directory for a local install of autosetup.
It contains autosetup, support files and loadable modules.

*.tcl files in this directory are optional modules which
can be loaded with the 'use' directive.

*.auto files in this directory are auto-loaded.

For more information, see http://msteveb.github.com/autosetup/
This is autosetup v0.6.6. See http://msteveb.github.com/autosetup/

Changes to autosetup/autosetup.

1
2
3
4
5
6

7
8
9

10
11
12

13
14
15
16
17
18
19
1
2
3
4
5

6
7


8
9
10

11
12
13
14
15
16
17
18





-
+

-
-
+


-
+







#!/bin/sh
# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/autosetup-find-tclsh`" "$0" "$@"
dir=`dirname "$0"`; exec "`$dir/find-tclsh`" "$0" &qu